Re: [PATCH] mm/page_alloc: let the highest memory node recover from hopeless state

From: Gregory Price

Date: Mon Oct 19 2026 - 16:22:16 EST


On Mon, Oct 19, 2026 at 03:51:27PM -0400, Zi Yan wrote:
> On Mon Oct 19, 2026 at 2:48 PM EDT, Gregory Price (Meta) wrote:
> > if (kswapd_test_hopeless(pgdat) &&
> > - next_memory_node(pgdat->node_id) < MAX_NUMNODES)
> > + num_node_state(N_MEMORY) > 1)
>
> Why does a runtime behavior, clearing kswapd hopeless state, depend on a
> static memory topology (excluding memory hotadd/hotremove in this
> context)? There is nothing telling us if a fallback node has available memory.
>
> Just reset it regardless. kswapd can go hopeless later if the node
> cannot be reclaimed.
>

I mostly agree, but this was more of behavioral change than i was
outright willing to commit to in a stable backport.

I can send a follow up commit to drop the check altogether if you
prefer - but I'm not sure we want to drop it outright in the backport.

> BTW, LLM also points out that kswapd_try_clear_hopeless(), called by
> direct reclaim, only clears hopeless when the node is balanced, but that
> rarely happens. So hopeless state can stay much longer if there is only
> one node. Adding Jiayuna, who added kswapd_try_clear_hopeless(), to gvie
> some insight.
>

Yeah I have some additional things in my pile on the hopeless flag, but
i haven't gotten around to them.

~Gregory