The Linux Kernel Mailing List
 help / color / mirror / Atom feed
* [PATCH v2] cgroup/cpuset: skip hardwall ancestor scan in cpuset v2 in cpuset_current_node_allowed()
@ 2026-05-11  8:18 Wandun Chen
  2026-05-11  8:55 ` Tejun Heo
  0 siblings, 1 reply; 2+ messages in thread
From: Wandun Chen @ 2026-05-11  8:18 UTC (permalink / raw)
  To: longman, chenridong, tj, hannes, mkoutny; +Cc: cgroups, linux-kernel

From: Chen Wandun <chenwandun@lixiang.com>

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>

---
v1 --> v2:
use cpuset_v2 instead of is_in_v2_mode, suggested by Tejun.
---
 kernel/cgroup/cpuset.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/kernel/cgroup/cpuset.c b/kernel/cgroup/cpuset.c
index a48901a0416a..cbd9e7fc800e 100644
--- a/kernel/cgroup/cpuset.c
+++ b/kernel/cgroup/cpuset.c
@@ -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);
 
-- 
2.43.0


^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH v2] cgroup/cpuset: skip hardwall ancestor scan in cpuset v2 in cpuset_current_node_allowed()
  2026-05-11  8:18 [PATCH v2] cgroup/cpuset: skip hardwall ancestor scan in cpuset v2 in cpuset_current_node_allowed() Wandun Chen
@ 2026-05-11  8:55 ` Tejun Heo
  0 siblings, 0 replies; 2+ messages in thread
From: Tejun Heo @ 2026-05-11  8:55 UTC (permalink / raw)
  To: Chen Wandun, Wandun Chen
  Cc: longman, chenridong, hannes, mkoutny, cgroups, linux-kernel

Hello,

Applied to cgroup/for-7.2 after back-merging for-7.1-fixes to pick up
dde2f938d02f ("cgroup/cpuset: move PF_EXITING check before
__GFP_HARDWALL in cpuset_current_node_allowed()"), which was needed
as a dependency.

Thanks.

--
tejun

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2026-05-11  8:55 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-05-11  8:18 [PATCH v2] cgroup/cpuset: skip hardwall ancestor scan in cpuset v2 in cpuset_current_node_allowed() Wandun Chen
2026-05-11  8:55 ` Tejun Heo

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox