From: Waiman Long <llong@redhat.com>
To: Sebastian Andrzej Siewior <bigeasy@linutronix.de>,
linux-kernel@vger.kernel.org
Cc: "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>,
"Peter Zijlstra" <peterz@infradead.org>,
"Valentin Schneider" <vschneid@redhat.com>
Subject: Re: [RFC v2 PATCH 0/4] futex: Add support task local hash maps.
Date: Thu, 31 Oct 2024 16:18:59 -0400 [thread overview]
Message-ID: <bcad4168-52a0-44cc-b0f0-9346f30d8d80@redhat.com> (raw)
In-Reply-To: <20241031155640.Fhtm3uFD@linutronix.de>
On 10/31/24 11:56 AM, Sebastian Andrzej Siewior wrote:
> On 2024-10-28 13:13:54 [+0100], To linux-kernel@vger.kernel.org wrote:
>> Need to do
>> more testing.
> So there is "perf bench futex hash". On a 256 CPU NUMA box:
> perf bench futex hash -t 240 -m -s -b $hb
> and hb 2 … 131072 (moved the allocation to kvmalloc) I get the following
> (averaged over 3 three runs)
>
> buckets op/sec
> 2 9158.33
> 4 21665.66 + ~136%
> 8 44686.66 + ~106
> 16 84144.33 + ~ 88
> 32 139998.33 + ~ 66
> 64 279957.0 + ~ 99
> 128 509533.0 + ~100
> 256 1019846.0 + ~100
> 512 1634940.0 + ~ 60
> 1024 1834859.33 + ~ 12
> 1868129.33 (global hash, 65536 hash)
> 2048 1912071.33 + ~ 4
> 4096 1918686.66 + ~ 0
> 8192 1922285.66 + ~ 0
> 16384 1923017.0 + ~ 0
> 32768 1923319.0 + ~ 0
> 65536 1932906.0 + ~ 0
> 131072 2042571.33 + ~ 5
>
> By doubling the hash size the ops/sec almost double until 256 slots.
> After 2048 slots the increase is almost noise (except for the last
> entry).
>
> Pinning the bench to individual CPUs belonging to a NUMA node and
> running the same test with 110 threads only (avg over 5 runs):
> ops/sec global ops/sec local
> node 0 2278572.2 2534827.4
> node 1 2229838.6 2437498.8
> node 0+1 2542602.4 2535749.8
Looking at the performance data, we should probably use the global hash
table to maximize throughput if latency isn't important.
AFAICT, the reason why patch 4 allocates a local hash whenever the first
thread is created to avoid a race between the same futex hashed on both
the local and global hash tables. Correct me if my understanding is
incorrect. That will enforce all multithreaded processes to use local
hash tables for private futexes even if they don't care about latency.
Maybe we should limit the auto local hash table allocation only to RT
processes. To avoid the race, we could add a flag to indicate if a
private futex has ever been hashed in the kernel and avoid local hash
creation in this case and probably also when the prctl() is being called
to create local hash table.
My 2 cents.
Cheers,
next prev parent reply other threads:[~2024-11-01 12:41 UTC|newest]
Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-10-28 12:13 Sebastian Andrzej Siewior
2024-10-28 12:13 ` [RFC PATCH v2 1/4] futex: Create helper function to initialize a hash slot Sebastian Andrzej Siewior
2024-10-28 12:13 ` [RFC PATCH v2 2/4] futex: Add basic infrastructure for local task local hash Sebastian Andrzej Siewior
2024-10-28 12:13 ` [RFC PATCH v2 3/4] futex: Use the task local hashmap Sebastian Andrzej Siewior
2024-10-28 12:13 ` [RFC PATCH v2 4/4] futex: Allow automatic allocation of process wide futex hash Sebastian Andrzej Siewior
2024-10-28 17:50 ` [RFC v2 PATCH 0/4] futex: Add support task local hash maps Sebastian Andrzej Siewior
2024-10-29 11:10 ` Juri Lelli
2024-10-29 15:06 ` Sebastian Andrzej Siewior
2024-10-31 15:56 ` Sebastian Andrzej Siewior
2024-10-31 17:47 ` Sebastian Andrzej Siewior
2024-11-01 11:08 ` Sebastian Andrzej Siewior
2024-10-31 20:18 ` Waiman Long [this message]
2024-10-31 20:28 ` Waiman Long
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=bcad4168-52a0-44cc-b0f0-9346f30d8d80@redhat.com \
--to=llong@redhat.com \
--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=mingo@redhat.com \
--cc=peterz@infradead.org \
--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
all inboxes | Powered by JetHome®