mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Rusty Russell <rusty@rustcorp.com.au>
To: "Hu, Boris" <boris.hu@intel.com>
Cc: "Jamie Lokier" <jamie@shareable.org>
Cc: linux-kernel@vger.kernel.org, Ulrich Drepper <drepper@redhat.com>
Subject: Re: [PATCH] Split futex global spinlock futex_lock
Date: Tue, 16 Sep 2003 01:07:02 +1000	[thread overview]
Message-ID: <20030916010313.69E1F2C974@lists.samba.org> (raw)
In-Reply-To: Your message of "Thu, 11 Sep 2003 15:02:17 +0800." <37FBBA5F3A361C41AB7CE44558C3448E01C0B8DE@pdsmsx403.ccr.corp.intel.com>

In message <37FBBA5F3A361C41AB7CE44558C3448E01C0B8DE@pdsmsx403.ccr.corp.intel.com> you write:
> +/*
> + * Split the global futex_lock into every hash list lock.
> + */
> +struct futex_hash_bucket {
> +       spinlock_t              lock;
> +       struct list_head       chain;
> +};
> +
>  /* The key for the hash is the address + index + offset within page */
> -static struct list_head futex_queues[1<<FUTEX_HASHBITS];
> -static spinlock_t futex_lock = SPIN_LOCK_UNLOCKED;
> +static struct futex_hash_bucket futex_queues[1<<FUTEX_HASHBITS] \
> +	__cacheline_aligned_in_smp;

This doesn't do what you expect, unfortunately.  You need:

struct futex_hash_bucket {
       spinlock_t              lock;
       struct list_head       chain;
} ____cacheline_aligned_in_smp;

static struct futex_hash_bucket futex_queues[1<<FUTEX_HASHBITS]
	__cacheline_aligned_in_smp;

Also, Jamie was hinting at a sectored approach: optimal memory
footprint/speed balance might be one lock in one cache-line-worth of
list_head.  But the above will do unless someone gets extremely
excited.

Uli, can we ask you for benchmarks with this change, too?

Cheers,
Rusty.
--
  Anyone who quotes me in their sig is an idiot. -- Rusty Russell.

  reply	other threads:[~2003-09-16  1:03 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2003-09-11  7:02 Hu, Boris
2003-09-15 15:07 ` Rusty Russell [this message]
2003-09-16  4:48   ` Ulrich Drepper
2003-09-16 11:11     ` Jamie Lokier
2003-09-16 11:04   ` Jamie Lokier
2003-09-17  1:55     ` Rusty Russell
  -- strict thread matches above, loose matches on Subject: below --
2003-09-16  7:31 Hu, Boris
2003-09-10  5:23 Hu, Boris
2003-09-10  6:47 ` William Lee Irwin III
2003-09-10  7:36   ` Ulrich Drepper
2003-09-10  9:36 ` Ulrich Drepper
2003-09-10 10:23   ` Jamie Lokier
2003-09-10 11:07 ` Jamie Lokier

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20030916010313.69E1F2C974@lists.samba.org \
    --to=rusty@rustcorp.com.au \
    --cc=boris.hu@intel.com \
    --cc=jamie@shareable.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

Powered by JetHome