Skip to content

cgroup: replace global percpu_rwsem with per threadgroup resem when writing to cgroup.procs

Yi Tao cgroups lkml oe-kbuild-all 3 versions – Applied

Status from this message: Applied to cgroup/for-6.18. There was a conflict that I resolved. Please

Get series with b4
b4 am [email protected]

Versions newest first · linked by author and title

  1. v5 Latest3 patches 5 repliesApplied
  2. v43 patches 2 repliesSuperseded
  3. v31 patch 2 repliesSuperseded

Changes in v5 from the cover letter

- Adjust the order of patches.
- Add the type name for enum used by cgroup_attach_lock.

Patches in v5 Applied

#Subject and filesSizeRepliesApplied
1/3cgroup: refactor the cgroup_attach_lock code to make it clearerinclude/linux/cgroup-defs.h kernel/cgroup/cgroup-internal.h kernel/cgroup/cgroup-v1.c +1 more+69 -291 reply
2/3cgroup: relocate cgroup_attach_lock within cgroup_procs_write_startkernel/cgroup/cgroup.c+38 -232 replies
3/3cgroup: replace global percpu_rwsem with per threadgroup resem when writing to cgroup.procsinclude/linux/cgroup-defs.h include/linux/sched/signal.h init/init_task.c +4 more+87 -222 replies

Reviews trailers per patch

No Reviewed-by, Acked-by or Tested-by trailers for v5 yet.

Read the v5 thread

Cover letter [PATCH v5 0/3] cgroup: replace global percpu_rwsem with per threadgroup resem when writing to cgroup.procs

Changes in v5:
- Adjust the order of patches.
- Add the type name for enum used by cgroup_attach_lock.

Changes in v4:
- Adjust commit log and comments.
- Rename take_per_threadgroup_rwsem to cgroup_enable_per_threadgroup_rwsem and add attr __read_mostly.
- Trigger a warning that per_threadgroup opreation can't be disabled once enabled instead of actually turning it off.
- Split the code for retrying when the threadgroup leader changes into a separate patch.
- Refactor the cgroup_attach_lock code to make it clearer.

Changes in v3:
- Expend commit log and comments.
- Put argument @tsk at end in cgroup_attach_lock/unlock.
- down_write global cgroup_thread_rwsem when flipping favordynmods to synchronize with task between cgroup_threadgroup_change_begin and end.
- Rename group_rwsem to cgroup_threadgroup_rwsem.
- Fix bug causing abnormal cgroup migration due to threadgroup leader changes。

Changes in v2:
- Use favordynmods as the enabling switch.
- Determine whether to use the per-thread-group rwsem based on whether the task is NULL.
- Fix system hang caused by acquiring cgroup_threadgroup_rwsem inside rcu_read_lock.

Yi Tao (3):
cgroup: refactor the cgroup_attach_lock code to make it clearer
cgroup: relocate cgroup_attach_lock within cgroup_procs_write_start
cgroup: replace global percpu_rwsem with per threadgroup resem when
writing to cgroup.procs

 include/linux/cgroup-defs.h     |  25 +++++-
 include/linux/sched/signal.h    |   4 +
 init/init_task.c                |   3 +
 kernel/cgroup/cgroup-internal.h |  11 ++-
 kernel/cgroup/cgroup-v1.c       |  14 +--
 kernel/cgroup/cgroup.c          | 153 ++++++++++++++++++++++++--------
 kernel/fork.c                   |   4 +
 7 files changed, 167 insertions(+), 47 deletions(-)
Signature · 1 line
2.32.0.3.g01195cf9f