From: Baolin Wang <baolin.wang@linux.alibaba.com>
To: Hui Zhu <hui.zhu@linux.dev>,
Andrew Morton <akpm@linux-foundation.org>,
Johannes Weiner <hannes@cmpxchg.org>,
David Hildenbrand <david@kernel.org>,
Michal Hocko <mhocko@kernel.org>, Qi Zheng <qi.zheng@linux.dev>,
Shakeel Butt <shakeel.butt@linux.dev>,
Lorenzo Stoakes <ljs@kernel.org>,
Kairui Song <kasong@tencent.com>, Barry Song <baohua@kernel.org>,
Axel Rasmussen <axelrasmussen@google.com>,
Yuanchu Xie <yuanchu@google.com>, Wei Xu <weixugc@google.com>,
Baoquan He <baoquan.he@linux.dev>,
linux-mm@kvack.org, linux-kernel@vger.kernel.org
Cc: Hui Zhu <zhuhui@kylinos.cn>
Subject: Re: [PATCH v3] mm/mglru: use a smaller batch in fill/drain_evictable()
Date: Mon, 16 Nov 2026 15:29:24 +0800 [thread overview]
Message-ID: <b6449fe5-a697-4fa4-8985-fff2e0b0ed76@linux.alibaba.com> (raw)
In-Reply-To: <20261116061158.333826-1-hui.zhu@linux.dev>
On 11/16/26 2:11 PM, Hui Zhu wrote:
> From: Hui Zhu <zhuhui@kylinos.cn>
>
> lru_gen_change_state() migrates folios in batches of up to
> MAX_LRU_BATCH (4096) folios under lruvec_lock_irq(). A full batch
> keeps local interrupts off for up to about a millisecond, and CPUs
> contending for the same lru_lock spin with interrupts disabled for
> that long.
>
> The caller already drops the lock and reschedules between batches,
> and the restart protocol does not depend on the batch size: both
> functions make monotone progress, so a smaller batch only shortens
> the irq-off section. Use MIN_LRU_BATCH (64) instead, bounding it to
> about 15us. This is a cold path that runs once per kill-switch
> toggle; the extra unlock/resched/relock round trips cost a few
> percent of wall time on an otherwise idle machine.
>
> Same change as commit 6e9be217a3ce ("mm/mglru: use a smaller batch
> for reclaim") made for try_to_shrink_lruvec().
>
> Signed-off-by: Hui Zhu <zhuhui@kylinos.cn>
> ---
I'm fine if the small change can fix your issue in this cold path. Let's
also see others' input. Feel free to add:
Reviewed-by: Baolin Wang <baolin.wang@linux.alibaba.com>
next prev parent reply other threads:[~2026-11-16 7:29 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-11-16 6:11 Hui Zhu
2026-11-16 7:29 ` Baolin Wang [this message]
2026-11-16 7:47 ` Barry Song
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=b6449fe5-a697-4fa4-8985-fff2e0b0ed76@linux.alibaba.com \
--to=baolin.wang@linux.alibaba.com \
--cc=akpm@linux-foundation.org \
--cc=axelrasmussen@google.com \
--cc=baohua@kernel.org \
--cc=baoquan.he@linux.dev \
--cc=david@kernel.org \
--cc=hannes@cmpxchg.org \
--cc=hui.zhu@linux.dev \
--cc=kasong@tencent.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mm@kvack.org \
--cc=ljs@kernel.org \
--cc=mhocko@kernel.org \
--cc=qi.zheng@linux.dev \
--cc=shakeel.butt@linux.dev \
--cc=weixugc@google.com \
--cc=yuanchu@google.com \
--cc=zhuhui@kylinos.cn \
/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®