From: Shrikanth Hegde <sshegde@linux.ibm.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>,
"Thomas Gleixner" <tglx@linutronix.de>,
"Valentin Schneider" <vschneid@redhat.com>,
"Waiman Long" <longman@redhat.com>,
"Liang, Kan" <kan.liang@linux.intel.com>,
"Adrian Hunter" <adrian.hunter@intel.com>,
"Alexander Shishkin" <alexander.shishkin@linux.intel.com>,
"Arnaldo Carvalho de Melo" <acme@kernel.org>,
"Ian Rogers" <irogers@google.com>, "Jiri Olsa" <jolsa@kernel.org>,
"Mark Rutland" <mark.rutland@arm.com>,
"Namhyung Kim" <namhyung@kernel.org>,
linux-perf-users@vger.kernel.org
Subject: Re: [PATCH v11 19/19] futex: Allow to make the private hash immutable.
Date: Thu, 10 Apr 2025 20:22:08 +0530 [thread overview]
Message-ID: <ced9c08c-a017-495f-978b-0c4d13992e5e@linux.ibm.com> (raw)
In-Reply-To: <20250407155742.968816-20-bigeasy@linutronix.de>
Hi Sebastian.
On 4/7/25 21:27, Sebastian Andrzej Siewior wrote:
> My initial testing showed that
> perf bench futex hash
>
> reported less operations/sec with private hash. After using the same
> amount of buckets in the private hash as used by the global hash then
> the operations/sec were about the same.
>
> This changed once the private hash became resizable. This feature added
> a RCU section and reference counting via atomic inc+dec operation into
> the hot path.
> The reference counting can be avoided if the private hash is made
> immutable.
> Extend PR_FUTEX_HASH_SET_SLOTS by a fourth argument which denotes if the
> private should be made immutable. Once set (to true) the a further
> resize is not allowed (same if set to global hash).
> Add PR_FUTEX_HASH_GET_IMMUTABLE which returns true if the hash can not
> be changed.
> Update "perf bench" suite.
>
It would be good option for the application to decide if it needs this.
Using this option makes the perf regression goes away using previous number of buckets.
Acked-by: Shrikanth Hegde <sshegde@linux.ibm.com>
base:
./perf bench futex hash
Averaged 1556023 operations/sec (+- 0.08%), total secs = 10 <<-- 1.5M
with series:
./perf bench futex hash -b32768
Averaged 126499 operations/sec (+- 0.41%), total secs = 10 <<-- .12M
./perf bench futex hash -Ib32768
Averaged 1549339 operations/sec (+- 0.08%), total secs = 10 <<-- 1.5M
> For comparison, results of "perf bench futex hash -s":
> - Xeon CPU E5-2650, 2 NUMA nodes, total 32 CPUs:
> - Before the introducing task local hash
> shared Averaged 1.487.148 operations/sec (+- 0,53%), total secs = 10
> private Averaged 2.192.405 operations/sec (+- 0,07%), total secs = 10
>
> - With the series
> shared Averaged 1.326.342 operations/sec (+- 0,41%), total secs = 10
> -b128 Averaged 141.394 operations/sec (+- 1,15%), total secs = 10
> -Ib128 Averaged 851.490 operations/sec (+- 0,67%), total secs = 10
> -b8192 Averaged 131.321 operations/sec (+- 2,13%), total secs = 10
> -Ib8192 Averaged 1.923.077 operations/sec (+- 0,61%), total secs = 10
> 128 is the default allocation of hash buckets.
> 8192 was the previous amount of allocated hash buckets.
>
> - Xeon(R) CPU E7-8890 v3, 4 NUMA nodes, total 144 CPUs:
> - Before the introducing task local hash
> shared Averaged 1.810.936 operations/sec (+- 0,26%), total secs = 20
> private Averaged 2.505.801 operations/sec (+- 0,05%), total secs = 20
>
> - With the series
> shared Averaged 1.589.002 operations/sec (+- 0,25%), total secs = 20
> -b1024 Averaged 42.410 operations/sec (+- 0,20%), total secs = 20
> -Ib1024 Averaged 740.638 operations/sec (+- 1,51%), total secs = 20
> -b65536 Averaged 48.811 operations/sec (+- 1,35%), total secs = 20
> -Ib65536 Averaged 1.963.165 operations/sec (+- 0,18%), total secs = 20
> 1024 is the default allocation of hash buckets.
> 65536 was the previous amount of allocated hash buckets.
>
> Cc: "Liang, Kan" <kan.liang@linux.intel.com>
> Cc: Adrian Hunter <adrian.hunter@intel.com>
> Cc: Alexander Shishkin <alexander.shishkin@linux.intel.com>
> Cc: Arnaldo Carvalho de Melo <acme@kernel.org>
> Cc: Ian Rogers <irogers@google.com>
> Cc: Ingo Molnar <mingo@redhat.com>
> Cc: Jiri Olsa <jolsa@kernel.org>
> Cc: Mark Rutland <mark.rutland@arm.com>
> Cc: Namhyung Kim <namhyung@kernel.org>
> Cc: linux-perf-users@vger.kernel.org
> Signed-off-by: Sebastian Andrzej Siewior <bigeasy@linutronix.de>
> ---
> include/linux/futex.h | 2 +-
> include/uapi/linux/prctl.h | 1 +
> kernel/futex/core.c | 42 ++++++++++++++++++++++----
> kernel/sys.c | 2 +-
> tools/include/uapi/linux/prctl.h | 1 +
> tools/perf/bench/futex-hash.c | 1 +
> tools/perf/bench/futex-lock-pi.c | 1 +
> tools/perf/bench/futex-requeue.c | 1 +
> tools/perf/bench/futex-wake-parallel.c | 1 +
> tools/perf/bench/futex-wake.c | 1 +
> tools/perf/bench/futex.c | 8 +++--
> tools/perf/bench/futex.h | 1 +
> 12 files changed, 51 insertions(+), 11 deletions(-)
>
nit: Does it makes sense to split this patch into futex and perf?
next prev parent reply other threads:[~2025-04-10 14:52 UTC|newest]
Thread overview: 31+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-04-07 15:57 [PATCH v11 00/19] futex: Add support task local hash maps, FUTEX2_NUMA and FUTEX2_MPOL Sebastian Andrzej Siewior
2025-04-07 15:57 ` [PATCH v11 01/19] rcuref: Provide rcuref_is_dead() Sebastian Andrzej Siewior
2025-04-07 15:57 ` [PATCH v11 02/19] mm: Add vmalloc_huge_node() Sebastian Andrzej Siewior
2025-04-07 15:57 ` [PATCH v11 03/19] futex: Move futex_queue() into futex_wait_setup() Sebastian Andrzej Siewior
2025-04-07 15:57 ` [PATCH v11 04/19] futex: Pull futex_hash() out of futex_q_lock() Sebastian Andrzej Siewior
2025-04-07 15:57 ` [PATCH v11 05/19] futex: Create hb scopes Sebastian Andrzej Siewior
2025-04-07 15:57 ` [PATCH v11 06/19] futex: Create futex_hash() get/put class Sebastian Andrzej Siewior
2025-04-07 15:57 ` [PATCH v11 07/19] futex: Create private_hash() " Sebastian Andrzej Siewior
2025-04-07 15:57 ` [PATCH v11 08/19] futex: Acquire a hash reference in futex_wait_multiple_setup() Sebastian Andrzej Siewior
2025-04-07 15:57 ` [PATCH v11 09/19] futex: Decrease the waiter count before the unlock operation Sebastian Andrzej Siewior
2025-04-07 15:57 ` [PATCH v11 10/19] futex: Introduce futex_q_lockptr_lock() Sebastian Andrzej Siewior
2025-04-07 15:57 ` [PATCH v11 11/19] futex: Create helper function to initialize a hash slot Sebastian Andrzej Siewior
2025-04-07 15:57 ` [PATCH v11 12/19] futex: Add basic infrastructure for local task local hash Sebastian Andrzej Siewior
2025-04-07 15:57 ` [PATCH v11 13/19] futex: Allow automatic allocation of process wide futex hash Sebastian Andrzej Siewior
2025-04-07 15:57 ` [PATCH v11 14/19] futex: Allow to resize the private local hash Sebastian Andrzej Siewior
2025-04-07 15:57 ` [PATCH v11 15/19] futex: Implement FUTEX2_NUMA Sebastian Andrzej Siewior
2025-04-07 16:52 ` Sebastian Andrzej Siewior
2025-04-17 15:34 ` Sebastian Andrzej Siewior
2025-04-07 15:57 ` [PATCH v11 16/19] futex: Implement FUTEX2_MPOL Sebastian Andrzej Siewior
2025-04-07 15:57 ` [PATCH v11 17/19] tools headers: Synchronize prctl.h ABI header Sebastian Andrzej Siewior
2025-04-07 15:57 ` [PATCH v11 18/19] tools/perf: Allow to select the number of hash buckets Sebastian Andrzej Siewior
2025-04-07 15:57 ` [PATCH v11 19/19] futex: Allow to make the private hash immutable Sebastian Andrzej Siewior
2025-04-10 10:56 ` Sebastian Andrzej Siewior
2025-04-10 14:52 ` Shrikanth Hegde [this message]
2025-04-10 15:28 ` Sebastian Andrzej Siewior
2025-04-10 15:48 ` Shrikanth Hegde
2025-04-07 16:00 ` [PATCH v11 00/19] futex: Add support task local hash maps, FUTEX2_NUMA and FUTEX2_MPOL Sebastian Andrzej Siewior
2025-04-08 13:51 ` André Almeida
2025-04-08 16:13 ` Sebastian Andrzej Siewior
2025-04-10 17:51 ` Shrikanth Hegde
2025-04-15 9:03 ` Sebastian Andrzej Siewior
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=ced9c08c-a017-495f-978b-0c4d13992e5e@linux.ibm.com \
--to=sshegde@linux.ibm.com \
--cc=acme@kernel.org \
--cc=adrian.hunter@intel.com \
--cc=alexander.shishkin@linux.intel.com \
--cc=andrealmeid@igalia.com \
--cc=bigeasy@linutronix.de \
--cc=dave@stgolabs.net \
--cc=dvhart@infradead.org \
--cc=irogers@google.com \
--cc=jolsa@kernel.org \
--cc=juri.lelli@redhat.com \
--cc=kan.liang@linux.intel.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-perf-users@vger.kernel.org \
--cc=longman@redhat.com \
--cc=mark.rutland@arm.com \
--cc=mingo@redhat.com \
--cc=namhyung@kernel.org \
--cc=peterz@infradead.org \
--cc=tglx@linutronix.de \
--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