Re: [patch 1/1] unified spinlock initializationarch/um/drivers/port_kern.c

From: Thomas Gleixner
Date: Thu Mar 10 2005 - 03:17:25 EST


On Wed, 2005-03-09 at 20:52 +0100, Blaisorblade wrote:
> > Are you sure this is really the best option in this instance?
> > Sometimes, static data initialisation is more efficient than
> > code-based manual initialisation, especially when the memory
> > is written to anyway.
> Agreed, theoretically, but this was done for multiple reasons globally, for
> instance as a preparation to Ingo Molnar's preemption patches. There was
> mention of this on lwn.net about this:
>
> http://lwn.net/Articles/108719/

Those patches did only the conversion of

static spinlock_t lock = SPIN_LOCK_UNLOCKED;
lock = SPIN_LOCK_UNLOCKED;
to
static DEFINE_SPINLOCK(lock);
spin_lock_init(lock);

If you want to do static initialization inside of structures, then you
have to define a seperate MACRO similar to the static initialization of
list_head's inside of structures:

static struct sysfs_dirent sysfs_root = {
.s_sibling = LIST_HEAD_INIT(sysfs_root.s_sibling),

tglx


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