mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Lian Wang <lianux.mm@gmail.com>
To: Baolin Wang <baolin.wang@linux.alibaba.com>
Cc: "Lian Wang (ProcessMission)" <lianux.mm@gmail.com>,
	Johannes Weiner <hannes@cmpxchg.org>,
	"Barry Song (Xiaomi)" <baohua@kernel.org>,
	akpm@linux-foundation.org, linux-mm@kvack.org,
	linux-kernel@vger.kernel.org,
	David Hildenbrand <david@kernel.org>,
	Michal Hocko <mhocko@kernel.org>,
	Qi Zheng <zhengqi.arch@bytedance.com>,
	Shakeel Butt <shakeel.butt@linux.dev>,
	Lorenzo Stoakes <ljs@kernel.org>,
	Kairui Song <kasong@tencent.com>,
	Axel Rasmussen <axelrasmussen@google.com>,
	Yuanchu Xie <yuanchu@google.com>, Wei Xu <weixugc@google.com>,
	Wang Lian <wanglian@kylinos.cn>, Kunwu Chan <chentao@kylinos.cn>,
	liz2nku@gmail.com, xueyuan.chen21@gmail.com
Subject: Re: [RFC PATCH v2] mm: Improve pgdat_balanced() to avoid over-reclamation for higher-order allocation
Date: Tue, 15 Sep 2026 10:50:12 +0800	[thread overview]
Message-ID: <20260915025022.2061-1-lianux.mm@gmail.com> (raw)
In-Reply-To: <1abcc4cf-fc84-4dcc-947f-8733df44e625@linux.alibaba.com>

From: "Lian Wang (ProcessMission)" <lianux.mm@gmail.com>

Hi Baolin,

Thanks, this gives us a concrete server-side reproducer. We can set up the
fragmented-memory test with one workload requesting THP and another periodically
accessing file folios through fio. We will keep free memory sufficient for
order-0 allocations so that the test isolates fragmentation-driven reclaim,
then measure fio latency and throughput together with kswapd reclaim, kcompactd
activity, direct reclaim/compaction, and THP allocation success.

We previously reproduced the kswapd CPU and reclaim behavior that motivated
Barry's proposal, but we have not yet measured the benefit or possible
regressions of the patch itself. As Johannes pointed out earlier, limiting
high-order reclaim too aggressively can regress sustained or concurrent huge
page requests by moving more work into direct reclaim and compaction. Therefore,
when testing Barry's patch, we would like to cover both the fio interference
case you described and concurrent higher-order allocation pressure.

Let's also wait for Johannes's thoughts, especially on whether bounding
`sc->nr_to_reclaim` should be combined with better accounting of outstanding
higher-order demand. In parallel, we can align the test matrix around:

  - best-effort order-3 network allocations with immediate order-0 fallback
    on phones;
  - order-3 scarcity with sufficient free memory and repeated kswapd wakeups
    on PCs and VMs;
  - fragmented THP allocations competing with file-folio I/O on servers.

We can run the baseline and Barry's patch with the same reclaim, compaction,
allocation-success, CPU, and workload-latency measurements. This should help us
unify the design discussion and avoid optimizing the phone, PC, or server case
at the expense of the others.

Thanks,
Lian

On Tue, 15 Sep 2026 10:30:50 +0800 Baolin Wang <baolin.wang@linux.alibaba.com> wrote:

> In such fragmentation scenarios, I don't think we should reclaim a large
> number of file folios, instead we should wake up kcompactd to perform
> defragmentation. So in theory, I prefer Barry's earlier proposal to
> adjust 'sc->nr_to_reclaim' [2]. But let's see what Johannes thinks.
>
> Based on our problem, I think we can setup a simple test scenario: one
> workload tries to allocate THP under fragmentation (and free memory was
> sufficient now), while another fio workload accesses file folios
> periodically. In this scenario, kswapd's reclaim should not affect the
> fio workload's performance.
>
> [2]
> https://lore.kernel.org/all/CAGsJ_4x9vkv2G7d-gANf8kqUJVxQh_P9=AJxr98LFUgQeOTqow@mail.gmail.com/

      reply	other threads:[~2026-09-15  2:50 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-04-22  2:18 Barry Song (Xiaomi)
2026-04-22  6:58 ` Baolin Wang
2026-04-22 10:56   ` Barry Song
2026-04-22 15:47 ` Johannes Weiner
2026-04-22 21:19   ` Barry Song
2026-09-14 11:33   ` Lian Wang
2026-09-15  2:30     ` Baolin Wang
2026-09-15  2:50       ` Lian Wang [this message]

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=20260915025022.2061-1-lianux.mm@gmail.com \
    --to=lianux.mm@gmail.com \
    --cc=akpm@linux-foundation.org \
    --cc=axelrasmussen@google.com \
    --cc=baohua@kernel.org \
    --cc=baolin.wang@linux.alibaba.com \
    --cc=chentao@kylinos.cn \
    --cc=david@kernel.org \
    --cc=hannes@cmpxchg.org \
    --cc=kasong@tencent.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mm@kvack.org \
    --cc=liz2nku@gmail.com \
    --cc=ljs@kernel.org \
    --cc=mhocko@kernel.org \
    --cc=shakeel.butt@linux.dev \
    --cc=wanglian@kylinos.cn \
    --cc=weixugc@google.com \
    --cc=xueyuan.chen21@gmail.com \
    --cc=yuanchu@google.com \
    --cc=zhengqi.arch@bytedance.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®