* Re: [PATCH] blockgroup_lock: hashed spinlocks for ext2 and ext3
[not found] <200304131113.h3DBDvj2004773@hera.kernel.org>
@ 2003-04-14 20:06 ` Andi Kleen
2003-04-14 21:38 ` Andrew Morton
0 siblings, 1 reply; 4+ messages in thread
From: Andi Kleen @ 2003-04-14 20:06 UTC (permalink / raw)
To: Linux Kernel Mailing List; +Cc: akpm
On Sun, 2003-04-13 at 12:00, Linux Kernel Mailing List wrote:
[....]
>
> These locks are actually fairly generic. However I presented it as something
> which is specific to ext2 and ext3 so that people wouldn't go using them all
> over the place. They consume a lot of storage.
>
> +
> +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.
-Andi
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH] blockgroup_lock: hashed spinlocks for ext2 and ext3
2003-04-14 20:06 ` [PATCH] blockgroup_lock: hashed spinlocks for ext2 and ext3 Andi Kleen
@ 2003-04-14 21:38 ` Andrew Morton
2003-04-14 21:46 ` Andi Kleen
0 siblings, 1 reply; 4+ messages in thread
From: Andrew Morton @ 2003-04-14 21:38 UTC (permalink / raw)
To: Andi Kleen; +Cc: linux-kernel
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.
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH] blockgroup_lock: hashed spinlocks for ext2 and ext3
2003-04-14 21:38 ` Andrew Morton
@ 2003-04-14 21:46 ` Andi Kleen
2003-04-14 21:58 ` Andrew Morton
0 siblings, 1 reply; 4+ messages in thread
From: Andi Kleen @ 2003-04-14 21:46 UTC (permalink / raw)
To: Andrew Morton; +Cc: Andi Kleen, linux-kernel
> 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.
Ok.
>
> 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.
Isn't that what the IBM kmalloc_per_cpu() was for ? (I think the patch
was from Dipankar)
-Andi
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH] blockgroup_lock: hashed spinlocks for ext2 and ext3
2003-04-14 21:46 ` Andi Kleen
@ 2003-04-14 21:58 ` Andrew Morton
0 siblings, 0 replies; 4+ messages in thread
From: Andrew Morton @ 2003-04-14 21:58 UTC (permalink / raw)
To: Andi Kleen; +Cc: linux-kernel
Andi Kleen <ak@suse.de> wrote:
>
> >
> > 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.
>
> Isn't that what the IBM kmalloc_per_cpu() was for ? (I think the patch
> was from Dipankar)
This is not a per-cpu data structure.
It is a hashed spinlock which uses NR_CPUS as a sizing hint.
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2003-04-14 21:48 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
[not found] <200304131113.h3DBDvj2004773@hera.kernel.org>
2003-04-14 20:06 ` [PATCH] blockgroup_lock: hashed spinlocks for ext2 and ext3 Andi Kleen
2003-04-14 21:38 ` Andrew Morton
2003-04-14 21:46 ` Andi Kleen
2003-04-14 21:58 ` Andrew Morton
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).