From patchwork Fri Oct 11 23:22:36 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ackerley Tng X-Patchwork-Id: 13833256 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by smtp.lore.kernel.org (Postfix) with ESMTP id 78659D1A427 for ; Fri, 11 Oct 2024 23:23:00 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id E6C416B00B2; Fri, 11 Oct 2024 19:22:59 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id DCD596B00B4; Fri, 11 Oct 2024 19:22:59 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id C20CC6B00B6; Fri, 11 Oct 2024 19:22:59 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0015.hostedemail.com [216.40.44.15]) by kanga.kvack.org (Postfix) with ESMTP id A06F86B00B2 for ; Fri, 11 Oct 2024 19:22:59 -0400 (EDT) Received: from smtpin10.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay07.hostedemail.com (Postfix) with ESMTP id EDE7A1605B4 for ; Fri, 11 Oct 2024 23:22:53 +0000 (UTC) X-FDA: 82662898794.10.53BC719 Received: from mail-pf1-f201.google.com (mail-pf1-f201.google.com [209.85.210.201]) by imf05.hostedemail.com (Postfix) with ESMTP id C93BE10000A for ; Fri, 11 Oct 2024 23:22:51 +0000 (UTC) Authentication-Results: imf05.hostedemail.com; dkim=pass header.d=google.com header.s=20230601 header.b=qmPEhKuh; spf=pass (imf05.hostedemail.com: domain of 3T7MJZwsKCBw24C6JD6QLF88GG8D6.4GEDAFMP-EECN24C.GJ8@flex--ackerleytng.bounces.google.com designates 209.85.210.201 as permitted sender) smtp.mailfrom=3T7MJZwsKCBw24C6JD6QLF88GG8D6.4GEDAFMP-EECN24C.GJ8@flex--ackerleytng.bounces.google.com; dmarc=pass (policy=reject) header.from=google.com ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1728688839; h=from:from:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-type:content-transfer-encoding: in-reply-to:in-reply-to:references:references:dkim-signature; bh=5z/uTVdP5L9L1RuFDdlTqhHJV3lmY38mQBJGe8OEp3E=; b=HTPPEz0t7f8R6j1OXJmd8EpR+tJX38iH1oty6zdvJ+oA7sVVVz7qlgpnbCSe+tXZ/ZgJdE nX3qX5Li8o17WJj4WJCGwdT3SX/fKCxMG3fDMnFudsOXNbkD/2UC9u5g8dg+l/n2MJRieO GqlGWDxoWGEOVMkks9ZMhFysSkuEPjs= ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1728688839; a=rsa-sha256; cv=none; b=UOUJ2WvSBNrmNbg+tTlfG0I344lIDQQtzLM3ARBMZJtM6RDDDBo/4RTzK1O8TuxyhGfKh5 5DPcwhLCHasEOdgI7IzZ8CYR9Z+b8Z1ydmb/VBxlOaOCb2FpxYQ6PqOxXxdFUnNWuHB+4M C0cH9odH+dkjqkoI9MGtgYKJKG8/Uds= ARC-Authentication-Results: i=1; imf05.hostedemail.com; dkim=pass header.d=google.com header.s=20230601 header.b=qmPEhKuh; spf=pass (imf05.hostedemail.com: domain of 3T7MJZwsKCBw24C6JD6QLF88GG8D6.4GEDAFMP-EECN24C.GJ8@flex--ackerleytng.bounces.google.com designates 209.85.210.201 as permitted sender) smtp.mailfrom=3T7MJZwsKCBw24C6JD6QLF88GG8D6.4GEDAFMP-EECN24C.GJ8@flex--ackerleytng.bounces.google.com; dmarc=pass (policy=reject) header.from=google.com Received: by mail-pf1-f201.google.com with SMTP id d2e1a72fcca58-71e49ae1172so531286b3a.2 for ; Fri, 11 Oct 2024 16:22:57 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20230601; t=1728688976; x=1729293776; darn=kvack.org; h=cc:to:from:subject:message-id:references:mime-version:in-reply-to :date:from:to:cc:subject:date:message-id:reply-to; bh=5z/uTVdP5L9L1RuFDdlTqhHJV3lmY38mQBJGe8OEp3E=; b=qmPEhKuhLiX1M8gZ5tkW95FvkXIYzuRa8WD5gJnyXU9wUaTxxGeANEKxfRiIIGRgQ9 TKQD2ccQcgWsUnINvI8HTqnQR+8HnkZYlYRIhgvhVG2Sua/IUZzerGTN8NLFZ4XFa/SN KJPdHSlznGl5PWa9vCsHn9JwcypMpzCby9XfkdjW+rPAiN3z903Aldc/JtR2cqVCoBqE jImjL5vnzDKssg6BqCVtPad+8+tggDSBwaV3NHE1oiQHazE2cDK0e5d71Lr3YEu8pNeV vBUmXXgkX1yd5cGFXHWeGMK5fuDxMcbaDAPBVHv0f316zptFsYn3CAjcGnXvbjK6ZaR7 gwpg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1728688976; x=1729293776; h=cc:to:from:subject:message-id:references:mime-version:in-reply-to :date:x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=5z/uTVdP5L9L1RuFDdlTqhHJV3lmY38mQBJGe8OEp3E=; b=icte1NlBfnqNbAUq6TTUJV4TWV7tb3B/FCZvG/JZLnC+z/M5leU6Dn5QiJw8pOlxSh MVcUX6o9f8Vo7IIgPYVDJyfxyKPsHA62DN56IDfyopEDqMWTaTvpPI3sez+db7vX/nSl OTuwrS+YCWti9S2ftBT8lU4F6vVgzpT7TUQQSGHQnSeLdJ6dx04aZmuin47Wtil6QnXG TTjIeaf1Ypx73qeT3M2eEMGsAiD7FWAmbXCrJAHDcID7lxepccA4+cOH8QiCoOxTImuH J5pKGAamL3s2qYrqVHSwFwzRnsxrT3eZLu+Gk0rAtVKWWLMqMscK0HNTsFjcZ7YIrerG BK7Q== X-Forwarded-Encrypted: i=1; AJvYcCVDo8kJmKgW9m7e0iWLwczcoMPOKeYYw5O4/9CautV5OOOtEB/WeUq6WONcQVztXRKCGcKmtCQ05w==@kvack.org X-Gm-Message-State: AOJu0YxjKVSH96krFj1yqPaWf6RRK2A+zcP5t3VxUSYArtSAKxD/OZd7 JjRIA0WXMArggrGSAoR2DC4HHFJATZjs8DrtGsD1tRea+q76tN3VMag2GkAXmtQZSk/OwYFX0DQ R6SKpwMY3R/5EW9+Ax1m5ag== X-Google-Smtp-Source: AGHT+IFfT7z16+ucRzSRkvBaeFJLnd4Fcce7MUMDnNMVo0kKP75g66nPfjELWNwdxuLQm7HYU5qKFyPa9P3bxM35iw== X-Received: from ackerleytng-ctop.c.googlers.com ([fda3:e722:ac3:cc00:146:b875:ac13:a9fc]) (user=ackerleytng job=sendgmr) by 2002:a05:6a00:6f60:b0:70d:fba:c51c with SMTP id d2e1a72fcca58-71e380c6404mr6646b3a.3.1728688975598; Fri, 11 Oct 2024 16:22:55 -0700 (PDT) Date: Fri, 11 Oct 2024 23:22:36 +0000 In-Reply-To: Mime-Version: 1.0 References: X-Mailer: git-send-email 2.47.0.rc1.288.g06298d1525-goog Message-ID: Subject: [RFC PATCH 1/3] mm: hugetlb: Simplify logic in dequeue_hugetlb_folio_vma() From: Ackerley Tng To: muchun.song@linux.dev, peterx@redhat.com, akpm@linux-foundation.org, rientjes@google.com, fvdl@google.com, jthoughton@google.com, david@redhat.com Cc: isaku.yamahata@intel.com, zhiquan1.li@intel.com, fan.du@intel.com, jun.miao@intel.com, tabba@google.com, quic_eberman@quicinc.com, roypat@amazon.co.uk, jgg@nvidia.com, jhubbard@nvidia.com, seanjc@google.com, pbonzini@redhat.com, erdemaktas@google.com, vannapurve@google.com, ackerleytng@google.com, pgonda@google.com, linux-kernel@vger.kernel.org, linux-mm@kvack.org X-Rspamd-Queue-Id: C93BE10000A X-Stat-Signature: 14pmfqdz6tiu3s8e5ggirppsb9nnrb18 X-Rspamd-Server: rspam09 X-Rspam-User: X-HE-Tag: 1728688971-583460 X-HE-Meta: U2FsdGVkX1+TWf2cFEzf3/vEZOwIxk4nx04mltx/dq8tsTVC3S6/Bp1QhlCPwpWyKZe0wFummRloKwcRzqfsMVtD7xZFGzds6ZCesJZge+nRoi90+aVjme2L/EttYyVwtPujoCl6KhY3oXLahzGTDwzmDkqRcAj5uHDvyyPDqwZsx5I+hs2vLYiwBB+rXPJJWCwYU/9Sq/UBVCvkW0BzF5e4Ig3vro02E2R3MKZY+9iZsFvqAgGQ7PXkV5w5LK3zjtgXAd+lxwlRVoIv1A3F8oKtg7DVsSu/pOnq+KdzQwDg05ByyDDRO5e7CUhv5ZI+r2aPAzuaUwiy8yBcJ2G2+LxwC4si2piS7pQIohOHDxFVarba4OQrRPqgZ3xchChEt7ejstwv2oi6CHYjuJmTh4yWactskLj1io2bj/JuHFoJ17Aa/AWEMupVq92NPmSP/tfEY3FOvBUstNMZ/wcGLndEycfj+XHkTz+Dk/Dmom/UGp4siirIVpHji6H8UPmBXYyG60Fm5SyFhDeITeGOOO0mbBzGDY83V+lyr2hmTIe+GOTr9Ddv5GRnAG+95zgJSo88w765yZXNQGKg5Tk4AxInySmVPFo+OzjfRrQB3Zgh+gDaWYxBpPBxkGTkyD80M/5c9GtVqyrCz8RN4mgQnN2j22P6YlwD7TcbCGHojzXhf0UKJZisPGuLdenmIK475pLm2DjJB+Pcx2NDyKdYeRoNTz3jz43XuBWTSqQfhZLMVMT6i+Tf6AXwcQst3jMV9dCC8ZzmwiPfyaBtoOgCGlbfy+xghViBNMQkvvGmv8K9OIevWrRNaxnu16D8mPLud/hwvBotwZ6Mj6GfzaAcMNQ1jGLAE6iH212M/0aGGTv+YZSF9SSQcWm+9PEIRT0YuIEf7GlG76X7xePn4Niar4suOfPvVIYsdWf/Ic2m3XRufxO8gNcvcmxWu1SN9ZmHpDlNfp6Zn6n7uZTzJhI H9L3WrQJ v7e8YjLJpoERNBjk5zbJiGuGYpMOX9euayerUEZbYfWE9iCD5uS5vr6AzQh+b923P8kygu1hNvdb38AfCdkugLR6pSmtQnhHKtcG+KNorv0QYOvoJbsTlhpKXpibvUhZm+b4BVkJ2kW1IhBnXTxHZWdq+n92y236fvthOhpBQXWQtq6ycNqlTUJqU/UNMeqP78JMPT9ZSTqqsbYQx3M3/X8jpkO9Lg64IYdXmo14T+augODCpp2gUtjdqg2UYcaF9JQ7dDCbfdgi9dra9L7zFFqcbjl31jqEqaClPfmqKOzjLWIm29iqH6uWNcKSzQIsxedh+IrjoHvheWsVvt4Qq+ZHFYBPhjyhORecxx/HXRGrGCDSnJEDVzSX32xLwUvtnFsbiPpO5N4FS7yBRvKTLdmtf0sEvzb4QEdN3yzdDxbTAw+bLS/HLDWO6xFn95FOHEoSE3qy3Psq3dgr+0mx8ejvLxNPH4++Hkzbxr6TIWA43MuSqyG2AIK0cBLXpSFrBkCS6C0RFMB7tEo+NJWA8O+HijCWreE2/5BrjcqTcoJGLfZQQ/pJi0NKEyILRcfHxSv8bOQf8toQhKPfNNfleYm0A8SyIWi7/X6ciEY2DxMy8qy/bjoknYA+kbw== X-Bogosity: Ham, tests=bogofilter, spamicity=0.000008, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: List-Subscribe: List-Unsubscribe: Replace arguments avoid_reserve and chg in dequeue_hugetlb_folio_vma() so dequeue_hugetlb_folio_vma() is more understandable. The new argument, use_hstate_resv, indicates whether the folio to be dequeued should be taken from reservations in hstate. If use_hstate_resv is true, the folio to be dequeued should be taken from reservations in hstate and hence h->resv_huge_pages is decremented, and the folio is marked so that the reservation is restored. If use_hstate_resv is false, then a folio needs to be taken from the pool and hence there must exist available_huge_pages(h), failing which, goto err. The bool use_hstate_resv can be reused within dequeue_hugetlb_folio_vma()'s caller, alloc_hugetlb_folio(). No functional changes are intended. As proof, the original two if conditions !vma_has_reserves(vma, chg) && !available_huge_pages(h) and avoid_reserve && !available_huge_pages(h) can be combined into (avoid_reserve || !vma_has_reserves(vma, chg)) && !available_huge_pages(h). Applying de Morgan's theorem on avoid_reserve || !vma_has_reserves(vma, chg) yields !avoid_reserve && vma_has_reserves(vma, chg), hence the simplification is correct. Signed-off-by: Ackerley Tng Acked-by: Peter Xu Reviewed-by: Oscar Salvador --- mm/hugetlb.c | 33 +++++++++++---------------------- 1 file changed, 11 insertions(+), 22 deletions(-) -- 2.47.0.rc1.288.g06298d1525-goog diff --git a/mm/hugetlb.c b/mm/hugetlb.c index 190fa05635f4..73165c670739 100644 --- a/mm/hugetlb.c +++ b/mm/hugetlb.c @@ -1281,8 +1281,9 @@ static bool vma_has_reserves(struct vm_area_struct *vma, long chg) } /* - * Only the process that called mmap() has reserves for - * private mappings. + * Only the process that called mmap() has reserves for private + * mappings. A child process with MAP_PRIVATE mappings created by their + * parent have no page reserves. */ if (is_vma_resv_set(vma, HPAGE_RESV_OWNER)) { /* @@ -1394,8 +1395,7 @@ static unsigned long available_huge_pages(struct hstate *h) static struct folio *dequeue_hugetlb_folio_vma(struct hstate *h, struct vm_area_struct *vma, - unsigned long address, int avoid_reserve, - long chg) + unsigned long address, bool use_hstate_resv) { struct folio *folio = NULL; struct mempolicy *mpol; @@ -1403,16 +1403,7 @@ static struct folio *dequeue_hugetlb_folio_vma(struct hstate *h, nodemask_t *nodemask; int nid; - /* - * A child process with MAP_PRIVATE mappings created by their parent - * have no page reserves. This check ensures that reservations are - * not "stolen". The child may still get SIGKILLed - */ - if (!vma_has_reserves(vma, chg) && !available_huge_pages(h)) - goto err; - - /* If reserves cannot be used, ensure enough pages are in the pool */ - if (avoid_reserve && !available_huge_pages(h)) + if (!use_hstate_resv && !available_huge_pages(h)) goto err; gfp_mask = htlb_alloc_mask(h); @@ -1430,7 +1421,7 @@ static struct folio *dequeue_hugetlb_folio_vma(struct hstate *h, folio = dequeue_hugetlb_folio_nodemask(h, gfp_mask, nid, nodemask); - if (folio && !avoid_reserve && vma_has_reserves(vma, chg)) { + if (folio && use_hstate_resv) { folio_set_hugetlb_restore_reserve(folio); h->resv_huge_pages--; } @@ -2973,6 +2964,7 @@ struct folio *alloc_hugetlb_folio(struct vm_area_struct *vma, struct mem_cgroup *memcg; bool deferred_reserve; gfp_t gfp = htlb_alloc_mask(h) | __GFP_RETRY_MAYFAIL; + bool use_hstate_resv; memcg = get_mem_cgroup_from_current(); memcg_charge_ret = mem_cgroup_hugetlb_try_charge(memcg, gfp, nr_pages); @@ -3033,20 +3025,17 @@ struct folio *alloc_hugetlb_folio(struct vm_area_struct *vma, if (ret) goto out_uncharge_cgroup_reservation; + use_hstate_resv = !avoid_reserve && vma_has_reserves(vma, gbl_chg); + spin_lock_irq(&hugetlb_lock); - /* - * glb_chg is passed to indicate whether or not a page must be taken - * from the global free pool (global change). gbl_chg == 0 indicates - * a reservation exists for the allocation. - */ - folio = dequeue_hugetlb_folio_vma(h, vma, addr, avoid_reserve, gbl_chg); + folio = dequeue_hugetlb_folio_vma(h, vma, addr, use_hstate_resv); if (!folio) { spin_unlock_irq(&hugetlb_lock); folio = alloc_buddy_hugetlb_folio_with_mpol(h, vma, addr); if (!folio) goto out_uncharge_cgroup; spin_lock_irq(&hugetlb_lock); - if (!avoid_reserve && vma_has_reserves(vma, gbl_chg)) { + if (use_hstate_resv) { folio_set_hugetlb_restore_reserve(folio); h->resv_huge_pages--; } From patchwork Fri Oct 11 23:22:37 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ackerley Tng X-Patchwork-Id: 13833257 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by smtp.lore.kernel.org (Postfix) with ESMTP id 19DC0D0EE3F for ; Fri, 11 Oct 2024 23:23:02 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 0FFA36B00B4; Fri, 11 Oct 2024 19:23:01 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 087D16B00B6; Fri, 11 Oct 2024 19:23:00 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id E1E666B00B7; Fri, 11 Oct 2024 19:23:00 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0013.hostedemail.com [216.40.44.13]) by kanga.kvack.org (Postfix) with ESMTP id C0E5A6B00B4 for ; Fri, 11 Oct 2024 19:23:00 -0400 (EDT) Received: from smtpin02.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay08.hostedemail.com (Postfix) with ESMTP id 88261140248 for ; Fri, 11 Oct 2024 23:22:55 +0000 (UTC) X-FDA: 82662898836.02.F06ED48 Received: from mail-pf1-f202.google.com (mail-pf1-f202.google.com [209.85.210.202]) by imf20.hostedemail.com (Postfix) with ESMTP id 4871F1C0012 for ; Fri, 11 Oct 2024 23:22:55 +0000 (UTC) Authentication-Results: imf20.hostedemail.com; dkim=pass header.d=google.com header.s=20230601 header.b=rSmkBLLU; spf=pass (imf20.hostedemail.com: domain of 3UbMJZwsKCB446E8LF8SNHAAIIAF8.6IGFCHOR-GGEP46E.ILA@flex--ackerleytng.bounces.google.com designates 209.85.210.202 as permitted sender) smtp.mailfrom=3UbMJZwsKCB446E8LF8SNHAAIIAF8.6IGFCHOR-GGEP46E.ILA@flex--ackerleytng.bounces.google.com; dmarc=pass (policy=reject) header.from=google.com ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1728688794; h=from:from:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-type:content-transfer-encoding: in-reply-to:in-reply-to:references:references:dkim-signature; bh=nJE7PzBze7zAcfbdc8FDy9pk9WnzblcaKcmb3qltDsU=; b=F38ibkjeY07r2CVrj9STxNSVI4JYlUwv/ZeQCAhKUzSMaAcFgwuKl69eS6MWBM9FvWl+Wv HNuQ6LTbTD3yRgQMgnhW97TRIZB/lhqZWxvD8ZJH4egfsraxHm3wA4YFWQEi6hf5znjw9J fC6yIXyHVqKB2lQga25c51oYBJbtlh0= ARC-Authentication-Results: i=1; imf20.hostedemail.com; dkim=pass header.d=google.com header.s=20230601 header.b=rSmkBLLU; spf=pass (imf20.hostedemail.com: domain of 3UbMJZwsKCB446E8LF8SNHAAIIAF8.6IGFCHOR-GGEP46E.ILA@flex--ackerleytng.bounces.google.com designates 209.85.210.202 as permitted sender) smtp.mailfrom=3UbMJZwsKCB446E8LF8SNHAAIIAF8.6IGFCHOR-GGEP46E.ILA@flex--ackerleytng.bounces.google.com; dmarc=pass (policy=reject) header.from=google.com ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1728688794; a=rsa-sha256; cv=none; b=DrHH75sBUU3fNvuuC8XKWL5r7XpTaRoYdoIhK6oPTldOH/A2/irjqu6BMCwbobPDx0eCky GBFtQBImeYQo7FHhDRVevOJZThhyCk7lkzyfYEBvuvaQO3X6Piyd3mq5oUWkwUOogWmf/r KhVwjraMJxdCgiGNKXQZ4S4mQyuBOs8= Received: by mail-pf1-f202.google.com with SMTP id d2e1a72fcca58-71e1ed58e9bso2950707b3a.0 for ; Fri, 11 Oct 2024 16:22:58 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20230601; t=1728688977; x=1729293777; darn=kvack.org; h=cc:to:from:subject:message-id:references:mime-version:in-reply-to :date:from:to:cc:subject:date:message-id:reply-to; bh=nJE7PzBze7zAcfbdc8FDy9pk9WnzblcaKcmb3qltDsU=; b=rSmkBLLU+gJvtzk9o6fqB0Qa0evie/G/oJUTwuyTqcvgg5S0ERKeI/8b+sWAqpOgyu 6bDjr5kBikUoCyIyX8xwu1oDddy2a+W3EITuWXYiXwH7x2G4W4L1pPsnFhQHy3DqqqQI fV0uIMr4E58OUj9wlhfPPIwPEOIUbV2Y5Y/Drcm2G7rmPX890BVF2GlLJx0dPFVYA+jg 51lsPB9CuUyw9Rdi7Ov+xGHjJm8NhqlBRdeB858w+sIYX1MpUN2AgKvyXdJwRJDo4fLN DDS3xrEMHWWfDRNEP9hFz/RB9OVlIYy1+Sjk5/Fl2lI+Wbh+uS4yOfVDBxxrtYsx0r64 28SA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1728688977; x=1729293777; h=cc:to:from:subject:message-id:references:mime-version:in-reply-to :date:x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=nJE7PzBze7zAcfbdc8FDy9pk9WnzblcaKcmb3qltDsU=; b=It0WVHt9Me943a3ZCR95y/XgZ7jW/61KDugPKEJEjEYtUv1Qb4O8vf9GU/JbJ0wRN0 Kh7RqK9uevqwmpKobx01aiNOxdKYNkH0iGfSwGgPizE0nePKK5pgPMVzZRmQ09KkPXdA /Wf6S2M+61sebRU75ffUvvAHvNwSD611frOka6jV0NX93Pzw02SR5g6b6toakHby6FEP 4SS5sGiG6LtU2kGqtr3m8qcxs2hE/I6L2roI5d8pKadTRETPbnxEhPWMj6tTo8MaicbN xbOUzdLDDwhpeMsPqzOnQZRyi0yq/so3Iu54Wo4bppFpTyQdhKMwsAoK88ps+pCovmXe VG8w== X-Forwarded-Encrypted: i=1; AJvYcCX4RlxFgT2ycPMN/1feQtQeAhFKo4aeLMqIeHGtcPLj2og3QUBFFEi6bAYWP6PEb8ghLVb+sm3LLA==@kvack.org X-Gm-Message-State: AOJu0YxUFP9B139u5Ef51MTF8Wr+0cmJ5BZ+Intizxm7ISwrmjQ1JCtR EYXj7+eUkXiUmqidLKdqYdyTxHFe7U2vStOBaY3s7McExsiXa50IP7nVT40wPM/fa6oPx1+dP2L 7nahLhRc18U5a3D8mpvKROg== X-Google-Smtp-Source: AGHT+IF8BpvRbiiW7MMpoPgSGCVrmxKRcOQNff2W1WyN3coN7ji1l7zEFJG8+MRsUOFufoc4FZXZrVo9qdPjRKOSmQ== X-Received: from ackerleytng-ctop.c.googlers.com ([fda3:e722:ac3:cc00:146:b875:ac13:a9fc]) (user=ackerleytng job=sendgmr) by 2002:a05:6a00:870b:b0:71e:4ec7:aed8 with SMTP id d2e1a72fcca58-71e4ec7afb8mr435b3a.6.1728688977169; Fri, 11 Oct 2024 16:22:57 -0700 (PDT) Date: Fri, 11 Oct 2024 23:22:37 +0000 In-Reply-To: Mime-Version: 1.0 References: X-Mailer: git-send-email 2.47.0.rc1.288.g06298d1525-goog Message-ID: <3d1946d01f63104de913c0979b5a596e2add1672.1728684491.git.ackerleytng@google.com> Subject: [RFC PATCH 2/3] mm: hugetlb: Refactor vma_has_reserves() to should_use_hstate_resv() From: Ackerley Tng To: muchun.song@linux.dev, peterx@redhat.com, akpm@linux-foundation.org, rientjes@google.com, fvdl@google.com, jthoughton@google.com, david@redhat.com Cc: isaku.yamahata@intel.com, zhiquan1.li@intel.com, fan.du@intel.com, jun.miao@intel.com, tabba@google.com, quic_eberman@quicinc.com, roypat@amazon.co.uk, jgg@nvidia.com, jhubbard@nvidia.com, seanjc@google.com, pbonzini@redhat.com, erdemaktas@google.com, vannapurve@google.com, ackerleytng@google.com, pgonda@google.com, linux-kernel@vger.kernel.org, linux-mm@kvack.org X-Rspamd-Server: rspam06 X-Rspamd-Queue-Id: 4871F1C0012 X-Stat-Signature: 3ffxwd8ic8k1za98szj3x331g6z54t8g X-Rspam-User: X-HE-Tag: 1728688975-251036 X-HE-Meta: U2FsdGVkX18qr/mvfkNOLxcArKrVV7K7GdjzWLuLIJvx6knttV6Qj5RC0jMPYHOMEgsKBjpbXuTQ2x+mqBG3gdmIGERWjPBVojIh8S3m3xJBNYPWTQlUUlk8LgzcHi+HymZ5d+zT08C/OYBVh6dvnpg62r9cfSFX+lsnQnNZHE8SxYYzY9DrW7sKLQ0bmk7Mjwq7+JUJi1ftsXVynN7HZWhs2vZPo7OKg8dVMVY6rQMLjJnQlTh95e6RynfIFRoEdxEYpQOJV83dlKXwkJPuz4HU3voo2idk6ClodcwDBCWm613a9SDsfZTNe0uEYyS3a2Z08PDBFrS7msk2OmgWAzWbn9Kwlq90pfuJf1X8YwRgJT0cWoQPfgKkrxoJs1n5ATkaco/GKqK0GP+7dSXJ7dFx5/oAvCD/deIOn0VJfktXN1FeVrrzNKv3xWsrvO3wtX6oFcke38ja2HIxBhg932+61xq+bWPBEngAQQSRi8ku95YzvcCeESaLLuSJ/OEu5B0KVwdWz0Km/gXRILEVXrDfEtcph/QX6fsoR/gkIK0vskRFmRFTxbLqI0HqoGNykBFZXNXunro9K6rmzNhMvslyXB2JlLF/WEnM7c8a7V9kEdie+2aixL9gF9Mn9mZl5jNwvrkiQG83Htm9rcXGHVp+FSJtdu1NCemZ6hvf2n6b40+qwHvAF5mbjL/DR61t2gGwnLh3YV+351pK3voBfIl7Cs1kfCgryCd7Y0hHUAwEmQFIvshjWFTGMJzPwvzlHegE0nmBS7QLd/cRlewGN6yMUxUgyJG90wKF20R3OriFovpNiIPCSA4YdyXMuWoVyDJpllMn8cwhNkAGzDHRvFfNsmpZrCFJbOB4QHtL8Drg4qkdSom6IR8uT89GBmkXWg5L58RGHywSvPCBkZC3RoiuEcRPvdClJfjfL8aloRZ78NEBaG2l60LGPzLaQGm+1B/NCEY9uoo3DdXp8PQ ywspKR7i 67SEnF6RNTTfhKSl3v6OcEchc/qUdsi3eetWsSDFgSmKel7iK0XgMBzNiGphpyP2+BnuyeuywUzQc/1/vVuLkQ5nQ4AlX5cu4zSj8aG1qmNRXIfIOC3QbmqG01iO48AaLcLjCuLNWPpvjC5b8rbSr5128Xfrg6bpLEo2Np9l3g+MIeUnGMHecsQjGUx1ySClcjrYBQxnFU9SqbxibSF8S6jRqGEbWqxjAHZOOq+lgZURgh40bWKPP+B7OTkTSYhkVhPqsDItAqZNU9v2SQyF0g5diX07Uixayhlp8Va2lgR/pH6Ne9TKgtVqec7hs1QaMGSgQ9hGsffUnTuw2KjY5dspYmHnvKZfBFilwha4EmEf4Qvmf7j9HVGtz3jxBKogA/lZtE365VhGSwSjGY1nPhnYgePS8jQdFm+bqS9iW1NaYZojLOWoW7amj42+LAXrbLMd+0zLIB8L4XzrUUGa7SFFMoEeQ+d7bDm71g0EbglpnQcRqdHl7zfC+fBUWA6gSUNUShncT6emEVeAyDDqKYFFOHaVqrS/popjkDDiyeaYxtQxqbfBVEtmQ3mQPN9pnmdB6jgzG/1DqTsYxghnuqdkObQOX9sGoF4vbyjcq0UHTH2ULrNPdHtlaOdMc9o158iBz X-Bogosity: Ham, tests=bogofilter, spamicity=0.000007, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: List-Subscribe: List-Unsubscribe: With the addition of the chg parameter, vma_has_reserves() no longer just determines whether the vma has reserves. The comment in the vma->vm_flags & VM_NORESERVE block indicates that this function actually computes whether or not the reserved count should be decremented. This refactoring also takes into account the allocation's request parameter avoid_reserve, which helps to further simplify the calling function alloc_hugetlb_folio(). Signed-off-by: Ackerley Tng --- mm/hugetlb.c | 16 +++++++++++++--- 1 file changed, 13 insertions(+), 3 deletions(-) -- 2.47.0.rc1.288.g06298d1525-goog diff --git a/mm/hugetlb.c b/mm/hugetlb.c index 73165c670739..47c421eba112 100644 --- a/mm/hugetlb.c +++ b/mm/hugetlb.c @@ -1246,9 +1246,19 @@ void clear_vma_resv_huge_pages(struct vm_area_struct *vma) hugetlb_dup_vma_private(vma); } -/* Returns true if the VMA has associated reserve pages */ -static bool vma_has_reserves(struct vm_area_struct *vma, long chg) +/* + * Returns true if this allocation should use (debit) hstate reservations, based on + * + * @vma: VMA config + * @chg: Whether the page requirement can be satisfied using subpool reservations + * @avoid_reserve: Whether allocation was requested to avoid using reservations + */ +static bool should_use_hstate_resv(struct vm_area_struct *vma, long chg, + bool avoid_reserve) { + if (avoid_reserve) + return false; + if (vma->vm_flags & VM_NORESERVE) { /* * This address is already reserved by other process(chg == 0), @@ -3025,7 +3035,7 @@ struct folio *alloc_hugetlb_folio(struct vm_area_struct *vma, if (ret) goto out_uncharge_cgroup_reservation; - use_hstate_resv = !avoid_reserve && vma_has_reserves(vma, gbl_chg); + use_hstate_resv = should_use_hstate_resv(vma, gbl_chg, avoid_reserve); spin_lock_irq(&hugetlb_lock); folio = dequeue_hugetlb_folio_vma(h, vma, addr, use_hstate_resv); From patchwork Fri Oct 11 23:22:38 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ackerley Tng X-Patchwork-Id: 13833258 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by smtp.lore.kernel.org (Postfix) with ESMTP id 87392D1A427 for ; Fri, 11 Oct 2024 23:23:04 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 40E926B00B6; Fri, 11 Oct 2024 19:23:03 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 2FC696B00B7; Fri, 11 Oct 2024 19:23:03 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 125DA6B00B8; Fri, 11 Oct 2024 19:23:03 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0014.hostedemail.com [216.40.44.14]) by kanga.kvack.org (Postfix) with ESMTP id D79AB6B00B6 for ; Fri, 11 Oct 2024 19:23:02 -0400 (EDT) Received: from smtpin28.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay10.hostedemail.com (Postfix) with ESMTP id 480E5C08D7 for ; Fri, 11 Oct 2024 23:22:57 +0000 (UTC) X-FDA: 82662898962.28.ACE636A Received: from mail-pj1-f74.google.com (mail-pj1-f74.google.com [209.85.216.74]) by imf02.hostedemail.com (Postfix) with ESMTP id 2B86780004 for ; Fri, 11 Oct 2024 23:22:54 +0000 (UTC) Authentication-Results: imf02.hostedemail.com; dkim=pass header.d=google.com header.s=20230601 header.b=k9c6PelH; spf=pass (imf02.hostedemail.com: domain of 3UrMJZwsKCB857F9MG9TOIBBJJBG9.7JHGDIPS-HHFQ57F.JMB@flex--ackerleytng.bounces.google.com designates 209.85.216.74 as permitted sender) smtp.mailfrom=3UrMJZwsKCB857F9MG9TOIBBJJBG9.7JHGDIPS-HHFQ57F.JMB@flex--ackerleytng.bounces.google.com; dmarc=pass (policy=reject) header.from=google.com ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1728688935; h=from:from:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-type:content-transfer-encoding: in-reply-to:in-reply-to:references:references:dkim-signature; bh=zQ3fy9ApFdIx/13nHC/ZJce/ALnWJIL4G1B3hOB5L24=; b=NDiCV6PORusRjoZ2OiUHK+swCUDcOq1z1o9MItNPLbk8bqd8f7ze3wmykot3vsw0cOzZ6/ EbocZfYzujJmbfIOUGgBgtkQujNJIyeY4ktcQSjrldrWmMiQB9MQkhz9my0oZ/8UWbY/F7 EW5GCtp9VGi2UT/vfKFyRAHZzIp6HVQ= ARC-Authentication-Results: i=1; imf02.hostedemail.com; dkim=pass header.d=google.com header.s=20230601 header.b=k9c6PelH; spf=pass (imf02.hostedemail.com: domain of 3UrMJZwsKCB857F9MG9TOIBBJJBG9.7JHGDIPS-HHFQ57F.JMB@flex--ackerleytng.bounces.google.com designates 209.85.216.74 as permitted sender) smtp.mailfrom=3UrMJZwsKCB857F9MG9TOIBBJJBG9.7JHGDIPS-HHFQ57F.JMB@flex--ackerleytng.bounces.google.com; dmarc=pass (policy=reject) header.from=google.com ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1728688935; a=rsa-sha256; cv=none; b=vRwrDq100Xb9WWc+vObgAfp3kNKS81NWpq43PFgUNOQTDw7sb1OHSyI3riZsGiu2G4CKwH dmWoYXTiG6kz/Ne0KhNUwJ5TO6xYHueNokFX14q/lAjLxfso+lqZCf8h8Cvzx82XuAigPd 3D0w0ojbMJ9pjsVqKu2t1arB5JD1FOs= Received: by mail-pj1-f74.google.com with SMTP id 98e67ed59e1d1-2e2e2e02817so1628113a91.1 for ; Fri, 11 Oct 2024 16:23:00 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20230601; t=1728688979; x=1729293779; darn=kvack.org; h=cc:to:from:subject:message-id:references:mime-version:in-reply-to :date:from:to:cc:subject:date:message-id:reply-to; bh=zQ3fy9ApFdIx/13nHC/ZJce/ALnWJIL4G1B3hOB5L24=; b=k9c6PelHEFvKgMPIVxmgUDsg5u+hOWEKh27c70SAdemurOhko3aXqMwO6aXN3Il5Pj yh7lWGjROYTCz6YQS8TT9M1b4bNfJrz61YvNaWM6vUc6KMpWgwLlrS+r2uWNzrLM3Uhs UalwOkipey/s7TGZAhYfe8F7UZDqK0z1s4ZVGZqM+XQLMjT9tQCrkGHhOlZAmhVquOdB ENu7vLci31Ou1GaPyl8tc5WT38VZDCJt2dFFy83yfogp40kT/GWomWc5vWFjU+s5nCwI 4/uKKNCemhXqj2Eh9MovXgFz1tMQIozpneK69sGTnWk5F1i0XJl1DWQM00VGxuR74QZU vijA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1728688979; x=1729293779; h=cc:to:from:subject:message-id:references:mime-version:in-reply-to :date:x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=zQ3fy9ApFdIx/13nHC/ZJce/ALnWJIL4G1B3hOB5L24=; b=mY7iCcyPUDxDBzFGD9U8wV+vEG2TY9hFO4oqEh+FOf6B3hLMP2rqAMaCTwo69Sqgs5 X99bZF+xvVxCsNjaqeif6fDJKl1j8caEbsy6uERXbOqlWUHyDZP1LbdTAVWZ2i0o+tbx XpW5oDmyC+grUaRDEBLRDayFntqaZfBKUVfCBWN/v7M0LJb67ET0mAv+pvaBusVFUEo7 qtkzOfFi8xeCxHqKskRtzp8bXl2RCC3tw8E9chy1/5x8pFevw8lrLniOIeJmxFRKUULy nWiPGavjGolmUlwgoZsm0Doil3j+e5QSqeDFe+6kwxgX8iZSMa/Pbj+WyQ/k8bA8jXXb Mlvg== X-Forwarded-Encrypted: i=1; AJvYcCWDQKqudbTU6oXP1kadRIw9Eyt8X2MhIi6HTKA1HB283ut60sj+lDWrjizrOhPtCwVD5L5dzwKUqg==@kvack.org X-Gm-Message-State: AOJu0Yz/bIf2R5Qj8fb1fVg2U6VkyLIm9ixbnIq0ZfS2OI+NfCF6yF5E vFy9GwGlQG/Ox91PTGYzK4L3g4s9Uad5g6BldPlWRlNbqgVxo1nNBqPoihE7ZDLy9TictJvgqY8 4Ijnnzlrx74Xy4uu2uqSqbQ== X-Google-Smtp-Source: AGHT+IFr0sptcozt+ZrAH3WS4hJI40RdtRwKwkDb7kVtF/SqVh1nyxpm+MDJx1CARv2yQw1qWp7ccQL5vo9X2qDvGw== X-Received: from ackerleytng-ctop.c.googlers.com ([fda3:e722:ac3:cc00:146:b875:ac13:a9fc]) (user=ackerleytng job=sendgmr) by 2002:a17:90b:3109:b0:2e2:9984:802b with SMTP id 98e67ed59e1d1-2e2c81bd68cmr13813a91.3.1728688978977; Fri, 11 Oct 2024 16:22:58 -0700 (PDT) Date: Fri, 11 Oct 2024 23:22:38 +0000 In-Reply-To: Mime-Version: 1.0 References: X-Mailer: git-send-email 2.47.0.rc1.288.g06298d1525-goog Message-ID: <5d0ededd93c4cd33a78c43c12d5075be2eea9674.1728684491.git.ackerleytng@google.com> Subject: [RFC PATCH 3/3] mm: hugetlb: Remove unnecessary check for avoid_reserve From: Ackerley Tng To: muchun.song@linux.dev, peterx@redhat.com, akpm@linux-foundation.org, rientjes@google.com, fvdl@google.com, jthoughton@google.com, david@redhat.com Cc: isaku.yamahata@intel.com, zhiquan1.li@intel.com, fan.du@intel.com, jun.miao@intel.com, tabba@google.com, quic_eberman@quicinc.com, roypat@amazon.co.uk, jgg@nvidia.com, jhubbard@nvidia.com, seanjc@google.com, pbonzini@redhat.com, erdemaktas@google.com, vannapurve@google.com, ackerleytng@google.com, pgonda@google.com, linux-kernel@vger.kernel.org, linux-mm@kvack.org X-Rspam-User: X-Stat-Signature: zubhqwjinsb4j17x3tfr6wruefjr1zqk X-Rspamd-Queue-Id: 2B86780004 X-Rspamd-Server: rspam11 X-HE-Tag: 1728688974-851500 X-HE-Meta: U2FsdGVkX1/M7L7bS2k0/7gsK+CXeZ+0yVvdJdjT1DwHXI9HYjg0vg0S3O5ekGLWBUx13QNElqE3QXCj2/E/zPd67OXyK0fsOCgrwXeLap7g9HAkRJwHAP3apoJfg2An2eCJZZErvwFkuu5tUZ2uEGKOQ/Wbe3bK7+j5K3DYDAvfbvNkg85KwyZ0tXs91zaRsbVjrd5QYPm+mt887dfFvTGs/x+gRtRa+3XJLIV5SI/Ygzh3FFe7TGC/qwHU19nvSWzrn/wam4aUUtX/uMl0r5dyQRXJsWf5C2J7kIQLn0MSx2ImzXe3nY88QpBNFfAHBybm3uuyEX0iDpu0qIQwewQxfJRsyprRgiflRJcsBdoOrB/RwsTLe5EHxbyr4KOkulb5sCsbBRLwL/b+Ua1nYHdp6VrlW7q0f3WDXHflpofRTDooUb5RjyWJwsTEhT3oi2kEpXWw6ExphCeQoM3xv9Eyf9jbyF/F5H4CtDyIMJzSsW0ifU575dkbvTS4aER17bKKtpqcJSA1X8/XRF21g2gV+IuTgFZcwix9QAsDq7170vieIsGOIhwGlctYuJPR9N1MmiFDJ/QqvU0sHxnIaJc6s+9NRm6iJcVbSNK0KKv0X0dV2qpLCRP6AJIGYTvRqGT5RbZdcC+Xwg7W/tu1I9xVH8BCvu80+4pk18AdypUqP1Kn4nPAsYKs7uaADfbHzfX9nvWyWiEkUQjrhKUla9EIppz1h/YXjlFLfLFQUYmH0ZwbJiGMwgoi2fnYrawXmeg4R0iY3HjrNC0s+pfgWDB8fMep0NHqLZRVkwka9iobjMbXaF6VVGjectQ8wvcNhahGFzLQoki45z01JZrL10ePnp/pnpvgnfvOe7W+o6iE/xayAEp4lsHQBqmYDPoKeVM6Exa2264BQVX8X+5MAoETlUdfzMOuStpJq89VgFPdIvKd8dLzSQVl5Bov8fejvCi/nIzPMbRIsv/LaXf Zu3588FR 1F+t7mCSfUsvUDwDhC2xQeLFDx5JmaO+vwNz7umwzaYyg0d8armO9x6L899RaoKnpWM3r77WlKFA+7+JmxZZ/D62ZlYR4v0lqlvDGbPV4s/ocT0ElptNEQ6ySeou7sO1+R7Q1sCFhmoi1ksDojQFowA6oZaKVHid26YOCPDtfJ0f+5OXFJv6hUwHNi9LX1kzG0Lcq0Ude7MioKgaCdXwc2yTPeITMnbA4t61gcC9MeKoqkZsN6zcsqu3Wc0yjzfo6N6AyDTm+OD5rbzu1h/bJespmniANj0N8FaNAPIc2AyR3n9z1KlAgAVA5qq+K/ZIdP1VY0Uo7ZpGmkO+os58ebftUsBaCu1y1m+UGdtzAoS5dxcWpRkxCoy05Crq9MR9u8wKAaD903TOOPg9WO+7cgEgtR50VXtybbd6mlX+dbp6T30JvdVJHAIRFevjQEIJroZRCbYauQmOIXZAPUL3umrHgjfPPU/N/yFA3qAsCmfxzNH2+cwZzja5ZdMRo5vzSlses9NlYztcdchGJlQ7ATIiD65DL0+iKiT32Sz8GeGKlZgyJx7bHwpVFc6Dj1JWqK4JEIvjbeyzZO9P7Pk5tsDW/vhEZAa+HNjra1KZOj2iJUgpfa1UdBK7BENCx+8wwtwq9HPTS+KdLfv38Suh0R6/ESA== X-Bogosity: Ham, tests=bogofilter, spamicity=0.006224, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: List-Subscribe: List-Unsubscribe: If avoid_reserve is true, gbl_chg is not used anyway, so there is no point in setting gbl_chg. Signed-off-by: Ackerley Tng --- mm/hugetlb.c | 10 ---------- 1 file changed, 10 deletions(-) -- 2.47.0.rc1.288.g06298d1525-goog diff --git a/mm/hugetlb.c b/mm/hugetlb.c index 47c421eba112..a2e2b770a018 100644 --- a/mm/hugetlb.c +++ b/mm/hugetlb.c @@ -3009,16 +3009,6 @@ struct folio *alloc_hugetlb_folio(struct vm_area_struct *vma, if (gbl_chg < 0) goto out_end_reservation; - /* - * Even though there was no reservation in the region/reserve - * map, there could be reservations associated with the - * subpool that can be used. This would be indicated if the - * return value of hugepage_subpool_get_pages() is zero. - * However, if avoid_reserve is specified we still avoid even - * the subpool reservations. - */ - if (avoid_reserve) - gbl_chg = 1; } /* If this allocation is not consuming a reservation, charge it now.