All of lore.kernel.org
 help / color / mirror / Atom feed
From: Tejun Heo <tj@kernel.org>
To: lizefan@huawei.com
Cc: cgroups@vger.kernel.org, mingo@redhat.com, peterz@infradead.org,
	linux-kernel@vger.kernel.org
Subject: [PATCHSET] cgroup, sched: restructure threadgroup locking and replace it with a percpu_rwsem
Date: Wed, 13 May 2015 16:35:15 -0400	[thread overview]
Message-ID: <1431549318-16756-1-git-send-email-tj@kernel.org> (raw)

threadgroup locking was added because cgroup needs threadgroups to
stay stable across attach operations.  It was implemented as a
per-signal_struct generic locking mechanism so that other users which
require threadgroups stable across blocking operations can use it too;
however, it hasn't grown any other use cases and still conditionalized
on CONFIG_CGROUPS.

It turns out that a single percpu_rwsem would serve cgroup's use case
better as it's lighter on the thread operations and allows atomic
operations across multiple processes.  We can change the generic
threadgroup lock mechanism to do that but it's pointless to put this
in core task code.  What's necessary from the task code is a place
which subsystems needing synchronization against threadgroup
operations can hook into so that they can implement the necessary
exclusion.

This patchset moves the specific locking details into cgroup proper
leaving threadgroup_changes_begin/end() as the section markers and
then converts the cgroup specific locking to use a percp_rwsem.

This patchset contains the following three patches.

 0001-sched-cgroup-reorganize-threadgroup-locking.patch
 0002-sched-cgroup-replace-signal_struct-group_rwsem-with-.patch
 0003-cgroup-simplify-threadgroup-locking.patch

0001 moves threadgroup locking details into cgroup proper.

0002-0003 convert per-signal_struct group_rwsem with a global
percpu_rwsem.

This patchset is on top of

  cgroup/for-4.2 d0f702e648dc ("cgroup: fix some comment typos")
+ [1] [PATCH] cgroup: separate out include/linux/cgroup-defs.h
+ [2] [PATCH] cgroup: reorganize include/linux/cgroup.h

 git://git.kernel.org/pub/scm/linux/kernel/git/tj/cgroup.git review-threadgroup-percpu-rwsem

diffstat follows.  Thanks.

 include/linux/cgroup-defs.h |   33 ++++++++++++++++++++
 include/linux/init_task.h   |    8 ----
 include/linux/sched.h       |   65 ++++++++++------------------------------
 init/Kconfig                |    1
 kernel/cgroup.c             |   71 ++++++++++++++++----------------------------
 kernel/fork.c               |    4 --
 6 files changed, 78 insertions(+), 104 deletions(-)

--
tejun

[1] http://lkml.kernel.org/g/20150513193840.GC11388@htj.duckdns.org
[2] http://lkml.kernel.org/g/20150513202416.GE11388@htj.duckdns.org

WARNING: multiple messages have this Message-ID (diff)
From: Tejun Heo <tj-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org>
To: lizefan-hv44wF8Li93QT0dZR+AlfA@public.gmane.org
Cc: cgroups-u79uwXL29TY76Z2rM5mHXA@public.gmane.org,
	mingo-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org,
	peterz-wEGCiKHe2LqWVfeAwA7xHQ@public.gmane.org,
	linux-kernel-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
Subject: [PATCHSET] cgroup, sched: restructure threadgroup locking and replace it with a percpu_rwsem
Date: Wed, 13 May 2015 16:35:15 -0400	[thread overview]
Message-ID: <1431549318-16756-1-git-send-email-tj@kernel.org> (raw)

threadgroup locking was added because cgroup needs threadgroups to
stay stable across attach operations.  It was implemented as a
per-signal_struct generic locking mechanism so that other users which
require threadgroups stable across blocking operations can use it too;
however, it hasn't grown any other use cases and still conditionalized
on CONFIG_CGROUPS.

