mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Peter Zijlstra <peterz@infradead.org>
To: Sebastian Andrzej Siewior <bigeasy@linutronix.de>
Cc: linux-kernel@vger.kernel.org,
	"André Almeida" <andrealmeid@igalia.com>,
	"Darren Hart" <dvhart@infradead.org>,
	"Davidlohr Bueso" <dave@stgolabs.net>,
	"Ingo Molnar" <mingo@redhat.com>,
	"Juri Lelli" <juri.lelli@redhat.com>,
	"Valentin Schneider" <vschneid@redhat.com>,
	"Waiman Long" <longman@redhat.com>
Subject: Re: [RFC PATCH 3/3] futex: Use the task local hashmap.
Date: Mon, 28 Oct 2024 11:22:53 +0100	[thread overview]
Message-ID: <20241028102253.GN9767@noisy.programming.kicks-ass.net> (raw)
In-Reply-To: <20241026224306.982896-4-bigeasy@linutronix.de>

On Sun, Oct 27, 2024 at 12:34:52AM +0200, Sebastian Andrzej Siewior wrote:
> Use the hashlocal hashmap if provided.
> 
> Signed-off-by: Sebastian Andrzej Siewior <bigeasy@linutronix.de>
> ---
>  kernel/futex/core.c | 7 ++++++-
>  1 file changed, 6 insertions(+), 1 deletion(-)
> 
> diff --git a/kernel/futex/core.c b/kernel/futex/core.c
> index 7c97fc96f84a3..ee5a6902154c5 100644
> --- a/kernel/futex/core.c
> +++ b/kernel/futex/core.c
> @@ -119,13 +119,18 @@ late_initcall(fail_futex_debugfs);
>   * @key:	Pointer to the futex key for which the hash is calculated
>   *
>   * We hash on the keys returned from get_futex_key (see below) and return the
> - * corresponding hash bucket in the global hash.
> + * corresponding hash bucket in the global hash. If the FUTEX is private and
> + * a local hash table is privated then this one is used.
>   */
>  struct futex_hash_bucket *futex_hash(union futex_key *key)
>  {
> +	struct futex_hash_table *fht;
>  	u32 hash = jhash2((u32 *)key, offsetof(typeof(*key), both.offset) / 4,
>  			  key->both.offset);
>  
> +	fht = current->futex_hash_table;
> +	if (fht && (key->both.offset & (FUT_OFF_INODE | FUT_OFF_MMSHARED)) == 0)
> +		return &fht->queues[hash & (fht->slots - 1)];

Perhaps add a helper like:

static inline bool futex_key_is_private(struct futex_key *key)
{
	/*
	 * Relies on get_futex_key() to set either bit for shared
	 * futexes -- see comment with union futex_key.
	 */
	return !(key->both.offset & (FUT_OFF_INODE | FUT_OFF_MMSHARED));
}

  reply	other threads:[~2024-10-28 10:23 UTC|newest]

Thread overview: 19+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-10-26 22:34 [RFC PATCH 0/3] futex: Add support task local hash maps Sebastian Andrzej Siewior
2024-10-26 22:34 ` [RFC PATCH 1/3] futex: Create helper function to initialize a hash slot Sebastian Andrzej Siewior
2024-10-26 22:34 ` [RFC PATCH 2/3] futex: Add basic infrastructure for local task local hash Sebastian Andrzej Siewior
2024-10-27 12:19   ` Thomas Gleixner
2024-10-28 10:30     ` Sebastian Andrzej Siewior
2024-10-28 10:58       ` Thomas Gleixner
2024-10-28 11:00         ` Peter Zijlstra
2024-10-28 12:02           ` Thomas Gleixner
2024-10-30 21:08             ` Peter Zijlstra
2024-10-30 23:14               ` Thomas Gleixner
2024-10-31  9:13                 ` Peter Zijlstra
2024-10-28 10:16   ` Peter Zijlstra
2024-10-28 10:24     ` Sebastian Andrzej Siewior
2024-10-28 10:46       ` Peter Zijlstra
2024-10-28 13:10         ` Peter Zijlstra
2024-10-26 22:34 ` [RFC PATCH 3/3] futex: Use the task local hashmap Sebastian Andrzej Siewior
2024-10-28 10:22   ` Peter Zijlstra [this message]
2024-10-28 10:24     ` Sebastian Andrzej Siewior
2024-10-27 10:01 ` [RFC PATCH 0/3] futex: Add support task local hash maps Thomas Gleixner

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=20241028102253.GN9767@noisy.programming.kicks-ass.net \
    --to=peterz@infradead.org \
    --cc=andrealmeid@igalia.com \
    --cc=bigeasy@linutronix.de \
    --cc=dave@stgolabs.net \
    --cc=dvhart@infradead.org \
    --cc=juri.lelli@redhat.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=longman@redhat.com \
    --cc=mingo@redhat.com \
    --cc=vschneid@redhat.com \
    /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