public inbox for [email protected]
 help / color / mirror / Atom feed
From: Waiman Long <[email protected]>
To: Tejun Heo <[email protected]>, Zefan Li <[email protected]>,
	Johannes Weiner <[email protected]>,
	Jonathan Corbet <[email protected]>, Shuah Khan <[email protected]>
Cc: [email protected], [email protected],
	[email protected], [email protected],
	"Andrew Morton" <[email protected]>,
	"Roman Gushchin" <[email protected]>, "Phil Auld" <[email protected]>,
	"Peter Zijlstra" <[email protected]>,
	"Juri Lelli" <[email protected]>,
	"Frederic Weisbecker" <[email protected]>,
	"Marcelo Tosatti" <[email protected]>,
	"Michal Koutný" <[email protected]>,
	"Waiman Long" <[email protected]>
Subject: [PATCH v10 1/8] cgroup/cpuset: Add top_cpuset check in update_tasks_cpumask()
Date: Tue,  3 May 2022 12:21:42 -0400	[thread overview]
Message-ID: <[email protected]> (raw)
In-Reply-To: <[email protected]>

Right now, update_tasks_cpumask() is not supposed to be called with top
cpuset.  With cpuset partition that takes CPUs away from the top cpuset,
we may want to consider adjusting the cpu_allows mask of the tasks in
the top cpuset as well. However, we need more investigation to figure
out a way to do that without breaking non-cgroup aware applications in
the top cpuset. So move the top_cpuset check into update_tasks_cpumask()
and add a comment about possible future work.

Signed-off-by: Waiman Long <[email protected]>
---
 kernel/cgroup/cpuset.c | 15 +++++++++------
 1 file changed, 9 insertions(+), 6 deletions(-)

diff --git a/kernel/cgroup/cpuset.c b/kernel/cgroup/cpuset.c
index 9390bfd9f1cd..d90f33b068a3 100644
--- a/kernel/cgroup/cpuset.c
+++ b/kernel/cgroup/cpuset.c
@@ -1128,6 +1128,14 @@ static void update_tasks_cpumask(struct cpuset *cs)
 	struct css_task_iter it;
 	struct task_struct *task;
 
+	/*
+	 * TODO: With cpuset partition that takes CPUs away from the top
+	 * cpuset, we may want to properly adjust the cpus_allowed mask of
+	 * tasks in the top cpuset as well.
+	 */
+	if (cs == &top_cpuset)
+		return;
+
 	css_task_iter_start(&cs->css, 0, &it);
 	while ((task = css_task_iter_next(&it)))
 		set_cpus_allowed_ptr(task, cs->effective_cpus);
@@ -2092,12 +2100,7 @@ static int update_prstate(struct cpuset *cs, int new_prs)
 		update_flag(CS_CPU_EXCLUSIVE, cs, 0);
 	}
 
-	/*
-	 * Update cpumask of parent's tasks except when it is the top
-	 * cpuset as some system daemons cannot be mapped to other CPUs.
-	 */
-	if (parent != &top_cpuset)
-		update_tasks_cpumask(parent);
+	update_tasks_cpumask(parent);
 
 	if (parent->child_ecpus_count)
 		update_sibling_cpumasks(parent, cs, &tmpmask);
-- 
2.27.0



  reply	other threads:[~2022-05-03 16:22 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-05-03 16:21 [PATCH v10 0/8] cgroup/cpuset: Major cpu partition code restructuring Waiman Long
2022-05-03 16:21 ` Waiman Long [this message]
2022-05-03 16:21 ` [PATCH v10 2/8] cgroup/cpuset: Miscellaneous cleanups & add helper functions Waiman Long
2022-05-03 16:21 ` [PATCH v10 3/8] cgroup/cpuset: Allow no-task partition to have empty cpuset.cpus.effective Waiman Long
2022-05-03 16:21 ` [PATCH v10 4/8] cgroup/cpuset: Relax constraints to partition & cpus changes Waiman Long
2022-05-03 16:21 ` [PATCH v10 5/8] cgroup/cpuset: Add a new isolated cpus.partition type Waiman Long
2022-05-03 16:21 ` [PATCH v10 6/8] cgroup/cpuset: Show invalid partition reason string Waiman Long
2022-05-03 16:21 ` [PATCH v10 7/8] cgroup/cpuset: Update description of cpuset.cpus.partition in cgroup-v2.rst Waiman Long
2022-05-03 16:21 ` [PATCH v10 8/8] kselftest/cgroup: Add cpuset v2 partition root state test Waiman Long

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    [email protected] \
    [email protected] \
    [email protected] \
    [email protected] \
    [email protected] \
    [email protected] \
    [email protected] \
    [email protected] \
    [email protected] \
    [email protected] \
    [email protected] \
    [email protected] \
    [email protected] \
    [email protected] \
    [email protected] \
    [email protected] \
    [email protected] \
    [email protected] \
    [email protected] \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox