All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH v5 0/3] sched, cgroup/cpuset: Keep user set cpus affinity
@ 2022-08-16 19:27 ` Waiman Long
  0 siblings, 0 replies; 25+ messages in thread
From: Waiman Long @ 2022-08-16 19:27 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

v5:
 - Update patch 3 to handle race with concurrent sched_setaffinity()
   by rechecking a previously cleared user_cpus_ptr afterward.

v4:
 - Update patch 1 to make sched_setaffinity() the only function to
   update user_cpus_ptr to make the logic simpler and
   easier to understand. restrict_cpus_allowed_ptr() and
   relax_compatible_cpus_allowed_ptr() will just use it if present.

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 available, 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  |   1 +
 kernel/cgroup/cpuset.c |  42 ++++++++++++++-
 kernel/sched/core.c    | 119 ++++++++++++++++++++++++-----------------
 kernel/sched/sched.h   |   1 -
 4 files changed, 112 insertions(+), 51 deletions(-)

-- 
2.31.1


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

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

Thread overview: 25+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2022-08-16 19:27 [PATCH v5 0/3] sched, cgroup/cpuset: Keep user set cpus affinity Waiman Long
2022-08-16 19:27 ` Waiman Long
     [not found] ` <20220816192734.67115-1-longman-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>
2022-08-16 19:27   ` [PATCH v5 1/3] sched: Use user_cpus_ptr for saving user provided cpumask in sched_setaffinity() Waiman Long
2022-08-16 19:27     ` Waiman Long
2022-08-17  8:41     ` Peter Zijlstra
     [not found]       ` <Yvyp02LLIQQPs5d6-IIpfhp3q70z/8w/KjCw3T+5/BudmfyzbbVWyRVo5IupeoWH0uzbU5w@public.gmane.org>
2022-08-18 15:31         ` Waiman Long
2022-08-18 15:31           ` Waiman Long
     [not found]     ` <20220816192734.67115-2-longman-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>
2022-08-17  8:28       ` Peter Zijlstra
2022-08-17  8:28         ` Peter Zijlstra
     [not found]         ` <YvymwlTkdsVDtmRB-IIpfhp3q70z/8w/KjCw3T+5/BudmfyzbbVWyRVo5IupeoWH0uzbU5w@public.gmane.org>
2022-08-18 14:37           ` Waiman Long
2022-08-18 14:37             ` Waiman Long
2022-08-17  8:46       ` Peter Zijlstra
2022-08-17  8:46         ` Peter Zijlstra
2022-08-16 19:27   ` [PATCH v5 2/3] sched: Provide copy_user_cpus_mask() to copy out user mask Waiman Long
2022-08-16 19:27     ` Waiman Long
2022-08-16 19:27   ` [PATCH v5 3/3] cgroup/cpuset: Keep user set cpus affinity Waiman Long
2022-08-16 19:27     ` Waiman Long
     [not found]     ` <20220816192734.67115-4-longman-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>
2022-08-16 20:15       ` Tejun Heo
2022-08-16 20:15         ` Tejun Heo
     [not found]         ` <Yvv66EWygCwHUCqy-NiLfg/pYEd1N0TnZuCh8vA@public.gmane.org>
2022-08-16 22:11           ` Waiman Long
2022-08-16 22:11             ` Waiman Long
     [not found]             ` <c10e4f69-9951-6c38-6e28-fafcaec00d89-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>
2022-08-16 22:19               ` Tejun Heo
2022-08-16 22:19                 ` Tejun Heo
     [not found]                 ` <YvwX24GXadKQNp6V-NiLfg/pYEd1N0TnZuCh8vA@public.gmane.org>
2022-08-17  0:13                   ` Waiman Long
2022-08-17  0:13                     ` Waiman Long

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.