[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <6599ad830812101644l639daab5yab35e299d3badad9@mail.gmail.com>
Date: Wed, 10 Dec 2008 16:44:51 -0800
From: Paul Menage <menage@...gle.com>
To: KAMEZAWA Hiroyuki <kamezawa.hiroyu@...fujitsu.com>
Cc: balbir@...ux.vnet.ibm.com, containers@...ts.linux-foundation.org,
linux-kernel@...r.kernel.org, akpm@...ux-foundation.org
Subject: Re: [RFC][PATCH 1/3] CGroups: Add a per-subsystem hierarchy_mutex
On Wed, Dec 10, 2008 at 4:37 PM, KAMEZAWA Hiroyuki
<kamezawa.hiroyu@...fujitsu.com> wrote:
>> +static void cgroup_unlock_hierarchy(struct cgroupfs_root *root)
>> +{
>> + int i;
>> +
>> + for (i = 0; i < CGROUP_SUBSYS_COUNT; i++) {
>> + struct cgroup_subsys *ss = subsys[i];
>> + if (ss->root == root)
>> + mutex_unlock(&ss->hierarchy_mutex);
>> + }
>> +}
>> +
> Maybe no problem..but I don't like releasing lock in the order of acquiring lock.
>
> for (i = CGROUP_SUBSYS_COUNT - 1; i >=0; i--) ?
The order that you release the locks is irrelevant for correctness. In
this case, since the only callers of cgroup_lock_hierarchy() also hold
cgroup_mutex and hence can't race with one another, the order of
locking is irrelevant for correctness too - right now the locking
order is just designed to keep lockdep happy.
I think that the reverse-ordered loop is less readable for no gain.
Paul
--
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