[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <1291736974.2032.665.camel@laptop>
Date: Tue, 07 Dec 2010 16:49:34 +0100
From: Peter Zijlstra <a.p.zijlstra@...llo.nl>
To: Nick Piggin <npiggin@...il.com>
Cc: Dave Chinner <david@...morbit.com>,
Nick Piggin <npiggin@...nel.dk>, linux-fsdevel@...r.kernel.org,
linux-kernel@...r.kernel.org
Subject: Re: [PATCH 00/46] rcu-walk and dcache scaling
On Wed, 2010-12-08 at 02:24 +1100, Nick Piggin wrote:
>
> repeat:
> spin_lock(&parent->d_lock);
> spin_lock_nested(&dentry->d_lock, DENTRY_D_LOCK_NESTED);
> /* do stuff */
> spin_unlock(&parent->d_lock);
> spin_release(&dentry->d_lock.dep_map, 1, _RET_IP_);
> parent = dentry;
> spin_acquire(&this_parent->d_lock.dep_map, 0, 1, _RET_IP_);
> goto repeat;
shouldn't that be s/this_parent/parent/ ?
So what you're trying to do is:
A -> B -> C -> ...
lock A
lock B, nested
unlock A
flip B from nested to top
lock C, nested
unlock B
flip C from nested to top
lock ...
Anyway, the way to write that is something like:
lock_set_subclass(&detry->d_lock.dep_map, 0, _RET_IP_);
Which will reset the subclass of the held lock from DENTRY_D_LOCK_NESTED
to 0.
This is also used in double_unlock_balance(), we go into
double_lock_balance() with this_rq locked and want to lock busiest,
because of the lock ordering we might need to unlock this_rq and lock
busiest first, at which point this_rq is nested.
On unlock we thus need to map this_rq back to subclass 0 (which it had
before double_lock_balance(), because otherwise subsequent lock
operations will be done against the subclass and confuse things.
--
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