Re: [patch 38/61] lock validator: special locking: i_mutex

From: Ingo Molnar
Date: Tue May 30 2006 - 17:05:21 EST



* Steven Rostedt <rostedt@xxxxxxxxxxx> wrote:

> On Mon, 2006-05-29 at 23:26 +0200, Ingo Molnar wrote:
> > + * inode->i_mutex nesting types for the LOCKDEP validator:
> > + *
> > + * 0: the object of the current VFS operation
> > + * 1: parent
> > + * 2: child/target
> > + */
> > +enum inode_i_mutex_lock_type
> > +{
> > + I_MUTEX_NORMAL,
> > + I_MUTEX_PARENT,
> > + I_MUTEX_CHILD
> > +};
> > +
> > +/*
>
> I guess we can say the same about I_MUTEX_NORMAL.

yeah. Subtypes start from 1, as 0 is the basic type.

Lock types are keyed via static kernel addresses. This means that we can
use the lock address (for DEFINE_SPINLOCK) or the static key embedded in
spin_lock_init() as a key in 99% of the cases. The key [struct
lockdep_type_key, see include/linux/lockdep.h] occupies enough bytes (of
kernel static virtual memory) so that the keys remain automatically
unique. Right now MAX_LOKCDEP_SUBTYPES is 8, so the keys take at most 8
bytes. (To save some memory there's another detail: for static locks
(DEFINE_SPINLOCK ones) we use the lock address itself as the key.)

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