public inbox for cgroups@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH v3 0/3] sched, cgroup/cpuset: Keep user set cpus affinity
@ 2022-08-12 20:39 Waiman Long
       [not found] ` <20220812203929.364341-1-longman-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>
  2022-08-12 20:39 ` [PATCH v3 3/3] cgroup/cpuset: Keep user set cpus affinity Waiman Long
  0 siblings, 2 replies; 10+ messages in thread
From: Waiman Long @ 2022-08-12 20:39 UTC (permalink / raw)
  To: Ingo Molnar, Peter Zijlstra, Juri Lelli, Vincent Guittot,
	Dietmar Eggemann, Steven Rostedt, Ben Segall, Mel Gorman,
	Daniel Bristot de Oliveira, Valentin Schneider, Tejun Heo,
	Zefan Li, Johannes Weiner, Will Deacon
  Cc: cgroups-u79uwXL29TY76Z2rM5mHXA,
	linux-kernel-u79uwXL29TY76Z2rM5mHXA, Linus Torvalds, Waiman Long

v3:
 - Attach a new patch 2 to introduce a copy_user_cpus_mask() to copy
   out user masks with lock protection & use it in patch 3.
v2:
 - Rework the v1 patch by extending the semantics of user_cpus_ptr to
   store user set cpus affinity and keeping to it as much as possible.

The user_cpus_ptr field is added by commit b90ca8badbd1 ("sched:
Introduce task_struct::user_cpus_ptr to track requested affinity")
which uses it narrowly to allow keeping cpus affinity intact with
asymmetric cpu setup.

This patchset extends user_cpus_ptr to store user set cpus affinity via
sched_setaffinity() API. With that information avaiable, it will enable
cpuset to keep cpus afinity as close to what the user wants as possible
within the cpu list constraint of the current cpuset. Otherwise some
change to the cpuset hierarchy may reset the cpumask of the tasks in
the affected cpusets to the default cpuset value even if those tasks
have cpus affinity explicitly set by the users before.

It also means that once sched_setaffinity() is called, user_cpus_ptr
will remain allocated until the task exits.

Waiman Long (3):
  sched: Use user_cpus_ptr for saving user provided cpumask in
    sched_setaffinity()
  sched: Provide copy_user_cpus_mask() to copy out user mask
  cgroup/cpuset: Keep user set cpus affinity

 include/linux/sched.h  |  2 +
 kernel/cgroup/cpuset.c | 28 ++++++++++++-
 kernel/sched/core.c    | 89 ++++++++++++++++++++++++++++++++----------
 kernel/sched/sched.h   |  1 -
 4 files changed, 97 insertions(+), 23 deletions(-)

-- 
2.31.1


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

end of thread, other threads:[~2022-08-15 15:23 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2022-08-12 20:39 [PATCH v3 0/3] sched, cgroup/cpuset: Keep user set cpus affinity Waiman Long
     [not found] ` <20220812203929.364341-1-longman-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>
2022-08-12 20:39   ` [PATCH v3 1/3] sched: Use user_cpus_ptr for saving user provided cpumask in sched_setaffinity() Waiman Long
     [not found]     ` <20220812203929.364341-2-longman-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>
2022-08-15  8:57       ` Peter Zijlstra
     [not found]         ` <YvoKa3tbOaszsp1y-IIpfhp3q70z/8w/KjCw3T+5/BudmfyzbbVWyRVo5IupeoWH0uzbU5w@public.gmane.org>
2022-08-15 13:52           ` Waiman Long
     [not found]             ` <401bae73-3063-e0ab-c288-2c6e3be75fc5-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>
2022-08-15 14:25               ` Peter Zijlstra
2022-08-15 15:23                 ` Waiman Long
2022-08-12 20:39   ` [PATCH v3 2/3] sched: Provide copy_user_cpus_mask() to copy out user mask Waiman Long
     [not found]     ` <20220812203929.364341-3-longman-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>
2022-08-15  8:58       ` Peter Zijlstra
     [not found]         ` <YvoKy6OdJIkNXbtq-IIpfhp3q70z/8w/KjCw3T+5/BudmfyzbbVWyRVo5IupeoWH0uzbU5w@public.gmane.org>
2022-08-15 13:37           ` Waiman Long
2022-08-12 20:39 ` [PATCH v3 3/3] cgroup/cpuset: Keep user set cpus affinity Waiman Long

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