lkml.org 
[lkml]   [2008]   [Aug]   [4]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [PATCH] workaround minor lockdep bug triggered by mm_take_all_locks
On Mon, 4 Aug 2008 23:30:18 +0200
Andrea Arcangeli <andrea@qumranet.com> wrote:

> Now perhaps I misunderstood lockdep entirely

You did ;)

At runtime lockdep will "learn" the lock ordering rules, building a
graph in memory. If it ever sees the thus-learnt rules violated, it
will warn.


Simple example:


static DEFINE_MUTEX(a);
static DEFINE_MUTEX(b);

void f1(void)
{
mutex_lock(a);
mutex_lock(b);
}

void f2(void)
{
mutex_lock(b);
mutex_lock(a);
}

void doit(void)
{
f1();
f2();
}



lockdep will warn here about the ranking violation. As soon as it
occurs. Even though the system never deadlocked.

It's very very clever and powerful.


\
 
 \ /
  Last update: 2008-08-04 23:45    [W:0.129 / U:0.492 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site