[RHEL7,COMMIT] cpuset/mems: don't propagate changes to empty descendant cgroups

Submitted by Konstantin Khorenko on May 31, 2018, 4:13 p.m.

Details

Message ID 201805311613.w4VGDm9W015545@finist_ce7.work
State New
Headers show

Patch hide | download patch | download mbox

diff --git a/kernel/cpuset.c b/kernel/cpuset.c
index c3c7859a049c..b7338d4a2eca 100644
--- a/kernel/cpuset.c
+++ b/kernel/cpuset.c
@@ -1314,8 +1314,13 @@  static void update_nodemasks_hier(struct cpuset *cs, nodemask_t *new_mems,
 		if (nodes_empty(*new_mems))
 			*new_mems = parent->effective_mems;
 
-		/* skip the whole subtree if @cp have some CPU */
-		if (!nodes_empty(cp->mems_allowed)) {
+		/*
+		 * If current mems_allowed are empty - no tasks are there and
+		 * userspace have to configure cpuset::mems explicitely before
+		 * attaching tasks to this cgroup, so skip further settings
+		 * propagation.
+		 */
+		if (nodes_empty(cp->mems_allowed)) {
 			pos_cgrp = cgroup_rightmost_descendant(pos_cgrp);
 			continue;
 		}