Messages in this thread | | | Date | Sun, 18 Jan 2009 10:10:38 +0100 | From | Ingo Molnar <> | Subject | Re: [PATCH 1/3] cgroup: convert open-coded mutex_lock(&cgroup_mutex) calls into cgroup_lock() calls |
| |
* Lai Jiangshan <laijs@cn.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@cn.fujitsu.com> > Cc: Max Krasnyansky <maxk@qualcomm.com> > Cc: Miao Xie <miaox@cn.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
| |