From: Waiman Long <longman@redhat.com> To: Tejun Heo <tj@kernel.org>, Zefan Li <lizefan.x@bytedance.com>, Johannes Weiner <hannes@cmpxchg.org>, Jonathan Corbet <corbet@lwn.net>, Shuah Khan <shuah@kernel.org> Cc: cgroups@vger.kernel.org, linux-kernel@vger.kernel.org, linux-doc@vger.kernel.org, linux-kselftest@vger.kernel.org, "Andrew Morton" <akpm@linux-foundation.org>, "Roman Gushchin" <guro@fb.com>, "Phil Auld" <pauld@redhat.com>, "Peter Zijlstra" <peterz@infradead.org>, "Juri Lelli" <juri.lelli@redhat.com>, "Frederic Weisbecker" <frederic@kernel.org>, "Marcelo Tosatti" <mtosatti@redhat.com>, "Michal Koutný" <mkoutny@suse.com>, "Waiman Long" <longman@redhat.com> Subject: [PATCH v11 1/8] cgroup/cpuset: Add top_cpuset check in update_tasks_cpumask() Date: Tue, 10 May 2022 11:34:06 -0400 [thread overview] Message-ID: <20220510153413.400020-2-longman@redhat.com> (raw) In-Reply-To: <20220510153413.400020-1-longman@redhat.com> 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 <longman@redhat.com> --- 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
WARNING: multiple messages have this Message-ID (diff)
From: Waiman Long <longman-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org> To: Tejun Heo <tj-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org>, Zefan Li <lizefan.x-EC8Uxl6Npydl57MIdRCFDg@public.gmane.org>, Johannes Weiner <hannes-druUgvl0LCNAfugRpC6u6w@public.gmane.org>, Jonathan Corbet <corbet-T1hC0tSOHrs@public.gmane.org>, Shuah Khan <shuah-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org> Cc: cgroups-u79uwXL29TY76Z2rM5mHXA@public.gmane.org, linux-kernel-u79uwXL29TY76Z2rM5mHXA@public.gmane.org, linux-doc-u79uwXL29TY76Z2rM5mHXA@public.gmane.org, linux-kselftest-u79uwXL29TY76Z2rM5mHXA@public.gmane.org, "Andrew Morton" <akpm-de/tnXTf+JLsfHDXvbKv3WD2FQJk+8+b@public.gmane.org>, "Roman Gushchin" <guro-b10kYP2dOMg@public.gmane.org>, "Phil Auld" <pauld-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>, "Peter Zijlstra" <peterz-wEGCiKHe2LqWVfeAwA7xHQ@public.gmane.org>, "Juri Lelli" <juri.lelli-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>, "Frederic Weisbecker" <frederic-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org>, "Marcelo Tosatti" <mtosatti-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>, "Michal Koutný" <mkoutny-IBi9RG/b67k@public.gmane.org>, "Waiman Long" <longman-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org> Subject: [PATCH v11 1/8] cgroup/cpuset: Add top_cpuset check in update_tasks_cpumask() Date: Tue, 10 May 2022 11:34:06 -0400 [thread overview] Message-ID: <20220510153413.400020-2-longman@redhat.com> (raw) In-Reply-To: <20220510153413.400020-1-longman-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org> 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 <longman-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org> --- 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
next prev parent reply other threads:[~2022-05-10 15:36 UTC|newest] Thread overview: 48+ messages / expand[flat|nested] mbox.gz Atom feed top 2022-05-10 15:34 [PATCH v11 0/8] cgroup/cpuset: cpu partition code enhancements Waiman Long 2022-05-10 15:34 ` Waiman Long [this message] 2022-05-10 15:34 ` [PATCH v11 1/8] cgroup/cpuset: Add top_cpuset check in update_tasks_cpumask() Waiman Long 2022-05-10 15:34 ` [PATCH v11 2/8] cgroup/cpuset: Miscellaneous cleanups & add helper functions Waiman Long 2022-05-10 15:34 ` [PATCH v11 3/8] cgroup/cpuset: Allow no-task partition to have empty cpuset.cpus.effective Waiman Long 2022-06-12 17:40 ` Tejun Heo 2022-06-12 17:41 ` Tejun Heo 2022-06-13 2:53 ` Waiman Long 2022-06-13 2:55 ` Tejun Heo 2022-06-13 3:04 ` Waiman Long 2022-06-13 3:04 ` Waiman Long 2022-06-13 14:02 ` Michal Koutný 2022-06-13 14:02 ` Michal Koutný 2022-06-13 16:47 ` Waiman Long 2022-06-13 16:47 ` Waiman Long 2022-06-13 17:23 ` Tejun Heo 2022-06-13 2:50 ` Waiman Long 2022-05-10 15:34 ` [PATCH v11 4/8] cgroup/cpuset: Relax constraints to partition & cpus changes Waiman Long 2022-05-10 15:34 ` Waiman Long 2022-05-10 15:34 ` [PATCH v11 5/8] cgroup/cpuset: Add a new isolated cpus.partition type Waiman Long 2022-05-10 15:34 ` Waiman Long 2022-05-10 15:34 ` [PATCH v11 6/8] cgroup/cpuset: Show invalid partition reason string Waiman Long 2022-05-10 15:34 ` [PATCH v11 7/8] cgroup/cpuset: Update description of cpuset.cpus.partition in cgroup-v2.rst Waiman Long 2022-06-12 17:49 ` Tejun Heo 2022-06-13 3:02 ` Waiman Long 2022-06-13 3:12 ` Tejun Heo 2022-06-13 3:12 ` Tejun Heo 2022-06-13 13:18 ` Waiman Long 2022-06-13 17:06 ` Waiman Long 2022-06-13 14:24 ` Michal Koutný 2022-06-13 14:24 ` Michal Koutný 2022-06-13 17:28 ` Tejun Heo 2022-06-13 17:55 ` Michal Koutný 2022-06-13 18:00 ` Tejun Heo 2022-06-13 18:00 ` Tejun Heo 2022-06-14 11:53 ` Michal Koutný 2022-06-14 11:53 ` Michal Koutný 2022-06-27 19:10 ` Tejun Heo 2022-06-27 19:10 ` Tejun Heo 2022-06-30 14:32 ` Michal Koutný 2022-06-30 22:53 ` Tejun Heo 2022-05-10 15:34 ` [PATCH v11 8/8] kselftest/cgroup: Add cpuset v2 partition root state test Waiman Long 2022-05-21 10:24 ` Muhammad Usama Anjum 2022-05-21 10:24 ` Muhammad Usama Anjum 2022-05-22 2:40 ` Waiman Long 2022-05-20 16:00 ` [PATCH v11 0/8] cgroup/cpuset: cpu partition code enhancements Sebastian Andrzej Siewior 2022-05-20 16:46 ` Waiman Long 2022-05-24 16:48 ` Sebastian Andrzej Siewior
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 \ --in-reply-to=20220510153413.400020-2-longman@redhat.com \ --to=longman@redhat.com \ --cc=akpm@linux-foundation.org \ --cc=cgroups@vger.kernel.org \ --cc=corbet@lwn.net \ --cc=frederic@kernel.org \ --cc=guro@fb.com \ --cc=hannes@cmpxchg.org \ --cc=juri.lelli@redhat.com \ --cc=linux-doc@vger.kernel.org \ --cc=linux-kernel@vger.kernel.org \ --cc=linux-kselftest@vger.kernel.org \ --cc=lizefan.x@bytedance.com \ --cc=mkoutny@suse.com \ --cc=mtosatti@redhat.com \ --cc=pauld@redhat.com \ --cc=peterz@infradead.org \ --cc=shuah@kernel.org \ --cc=tj@kernel.org \ /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: linkBe sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes, see mirroring instructions on how to clone and mirror all data and code used by this external index.