lkml.org 
[lkml]   [2010]   [Dec]   [7]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
SubjectRe: [PATCH 00/46] rcu-walk and dcache scaling
From
On Wed, Dec 8, 2010 at 2:49 AM, Peter Zijlstra <a.p.zijlstra@chello.nl> wrote:
> 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/ ?

Yes, typo in my pseudo code.


> 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.

OK, thanks. My version should not have caused any problems though,
right? Any idea what might have caused Dave's crash?


> 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.

Thanks,
Nick
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/

\
 
 \ /
  Last update: 2010-12-07 17:01    [from the cache]
©2003-2011 Jasper Spaans