[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <20080804144114.e323a47f.akpm@linux-foundation.org>
Date: Mon, 4 Aug 2008 14:41:14 -0700
From: Andrew Morton <akpm@...ux-foundation.org>
To: Andrea Arcangeli <andrea@...ranet.com>
Cc: penberg@...helsinki.fi, a.p.zijlstra@...llo.nl, davej@...hat.com,
rdreier@...co.com, torvalds@...ux-foundation.org,
davem@...emloft.net, jeremy@...p.org, hugh@...itas.com,
mingo@...e.hu, linux-kernel@...r.kernel.org, arjan@...radead.org
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@...ranet.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.
--
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