lkml.org 
[lkml]   [2006]   [Feb]   [21]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [patch] Cache align futex hash buckets
Ravikiran G Thirumalai wrote:
> Following change places each element of the futex_queues hashtable on a
> different cacheline. Spinlocks of adjacent hash buckets lie on the same
> cacheline otherwise.
>

It does not make sense to add swaths of unused memory into a hashtable for
this purpose, does it?

For a minimal, naive solution you just increase the size of the hash table.
This will (given a decent hash function) provide the same reduction in
cacheline contention, while also reducing collisions.

A smarter solution might have a single lock per cacheline, and multiple hash
slots. This could make the indexing code a bit more awkward though.

> Signed-off-by: Ravikiran Thirumalai <kiran@scalex86.org>
> Signed-off-by: Shai Fultheim <shai@scalex86.org>
>
> Index: linux-2.6.16-rc2/kernel/futex.c
> ===================================================================
> --- linux-2.6.16-rc2.orig/kernel/futex.c 2006-02-07 23:14:04.000000000 -0800
> +++ linux-2.6.16-rc2/kernel/futex.c 2006-02-09 14:04:22.000000000 -0800
> @@ -100,9 +100,10 @@ struct futex_q {
> struct futex_hash_bucket {
> spinlock_t lock;
> struct list_head chain;
> -};
> +} ____cacheline_internodealigned_in_smp;
>
> -static struct futex_hash_bucket futex_queues[1<<FUTEX_HASHBITS];
> +static struct futex_hash_bucket futex_queues[1<<FUTEX_HASHBITS]
> + __cacheline_aligned_in_smp;
>
> /* Futex-fs vfsmount entry: */
> static struct vfsmount *futex_mnt;
> -
> 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/
>


--
SUSE Labs, Novell Inc.
Send instant messages to your online friends http://au.messenger.yahoo.com

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

\
 
 \ /
  Last update: 2006-02-21 07:33    [W:0.104 / U:0.076 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site