[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20090118091038.GC27144@elte.hu>
Date: Sun, 18 Jan 2009 10:10:38 +0100
From: Ingo Molnar <mingo@...e.hu>
To: Lai Jiangshan <laijs@...fujitsu.com>
Cc: Andrew Morton <akpm@...ux-foundation.org>, menage@...gle.com,
miaox@...fujitsu.com, maxk@...lcomm.com,
linux-kernel@...r.kernel.org,
Peter Zijlstra <a.p.zijlstra@...llo.nl>
Subject: Re: [PATCH 1/3] cgroup: convert open-coded
mutex_lock(&cgroup_mutex) calls into cgroup_lock() calls
* Lai Jiangshan <laijs@...fujitsu.com> wrote:
> Convert open-coded mutex_lock(&cgroup_mutex) calls into cgroup_lock()
> calls and convert mutex_unlock(&cgroup_mutex) calls into cgroup_unlock()
> calls.
>
> Signed-off-by: Lai Jiangshan <laijs@...fujitsu.com>
> Cc: Max Krasnyansky <maxk@...lcomm.com>
> Cc: Miao Xie <miaox@...fujitsu.com>
> ---
(please include diffstat output in patches, so that the general source
code impact can be seen at a glance.)
> diff --git a/kernel/cgroup.c b/kernel/cgroup.c
> index c298310..75a352b 100644
> --- a/kernel/cgroup.c
> +++ b/kernel/cgroup.c
> @@ -616,7 +688,7 @@ static void cgroup_diput(struct dentry *dentry, struct inode *inode)
> * agent */
> synchronize_rcu();
>
> - mutex_lock(&cgroup_mutex);
> + cgroup_lock();
this just changes over a clean mutex call to a wrapped lock/unlock
sequence that has higher overhead in the common case.
We should do the exact opposite, we should change this opaque API:
void cgroup_lock(void)
{
mutex_lock(&cgroup_mutex);
}
To something more explicit (and more maintainable) like:
cgroup_mutex_lock(&cgroup_mutex);
cgroup_mutex_unlock(&cgroup_mutex);
Which is a NOP in the !CGROUPS case and maps to mutex_lock/unlock in the
CGROUPS=y case.
Ingo
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists