On Thu, May 07, 2026 at 06:54:34PM +0800, Chen Wandun wrote: > This makes it unreachable in the common case, so dying tasks can get > stuck in direct reclaim or even trigger OOM while trying to exit, > despite being allowed to allocate from any node. (OTOH, the caused OOM could select this task and bypass the hardwall. So this should only expedite but no unblock the exit path.) > Move the PF_EXITING check before __GFP_HARDWALL so that dying tasks > can allocate memory from any node to exit quickly, even when cpusets > are enabled. This makes sense to me on its own (given other hardwall exemptions, namely the commit c596d9f320aaf ("cpusets: allow TIF_MEMDIE threads to allocate anywhere")). Acked-by: Michal Koutný At first, I wondered whether this could happen on cpuset v2 -- it can -- because only per-cpuset hardwalling is absent but the generic logic for GFP_USER allocations is still meant to be in place. Nevertheless, it occured to me we can spare callback_lock in this function (a separate chaneg for cpuset_current_node_allowed()): --- a/kernel/cgroup/cpuset.c +++ b/kernel/cgroup/cpuset.c @@ -4213,6 +4213,9 @@ bool cpuset_current_node_allowed(int node, gfp_t gfp_mask) if (current->flags & PF_EXITING) /* Let dying task have memory */ return true; + if (is_in_v2_mode()) + return true; + /* Not hardwall and node outside mems_allowed: scan up cpusets */ spin_lock_irqsave(&callback_lock, flags); Regards, Michal