]> git.ipfire.org Git - thirdparty/kernel/linux.git/commitdiff
cgroup/cpuset: Skip hardwall ancestor scan in cpuset v2 in cpuset_current_node_allowed()
authorChen Wandun <chenwandun@lixiang.com>
Mon, 11 May 2026 08:18:38 +0000 (16:18 +0800)
committerTejun Heo <tj@kernel.org>
Mon, 11 May 2026 08:53:30 +0000 (22:53 -1000)
Cgroup v2 doesn't have the concept of memory hardwall, only top_cpuset
has CS_MEM_EXCLUSIVE/CS_MEM_HARDWALL flags, nearest_hardwall_ancestor
always returns top_cpuset with all nodes set, so no need to acquire
callback_lock and scan up cpuset.

Suggested-by: Michal Koutný <mkoutny@suse.com>
Signed-off-by: Chen Wandun <chenwandun@lixiang.com>
Signed-off-by: Tejun Heo <tj@kernel.org>
kernel/cgroup/cpuset.c

index 3fbf6e7f68c311194b3e27db87928b2394a0c6bd..74d5c494d6aec16e9100e033ad5c00e9a10d0485 100644 (file)
@@ -4231,6 +4231,9 @@ bool cpuset_current_node_allowed(int node, gfp_t gfp_mask)
        if (gfp_mask & __GFP_HARDWALL)  /* If hardwall request, stop here */
                return false;
 
+       if (cpuset_v2())
+               return true;
+
        /* Not hardwall and node outside mems_allowed: scan up cpusets */
        spin_lock_irqsave(&callback_lock, flags);