[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <562a3b0db8bed7a1f13c3e1b8ccc846181226b5b@linux.dev>
Date: Mon, 19 Jan 2026 03:04:16 +0000
From: "Jiayuan Chen" <jiayuan.chen@...ux.dev>
To: "Johannes Weiner" <hannes@...xchg.org>
Cc: linux-mm@...ck.org, shakeel.butt@...ux.dev, "Jiayuan Chen"
<jiayuan.chen@...pee.com>, "Andrew Morton" <akpm@...ux-foundation.org>,
"David Hildenbrand" <david@...nel.org>, "Lorenzo Stoakes"
<lorenzo.stoakes@...cle.com>, "Liam R. Howlett"
<Liam.Howlett@...cle.com>, "Vlastimil Babka" <vbabka@...e.cz>, "Mike
Rapoport" <rppt@...nel.org>, "Suren Baghdasaryan" <surenb@...gle.com>,
"Michal Hocko" <mhocko@...e.com>, "Axel Rasmussen"
<axelrasmussen@...gle.com>, "Yuanchu Xie" <yuanchu@...gle.com>, "Wei Xu"
<weixugc@...gle.com>, "Steven Rostedt" <rostedt@...dmis.org>, "Masami
Hiramatsu" <mhiramat@...nel.org>, "Mathieu Desnoyers"
<mathieu.desnoyers@...icios.com>, "Brendan Jackman"
<jackmanb@...gle.com>, "Zi Yan" <ziy@...dia.com>, "Qi Zheng"
<zhengqi.arch@...edance.com>, linux-kernel@...r.kernel.org,
linux-trace-kernel@...r.kernel.org
Subject: Re: [PATCH v3 1/2] mm/vmscan: mitigate spurious kswapd_failures
reset from direct reclaim
2026/1/17 01:00, "Johannes Weiner" <hannes@...xchg.org mailto:hannes@...xchg.org?to=%22Johannes%20Weiner%22%20%3Channes%40cmpxchg.org%3E > wrote:
[...]
> >
> Great analysis, and I agree with both the fix and adding tracepoints.
>
> Two minor nits:
>
> >
> > @@ -2650,6 +2650,25 @@ static bool can_age_anon_pages(struct lruvec *lruvec,
> > lruvec_memcg(lruvec));
> > }
> >
> > +static void pgdat_reset_kswapd_failures(pg_data_t *pgdat)
> > +{
> > + atomic_set(&pgdat->kswapd_failures, 0);
> > +/*
> > + * Reset kswapd_failures only when the node is balanced. Without this
> > + * check, successful direct reclaim (e.g., from cgroup memory.high
> > + * throttling) can keep resetting kswapd_failures even when the node
> > + * cannot be balanced, causing kswapd to run endlessly.
> > + */
> > +static bool pgdat_balanced(pg_data_t *pgdat, int order, int highest_zoneidx);
> > +static inline void pgdat_try_reset_kswapd_failures(struct pglist_data *pgdat,
> >
> Please remove the inline, the compiler will figure it out.
>
> >
> > + struct scan_control *sc)
> > +{
> > + if (pgdat_balanced(pgdat, sc->order, sc->reclaim_idx))
> > + pgdat_reset_kswapd_failures(pgdat);
> > +}
> >
> As this is kswapd API, please move these down to after wakeup_kswapd().
>
> I think we can streamline the names a bit. We already use "hopeless"
> for that state in the comments; can you please rename the functions
> kswapd_clear_hopeless() and kswapd_try_clear_hopeless()?
>
> We should then also replace the open-coded kswapd_failure checks with
> kswapd_test_hopeless(). But I can send a follow-up patch if you don't
> want to, just let me know.
>
Thanks, Johannes and Shakeel. I'll send an updated version with these fixes.
Powered by blists - more mailing lists