From: Xiang Gao <gxxa03070307@gmail.com>
To: akpm@linux-foundation.org
Cc: linux-mm@kvack.org, linux-kernel@vger.kernel.org,
gaoxiang17 <gaoxiang17@xiaomi.com>
Subject: [PATCH] mm/page_alloc: Add some detailed comments in can_steal_fallback
Date: Fri, 20 Sep 2024 20:20:30 +0800 [thread overview]
Message-ID: <20240920122030.159751-1-gxxa03070307@gmail.com> (raw)
From: gaoxiang17 <gaoxiang17@xiaomi.com>
Signed-off-by: gaoxiang17 <gaoxiang17@xiaomi.com>
---
mm/page_alloc.c | 7 +++++++
1 file changed, 7 insertions(+)
diff --git a/mm/page_alloc.c b/mm/page_alloc.c
index 0aefae4a26b2..8b0634d1728b 100644
--- a/mm/page_alloc.c
+++ b/mm/page_alloc.c
@@ -1818,6 +1818,13 @@ static bool can_steal_fallback(unsigned int order, int start_mt)
if (order >= pageblock_order)
return true;
+ /*
+ * movable pages won't cause permanent fragmentation, so when you alloc small pages,
+ * you just need to temporarily steal unmovable or reclaimable pages that are closest
+ * to the request size. After a while, memory compact may occur to form large contiguous
+ * pages, and the next movable allocation may not need to steal. Unmovable and reclaimable
+ * allocation need to actually steal pages.
+ */
if (order >= pageblock_order / 2 ||
start_mt == MIGRATE_RECLAIMABLE ||
start_mt == MIGRATE_UNMOVABLE ||
--
2.34.1
reply other threads:[~2024-09-20 12:20 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
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=20240920122030.159751-1-gxxa03070307@gmail.com \
--to=gxxa03070307@gmail.com \
--cc=akpm@linux-foundation.org \
--cc=gaoxiang17@xiaomi.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mm@kvack.org \
/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