It turns out that a single percpu_rwsem would serve cgroup's use case
better as it's lighter on the thread operations and allows atomic
operations across multiple processes.  We can change the generic
threadgroup lock mechanism to do that but it's pointless to put this
in core task code.  What's necessary from the task code is a place
which subsystems needing synchronization against threadgroup
operations can hook into so that they can implement the necessary
exclusion.

This patchset moves the specific locking details into cgroup proper
leaving threadgroup_changes_begin/end() as the section markers and
then converts the cgroup specific locking to use a percp_rwsem.

This patchset contains the following three patches.

 0001-sched-cgroup-reorganize-threadgroup-locking.patch
 0002-sched-cgroup-replace-signal_struct-group_rwsem-with-.patch
 0003-cgroup-simplify-threadgroup-locking.patch

0001 moves threadgroup locking details into cgroup proper.

0002-0003 convert per-signal_struct group_rwsem with a global
percpu_rwsem.

This patchset is on top of

  cgroup/for-4.2 d0f702e648dc ("cgroup: fix some comment typos")
+ [1] [PATCH] cgroup: separate out include/linux/cgroup-defs.h
+ [2] [PATCH] cgroup: reorganize include/linux/cgroup.h

 git://git.kernel.org/pub/scm/linux/kernel/git/tj/cgroup.git review-threadgroup-percpu-rwsem

diffstat follows.  Thanks.

 include/linux/cgroup-defs.h |   33 ++++++++++++++++++++
 include/linux/init_task.h   |    8 ----
 include/linux/sched.h       |   65 ++++++++++------------------------------
 init/Kconfig                |    1
 kernel/cgroup.c             |   71 ++++++++++++++++----------------------------
 kernel/fork.c               |    4 --
 6 files changed, 78 insertions(+), 104 deletions(-)

--
tejun

[1] http://lkml.kernel.org/g/20150513193840.GC11388-piEFEHQLUPpN0TnZuCh8vA@public.gmane.org
[2] http://lkml.kernel.org/g/20150513202416.GE11388-piEFEHQLUPpN0TnZuCh8vA@public.gmane.org

             reply	other threads:[~2015-05-13 20:35 UTC|newest]

Thread overview: 25+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-05-13 20:35 Tejun Heo [this message]
2015-05-13 20:35 ` [PATCHSET] cgroup, sched: restructure threadgroup locking and replace it with a percpu_rwsem Tejun Heo
2015-05-13 20:35 ` [PATCH 1/3] sched, cgroup: reorganize threadgroup locking Tejun Heo
2015-05-13 20:35   ` Tejun Heo
2015-05-14  1:09   ` Sergey Senozhatsky
2015-05-14  1:09     ` Sergey Senozhatsky
2015-05-14 15:17     ` Tejun Heo
2015-05-14 15:17       ` Tejun Heo
2015-05-13 20:35 ` [PATCH 2/3] sched, cgroup: replace signal_struct->group_rwsem with a global percpu_rwsem Tejun Heo
2015-05-19 15:16   ` Peter Zijlstra
2015-05-19 15:51     ` Tejun Heo
2015-05-19 15:51       ` Tejun Heo
2015-05-20 10:05       ` Zefan Li
2015-05-20 10:05         ` Zefan Li
2015-05-21 20:39         ` Tejun Heo
2015-05-21 20:39           ` Tejun Heo
2015-05-24  2:35           ` Zefan Li
2015-05-24  2:35             ` Zefan Li
2015-05-13 20:35 ` [PATCH 3/3] cgroup: simplify threadgroup locking Tejun Heo
2015-05-18 16:34 ` [PATCHSET] cgroup, sched: restructure threadgroup locking and replace it with a percpu_rwsem Tejun Heo
2015-05-18 16:34   ` Tejun Heo
2015-05-18 20:06   ` Peter Zijlstra
2015-05-18 20:06     ` Peter Zijlstra
2015-05-27  0:34 ` Tejun Heo
2015-05-27  0:34   ` Tejun Heo

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=1431549318-16756-1-git-send-email-tj@kernel.org \
    --to=tj@kernel.org \
    --cc=cgroups@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=lizefan@huawei.com \
    --cc=mingo@redhat.com \
    --cc=peterz@infradead.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: link
Be 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.