From: Tejun Heo <tj@kernel.org>
To: John Stultz <john.stultz@linaro.org>
Cc: Ingo Molnar <mingo@redhat.com>,
Peter Zijlstra <peterz@infradead.org>,
lkml <linux-kernel@vger.kernel.org>,
Dmitry Shmidt <dimitrysh@google.com>,
Rom Lemarchand <romlem@google.com>,
Colin Cross <ccross@google.com>, Todd Kjos <tkjos@google.com>,
Oleg Nesterov <oleg@redhat.com>
Subject: Re: Severe performance regression w/ 4.4+ on Android due to cgroup locking changes
Date: Wed, 13 Jul 2016 14:33:47 -0400 [thread overview]
Message-ID: <20160713183347.GK4065@mtj.duckdns.org> (raw)
In-Reply-To: <20160713182102.GJ4065@mtj.duckdns.org>
On Wed, Jul 13, 2016 at 02:21:02PM -0400, Tejun Heo wrote:
> One interesting thing to try would be replacing it with a regular
> non-percpu rwsem and see how it behaves. That should easily tell us
> whether this is from actual contention or artifacts from percpu_rwsem
> implementation.
So, something like the following. Can you please see whether this
makes any difference?
Thanks.
diff --git a/include/linux/cgroup-defs.h b/include/linux/cgroup-defs.h
index 5b17de6..bc1e4d8 100644
--- a/include/linux/cgroup-defs.h
+++ b/include/linux/cgroup-defs.h
@@ -14,7 +14,7 @@
#include <linux/mutex.h>
#include <linux/rcupdate.h>
#include <linux/percpu-refcount.h>
-#include <linux/percpu-rwsem.h>
+#include <linux/rwsem.h>
#include <linux/workqueue.h>
#ifdef CONFIG_CGROUPS
@@ -518,7 +518,7 @@ struct cgroup_subsys {
unsigned int depends_on;
};
-extern struct percpu_rw_semaphore cgroup_threadgroup_rwsem;
+extern struct rw_semaphore cgroup_threadgroup_rwsem;
/**
* cgroup_threadgroup_change_begin - threadgroup exclusion for cgroups
@@ -529,7 +529,7 @@ extern struct percpu_rw_semaphore cgroup_threadgroup_rwsem;
*/
static inline void cgroup_threadgroup_change_begin(struct task_struct *tsk)
{
- percpu_down_read(&cgroup_threadgroup_rwsem);
+ down_read(&cgroup_threadgroup_rwsem);
}
/**
@@ -541,7 +541,7 @@ static inline void cgroup_threadgroup_change_begin(struct task_struct *tsk)
*/
static inline void cgroup_threadgroup_change_end(struct task_struct *tsk)
{
- percpu_up_read(&cgroup_threadgroup_rwsem);
+ up_read(&cgroup_threadgroup_rwsem);
}
#else /* CONFIG_CGROUPS */
diff --git a/kernel/cgroup.c b/kernel/cgroup.c
index 86cb5c6..ed9c142 100644
--- a/kernel/cgroup.c
+++ b/kernel/cgroup.c
@@ -113,7 +113,7 @@ static DEFINE_SPINLOCK(cgroup_file_kn_lock);
*/
static DEFINE_SPINLOCK(release_agent_path_lock);
-struct percpu_rw_semaphore cgroup_threadgroup_rwsem;
+DECLARE_RWSEM(cgroup_threadgroup_rwsem);
#define cgroup_assert_mutex_or_rcu_locked() \
RCU_LOCKDEP_WARN(!rcu_read_lock_held() && \
@@ -2899,7 +2899,7 @@ static ssize_t __cgroup_procs_write(struct kernfs_open_file *of, char *buf,
if (!cgrp)
return -ENODEV;
- percpu_down_write(&cgroup_threadgroup_rwsem);
+ down_write(&cgroup_threadgroup_rwsem);
rcu_read_lock();
if (pid) {
tsk = find_task_by_vpid(pid);
@@ -2937,7 +2937,7 @@ static ssize_t __cgroup_procs_write(struct kernfs_open_file *of, char *buf,
out_unlock_rcu:
rcu_read_unlock();
out_unlock_threadgroup:
- percpu_up_write(&cgroup_threadgroup_rwsem);
+ up_write(&cgroup_threadgroup_rwsem);
for_each_subsys(ss, ssid)
if (ss->post_attach)
ss->post_attach();
@@ -3077,7 +3077,7 @@ static int cgroup_update_dfl_csses(struct cgroup *cgrp)
lockdep_assert_held(&cgroup_mutex);
- percpu_down_write(&cgroup_threadgroup_rwsem);
+ down_write(&cgroup_threadgroup_rwsem);
/* look up all csses currently attached to @cgrp's subtree */
spin_lock_bh(&css_set_lock);
@@ -3112,7 +3112,7 @@ static int cgroup_update_dfl_csses(struct cgroup *cgrp)
ret = cgroup_taskset_migrate(&tset, cgrp->root);
out_finish:
cgroup_migrate_finish(&preloaded_csets);
- percpu_up_write(&cgroup_threadgroup_rwsem);
+ up_write(&cgroup_threadgroup_rwsem);
return ret;
}
@@ -5601,7 +5601,7 @@ int __init cgroup_init(void)
int ssid;
BUILD_BUG_ON(CGROUP_SUBSYS_COUNT > 16);
- BUG_ON(percpu_init_rwsem(&cgroup_threadgroup_rwsem));
+ //BUG_ON(percpu_init_rwsem(&cgroup_threadgroup_rwsem));
BUG_ON(cgroup_init_cftypes(NULL, cgroup_dfl_base_files));
BUG_ON(cgroup_init_cftypes(NULL, cgroup_legacy_base_files));
next prev parent reply other threads:[~2016-07-13 18:34 UTC|newest]
Thread overview: 67+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-07-13 0:00 Severe performance regression w/ 4.4+ on Android due to cgroup locking changes John Stultz
2016-07-13 8:21 ` Peter Zijlstra
2016-07-13 14:42 ` Paul E. McKenney
2016-07-13 18:13 ` Dmitry Shmidt
2016-07-13 18:32 ` Paul E. McKenney
2016-07-13 18:21 ` Tejun Heo
2016-07-13 18:33 ` Tejun Heo [this message]
2016-07-13 20:13 ` John Stultz
2016-07-13 20:18 ` Tejun Heo
2016-07-13 20:26 ` Peter Zijlstra
2016-07-13 20:39 ` Tejun Heo
2016-07-13 20:51 ` Peter Zijlstra
2016-07-13 21:01 ` Tejun Heo
2016-07-13 21:03 ` Paul E. McKenney
2016-07-13 21:05 ` Tejun Heo
2016-07-13 21:18 ` Paul E. McKenney
2016-07-13 21:42 ` Paul E. McKenney
2016-07-13 21:46 ` John Stultz
2016-07-13 22:17 ` Paul E. McKenney
2016-07-13 22:39 ` John Stultz
2016-07-13 23:02 ` Paul E. McKenney
2016-07-13 23:04 ` Paul E. McKenney
2016-07-14 11:35 ` Tejun Heo
2016-07-14 12:04 ` Peter Zijlstra
2016-07-14 12:08 ` Tejun Heo
2016-07-14 12:20 ` Peter Zijlstra
2016-07-14 15:07 ` Tejun Heo
2016-07-14 15:24 ` Tejun Heo
2016-07-14 16:32 ` Peter Zijlstra
2016-07-14 17:34 ` Oleg Nesterov
2016-07-14 16:54 ` John Stultz
2016-07-13 22:25 ` John Stultz
2016-07-13 22:01 ` Tejun Heo
2016-07-13 22:33 ` Paul E. McKenney
2016-07-14 6:49 ` Peter Zijlstra
2016-07-14 11:20 ` Tejun Heo
2016-07-14 12:11 ` Peter Zijlstra
2016-07-14 15:14 ` Tejun Heo
2016-07-14 13:18 ` Peter Zijlstra
2016-07-14 14:14 ` Peter Zijlstra
2016-07-14 14:58 ` Oleg Nesterov
2016-07-14 16:14 ` Peter Zijlstra
2016-07-14 16:37 ` Peter Zijlstra
2016-07-14 17:05 ` Oleg Nesterov
2016-07-14 16:23 ` Paul E. McKenney
2016-07-14 16:45 ` Peter Zijlstra
2016-07-14 17:15 ` Paul E. McKenney
2016-07-14 16:43 ` John Stultz
2016-07-14 16:49 ` Peter Zijlstra
2016-07-14 17:02 ` John Stultz
2016-07-14 17:13 ` Oleg Nesterov
2016-07-14 17:30 ` John Stultz
2016-07-14 17:41 ` Oleg Nesterov
2016-07-14 17:51 ` John Stultz
2016-07-14 18:09 ` Oleg Nesterov
2016-07-14 18:36 ` Peter Zijlstra
2016-07-14 19:35 ` Peter Zijlstra
2016-07-13 20:57 ` John Stultz
2016-07-13 20:52 ` Paul E. McKenney
2016-07-13 20:57 ` Peter Zijlstra
2016-07-13 21:08 ` Paul E. McKenney
2016-07-13 21:01 ` Dmitry Shmidt
2016-07-13 21:03 ` John Stultz
2016-07-13 21:05 ` Paul E. McKenney
2016-07-13 20:31 ` Dmitry Shmidt
2016-07-13 20:44 ` Colin Cross
2016-07-13 20:54 ` 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=20160713183347.GK4065@mtj.duckdns.org \
--to=tj@kernel.org \
--cc=ccross@google.com \
--cc=dimitrysh@google.com \
--cc=john.stultz@linaro.org \
--cc=linux-kernel@vger.kernel.org \
--cc=mingo@redhat.com \
--cc=oleg@redhat.com \
--cc=peterz@infradead.org \
--cc=romlem@google.com \
--cc=tkjos@google.com \
/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;
as well as URLs for NNTP newsgroup(s).