Messages in this thread | | | Date | Mon, 4 Aug 2008 14:41:14 -0700 | From | Andrew Morton <> | Subject | Re: [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.
| |