linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
From: "Zi Yan" <ziy@nvidia.com>
To: "Johannes Weiner" <hannes@cmpxchg.org>,
	"Wenchao Hao" <haowenchao22@gmail.com>,
	"Baolin Wang" <baolin.wang@linux.alibaba.com>
Cc: "Andrew Morton" <akpm@linux-foundation.org>, <linux-mm@kvack.org>,
	<linux-kernel@vger.kernel.org>
Subject: Re: [PATCH] mm/compaction: do not break pages whose order is larger than target order
Date: Tue, 29 Apr 2025 12:44:56 -0400	[thread overview]
Message-ID: <D9J9VSOZ94HI.3RJWIYXWKZQS@nvidia.com> (raw)
In-Reply-To: <20250424194200.GD840@cmpxchg.org>

On Thu Apr 24, 2025 at 3:42 PM EDT, Johannes Weiner wrote:
> On Thu, Apr 24, 2025 at 11:38:15PM +0800, Wenchao Hao wrote:
>> When scanning free pages for memory compaction, if the compaction target
>> order is explicitly specified, do not split pages in buddy whose order
>> are larger than compaction target order.

If such a free page exist, why is the compaction triggered? I assume
buddy allocator would use the free page for allocation.

I see your email to Baolin mentioning it is about proactive compaction.
In that scenario, the order is -1 and the added code does not apply,
right?

>
> Have you observed this to be an issue in practice?

I wonder the same.

The free pages are kept in cc.freepages list at its order.
compaction_alloc() tries to use a page with the smallest order from the
list to avoid split a large order free page. But if no small free pages
are available, compaction_alloc() will split a large free page to make
compaction going.

But what I do not understand is that if there is a free page with order
greater than cc->order, why didn't buddy allocator use it for
allocation?

>
> compact_finished() would have bailed if such a page had existed.
>
> compaction_capture() would steal such a page upon production.
>
> It could help with blocks freed by chance from somewhere else, where
> you'd preserve it to grab it later from the allocation retry. But if
> that's the target, it might be better to indeed isolate the page, and
> then capture it inside compaction_alloc()?

-- 
Best Regards,
Yan, Zi



  parent reply	other threads:[~2025-04-29 16:45 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-04-24 15:38 Wenchao Hao
2025-04-24 19:42 ` Johannes Weiner
2025-04-25 14:28   ` Wenchao Hao
2025-04-25 15:32     ` Johannes Weiner
2025-04-25 17:24       ` Wenchao Hao
2025-04-29 16:44   ` Zi Yan [this message]
2025-04-25  6:53 ` Baolin Wang
2025-04-25 14:57   ` Wenchao Hao

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=D9J9VSOZ94HI.3RJWIYXWKZQS@nvidia.com \
    --to=ziy@nvidia.com \
    --cc=akpm@linux-foundation.org \
    --cc=baolin.wang@linux.alibaba.com \
    --cc=hannes@cmpxchg.org \
    --cc=haowenchao22@gmail.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