linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: luofei <luofei@unicloud.com>
To: <mike.kravetz@oracle.com>, <akpm@linux-foundation.org>
Cc: <linux-mm@kvack.org>, <linux-kernel@vger.kernel.org>,
	luofei <luofei@unicloud.com>
Subject: [PATCH] hugetlbfs: fix description about atomic allocation of vmemmap pages when free huge page
Date: Tue, 15 Mar 2022 00:23:55 -0400	[thread overview]
Message-ID: <20220315042355.362810-1-luofei@unicloud.com> (raw)

No matter what context update_and_free_page() is called in,
the flag for allocating the vmemmap page is fixed
(GFP_KERNEL | __GFP_NORETRY | __GFP_THISNODE), and no atomic
allocation is involved, so the description of atomicity here
is somewhat inappropriate.

and the atomic parameter naming of update_and_free_page() is
somewhat misleading.

Signed-off-by: luofei <luofei@unicloud.com>
---
 mm/hugetlb.c | 10 ++++------
 1 file changed, 4 insertions(+), 6 deletions(-)

diff --git a/mm/hugetlb.c b/mm/hugetlb.c
index f8ca7cca3c1a..239ef82b7897 100644
--- a/mm/hugetlb.c
+++ b/mm/hugetlb.c
@@ -1570,8 +1570,8 @@ static void __update_and_free_page(struct hstate *h, struct page *page)
 
 /*
  * As update_and_free_page() can be called under any context, so we cannot
- * use GFP_KERNEL to allocate vmemmap pages. However, we can defer the
- * actual freeing in a workqueue to prevent from using GFP_ATOMIC to allocate
+ * use GFP_ATOMIC to allocate vmemmap pages. However, we can defer the
+ * actual freeing in a workqueue to prevent waits caused by allocating
  * the vmemmap pages.
  *
  * free_hpage_workfn() locklessly retrieves the linked list of pages to be
@@ -1617,16 +1617,14 @@ static inline void flush_free_hpage_work(struct hstate *h)
 }
 
 static void update_and_free_page(struct hstate *h, struct page *page,
-				 bool atomic)
+				 bool delay)
 {
-	if (!HPageVmemmapOptimized(page) || !atomic) {
+	if (!HPageVmemmapOptimized(page) || !delay) {
 		__update_and_free_page(h, page);
 		return;
 	}
 
 	/*
-	 * Defer freeing to avoid using GFP_ATOMIC to allocate vmemmap pages.
-	 *
 	 * Only call schedule_work() if hpage_freelist is previously
 	 * empty. Otherwise, schedule_work() had been called but the workfn
 	 * hasn't retrieved the list yet.
-- 
2.27.0


             reply	other threads:[~2022-03-15  4:24 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-03-15  4:23 luofei [this message]
2022-03-15 13:29 ` [PATCH] hugetlbfs: fix description about atomic allocation of vmemmap pages when free huge page Muchun Song
2022-03-15 21:16   ` Mike Kravetz
2022-03-16  0:42     ` Muchun Song
2022-03-16  2:26     ` 答复: " 罗飞
2022-03-16  1:40   ` 罗飞

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20220315042355.362810-1-luofei@unicloud.com \
    --to=luofei@unicloud.com \
    --cc=akpm@linux-foundation.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mm@kvack.org \
    --cc=mike.kravetz@oracle.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).