Re: [PATCH] blockgroup_lock: hashed spinlocks for ext2 and ext3

Andrew Morton (akpm@digeo.com)
Mon, 14 Apr 2003 14:38:13 -0700


Andi Kleen <ak@suse.de> wrote:
>
> > +
> > +struct bgl_lock {
> > + spinlock_t lock;
> > +} ____cacheline_aligned_in_smp;
> > +
> > +struct blockgroup_lock {
> > + struct bgl_lock locks[NR_BG_LOCKS];
> > +};
>
> Why don't you use per_cpu data for this ? It can be indexed as well
> with per_cpu() and it would safe a lot of space because the padding
> would not be all wasted. If you want more than NR_CPUS locks it could be
> done using a simple two level index scheme.

per_cpu data is statically allocated, at compile-time. And it doesn't work
for modules.

These hashed locks need to be dynamically allocated (one per filesystem) and
they need to work from modules.

And this hashed lock is not a per-cpu thing. (No locks are!) It just uses
NR_CPUS to decide how big the hash should be.

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