Skip to contentSkip to conversation

cgroup/cpuset: skip hardwall ancestor scan in cpuset v2 in cpuset_current_node_allowed()

PATCH In review Wandun Chen 2 participants 2 messages May 11

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH v2 1/1 cgroup/cpuset: skip hardwall ancestor scan in cpuset v2 in cpuset_current_node_allowed()

From: Chen Wandun <[email protected]>

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.

---
v1 --> v2:
use cpuset_v2 instead of is_in_v2_mode, suggested by Tejun.

---
 kernel/cgroup/cpuset.c | 3 +++
 1 file changed, 3 insertions(+)
kernel/cgroup/cpuset.c +3 -0
index a48901a0416a..cbd9e7fc800e 100644
@@ -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);
 
Signature · 1 line
2.43.0
maintainer
#1 lore raw

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