From: Peter Zijlstra <peterz@infradead.org>
To: Tejun Heo <tj@kernel.org>
Cc: lizefan@huawei.com, cgroups@vger.kernel.org, mingo@redhat.com,
linux-kernel@vger.kernel.org
Subject: Re: [PATCH 2/3] sched, cgroup: replace signal_struct->group_rwsem with a global percpu_rwsem
Date: Tue, 19 May 2015 17:16:59 +0200 [thread overview]
Message-ID: <20150519151659.GF3644@twins.programming.kicks-ass.net> (raw)
In-Reply-To: <1431549318-16756-3-git-send-email-tj@kernel.org>
On Wed, May 13, 2015 at 04:35:17PM -0400, Tejun Heo wrote:
.gitconfig:
[diff "default"]
xfuncname = "^[[:alpha:]$_].*[^:]$"
Will avoid keying on labels like that and show us this is
__cgroup_procs_write().
> @@ -2480,7 +2442,7 @@ retry_find_task:
> get_task_struct(tsk);
> rcu_read_unlock();
>
> - threadgroup_lock(tsk);
> + percpu_down_write(&cgroup_threadgroup_rwsem);
> if (threadgroup) {
> if (!thread_group_leader(tsk)) {
> /*
> @@ -2490,7 +2452,7 @@ retry_find_task:
> * try again; this is
> * "double-double-toil-and-trouble-check locking".
> */
> - threadgroup_unlock(tsk);
> + percpu_up_write(&cgroup_threadgroup_rwsem);
> put_task_struct(tsk);
> goto retry_find_task;
> }
> @@ -2703,17 +2665,17 @@ static int cgroup_update_dfl_csses(struct cgroup *cgrp)
> goto out_finish;
> last_task = task;
>
> - threadgroup_lock(task);
> + percpu_down_write(&cgroup_threadgroup_rwsem);
> /* raced against de_thread() from another thread? */
> if (!thread_group_leader(task)) {
> - threadgroup_unlock(task);
> + percpu_up_write(&cgroup_threadgroup_rwsem);
> put_task_struct(task);
> continue;
> }
>
> ret = cgroup_migrate(src_cset->dfl_cgrp, task, true);
>
> - threadgroup_unlock(task);
> + percpu_up_write(&cgroup_threadgroup_rwsem);
> put_task_struct(task);
>
> if (WARN(ret, "cgroup: failed to update controllers for the default hierarchy (%d), further operations may crash or hang\n", ret))
So my only worry with this patch-set is that these operations will be
hugely expensive.
Now it looks like the cgroup_update_dfl_csses() thing is very rare, its
when you change which controllers are active in a given subtree under
the uber-l337-super-comount design.
The other one, __cgorup_procs_write() is every /procs, /tasks write to a
cgroup, and that does worry me, this could be a somewhat common thing.
The Changelog states task migration is a cold path, but is tens of
miliseconds per task really no problem?
next prev parent reply other threads:[~2015-05-19 15:17 UTC|newest]
Thread overview: 14+ messages / expand[flat|nested] mbox.gz Atom feed top
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-14 1:09 ` Sergey Senozhatsky
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 [this message]
2015-05-19 15:51 ` Tejun Heo
2015-05-20 10:05 ` Zefan Li
2015-05-21 20:39 ` Tejun Heo
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 20:06 ` Peter Zijlstra
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=20150519151659.GF3644@twins.programming.kicks-ass.net \
--to=peterz@infradead.org \
--cc=cgroups@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=lizefan@huawei.com \
--cc=mingo@redhat.com \
--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: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
Powered by JetHome