From: Dev Jain <dev.jain@arm.com>
To: Bo Zhang <zhangbo0325@gmail.com>,
akpm@linux-foundation.org, vbabka@kernel.org, david@kernel.org
Cc: surenb@google.com, mhocko@suse.com, brendan.jackman@linux.dev,
hannes@cmpxchg.org, ziy@nvidia.com, ljs@kernel.org,
liam@infradead.org, rppt@kernel.org, qi.zheng@linux.dev,
shakeel.butt@linux.dev, kasong@tencent.com, baohua@kernel.org,
axelrasmussen@google.com, yuanchu@google.com, weixugc@google.com,
zhaonanzhe@xiaomi.com, lipengfei28@xiaomi.com,
linux-mm@kvack.org, linux-kernel@vger.kernel.org,
Bo Zhang <zhangbo56@xiaomi.com>
Subject: Re: [RFC PATCH v2 4/4] mm: compaction: skip unmovable blocks for non-costly proactive mTHP compaction
Date: Mon, 19 Oct 2026 15:13:33 +0530 [thread overview]
Message-ID: <f4b8c610-abc4-4c0c-8d15-5d2de679a409@arm.com> (raw)
In-Reply-To: <20261001001412.3837085-5-zhangbo56@xiaomi.com>
On 01/10/26 5:44 am, Bo Zhang wrote:
> Proactive compaction scans all pageblocks including unmovable/reclaimable
> ones. For non-costly mTHP orders (<= PAGE_ALLOC_COSTLY_ORDER), those blocks
> are dominated by non-migratable kernel allocations (slab, page tables) and
> scanning them wastes cycles: a small order is easily satisfied from movable
> blocks alone, so there is no need to scavenge the few migratable fallback
> pages inside unmovable blocks.
>
> Costly orders keep scanning all blocks: they are hard to form and benefit
> from any migratable page available, including allocator fallbacks inside
> unmovable blocks.
I think this is a reasonable compromise for now.
>
> Restrict non-costly proactive compaction to movable/CMA blocks.
>
> Signed-off-by: Bo Zhang <zhangbo56@xiaomi.com>
> ---
> mm/compaction.c | 9 +++++++++
> 1 file changed, 9 insertions(+)
>
> diff --git a/mm/compaction.c b/mm/compaction.c
> index 0ff454ee5604..deddf931d0f2 100644
> --- a/mm/compaction.c
> +++ b/mm/compaction.c
> @@ -1404,10 +1404,19 @@ static bool suitable_migration_source(struct compact_control *cc,
> struct page *page)
> {
> int block_mt;
> + unsigned int order = compact_hpage_order();
> + bool costly = order > PAGE_ALLOC_COSTLY_ORDER;
>
> if (pageblock_skip_persistent(page))
> return false;
>
> + if (is_via_compact_memory(cc->order) && !costly) {
> + block_mt = get_pageblock_migratetype(page);
> + if (block_mt == MIGRATE_MOVABLE || is_migrate_cma(block_mt))
> + return true;
> + return false;
> + }
> +
> /*
> * Background compaction produces blocks for the zone at
> * large, with no particular allocation context. Allow al
next prev parent reply other threads:[~2026-10-19 9:43 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-10-01 0:14 [RFC PATCH v2 0/4] mm: compaction: mTHP-friendly memory compaction Bo Zhang
2026-10-01 0:14 ` [RFC PATCH v2 1/4] mm: compaction: parameterize fragmentation score by order Bo Zhang
2026-10-01 0:14 ` [RFC PATCH v2 2/4] mm: compaction: target mTHP order for proactive compaction Bo Zhang
2026-10-19 8:12 ` Dev Jain
2026-10-19 14:50 ` Xueyuan Chen
2026-10-19 15:03 ` Bo Zhang
2026-10-19 15:47 ` Bo Zhang
2026-10-01 0:14 ` [RFC PATCH v2 3/4] mm: compaction: skip isolating large folios that already satisfy mTHP Bo Zhang
2026-10-01 0:14 ` [RFC PATCH v2 4/4] mm: compaction: skip unmovable blocks for non-costly proactive mTHP compaction Bo Zhang
2026-10-19 9:43 ` Dev Jain [this message]
2026-10-19 15:50 ` [RFC PATCH v2 0/4] mm: compaction: mTHP-friendly memory compaction Xueyuan Chen
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=f4b8c610-abc4-4c0c-8d15-5d2de679a409@arm.com \
--to=dev.jain@arm.com \
--cc=akpm@linux-foundation.org \
--cc=axelrasmussen@google.com \
--cc=baohua@kernel.org \
--cc=brendan.jackman@linux.dev \
--cc=david@kernel.org \
--cc=hannes@cmpxchg.org \
--cc=kasong@tencent.com \
--cc=liam@infradead.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mm@kvack.org \
--cc=lipengfei28@xiaomi.com \
--cc=ljs@kernel.org \
--cc=mhocko@suse.com \
--cc=qi.zheng@linux.dev \
--cc=rppt@kernel.org \
--cc=shakeel.butt@linux.dev \
--cc=surenb@google.com \
--cc=vbabka@kernel.org \
--cc=weixugc@google.com \
--cc=yuanchu@google.com \
--cc=zhangbo0325@gmail.com \
--cc=zhangbo56@xiaomi.com \
--cc=zhaonanzhe@xiaomi.com \
--cc=ziy@nvidia.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
all inboxes | Powered by JetHome®