All of lore.kernel.org
 help / color / mirror / Atom feed
From: Breno Leitao <leitao@debian.org>
To: Peter Zijlstra <peterz@infradead.org>
Cc: "Thomas Gleixner" <tglx@kernel.org>,
	"Ingo Molnar" <mingo@redhat.com>,
	"Darren Hart" <dvhart@infradead.org>,
	"Davidlohr Bueso" <dave@stgolabs.net>,
	"André Almeida" <andrealmeid@igalia.com>,
	linux-kernel@vger.kernel.org, puranjay@kernel.org,
	rmikey@meta.com, stuclar@meta.com, namhyung@kernel.org,
	kernel-team@meta.com
Subject: Re: [PATCH RFC] futex: avoid false sharing between hb->chain and the bucket lock
Date: Wed, 10 Jun 2026 06:56:12 -0700	[thread overview]
Message-ID: <ailsiFU1Ul8j8qXG@gmail.com> (raw)
In-Reply-To: <20260610112546.GE187714@noisy.programming.kicks-ass.net>

On Wed, Jun 10, 2026 at 01:25:46PM +0200, Peter Zijlstra wrote:
> On Wed, Jun 10, 2026 at 01:22:34PM +0200, Thomas Gleixner wrote:
> > On Tue, Jun 09 2026 at 22:18, Peter Zijlstra wrote:
> > > On Tue, Jun 09, 2026 at 10:11:17PM +0200, Peter Zijlstra wrote:
> > >> Anyway, how does something like the below work for you? It's a total
> > >> hack job, but it (sorta) builds and runs.
> > >> 
> > >
> > > Please use this one, I spotted a silly bug.
> > 
> > So I ran this on two machines.
> > 
> > SKL dual socket 112 threads:
> > 
> > 		Baseline	Patched
> > 
> > shared (16k)	1571857 	1641435         + 4.4%
> > autosize (512)	 646390 	 903371         +39.7%
> > -b 256		 464395 	 587014         +26.4%
> > -b 512		 715687 	 995943         +39.2%
> > -b 1024		 995085 	1396328         +40.3%
> > -b 2048		1293114         1668395         +29.0%
> > -b 4096		2124438 	2240228         + 5.5%
> > 
> > Zen3 dual socket 256 threads:
> > 
> > 		Baseline	Patched
> > 
> > shared	(16k)	1275840		1381279	 	+ 8.2%
> > autosize (512)	1252745		1482179		+18.3%
> > -b 256		 856274		 955455		+11.5%
> > -b 512		1267490		1544010		+21.8%
> > -b 1024		1424013		1625424		+14.1%
> > -b 2048		1505181		1669342		+10.9%
> > -b 4096		1465993		1688932		+15.2%
> 
> I suppose that means I'd better go make it prettier and survive
> randconfig :-)

I've Peter it here on the same machine I used earlier 176-thread AMD EPYC host,
10s perf bench futex hash per run, baseline = parent commit (acb7500801e98):

                       Baseline       Patched      Delta
  shared (16 buckets)  1,230,599      1,368,655    +11.2%
  autosize (1024)      1,285,440      1,556,946    +21.1%
  -b 256               1,341,471      1,520,303    +13.3%
  -b 512               1,438,330      1,599,319    +11.2%
  -b 1024              1,443,772      1,622,493    +12.4%
  -b 2048              1,472,108      1,643,975    +11.7%
  -b 4096              1,333,098      1,570,897    +17.8%

Stderr was 0.06%-0.22% across the board, so the deltas are well
outside noise.

The trade Peter sketched holds up here: no extra futex memory
cost, and we still recover most of what padding the bucket would
have bought.

Really good, thanks for your this patch,
--breno


  parent reply	other threads:[~2026-06-10 13:56 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-06-05 16:53 [PATCH RFC] futex: avoid false sharing between hb->chain and the bucket lock Breno Leitao
2026-06-09 10:46 ` Peter Zijlstra
2026-06-09 15:28   ` Breno Leitao
2026-06-09 20:11     ` Peter Zijlstra
2026-06-09 20:18       ` Peter Zijlstra
2026-06-10 11:22         ` Thomas Gleixner
2026-06-10 11:25           ` Peter Zijlstra
2026-06-10 13:55             ` Peter Zijlstra
2026-06-10 13:56             ` Breno Leitao [this message]
2026-06-09 20:16     ` Thomas Gleixner
2026-06-09 20:23       ` Peter Zijlstra
2026-06-09 20:25       ` Peter Zijlstra
2026-06-09 20:32         ` 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=ailsiFU1Ul8j8qXG@gmail.com \
    --to=leitao@debian.org \
    --cc=andrealmeid@igalia.com \
    --cc=dave@stgolabs.net \
    --cc=dvhart@infradead.org \
    --cc=kernel-team@meta.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mingo@redhat.com \
    --cc=namhyung@kernel.org \
    --cc=peterz@infradead.org \
    --cc=puranjay@kernel.org \
    --cc=rmikey@meta.com \
    --cc=stuclar@meta.com \
    --cc=tglx@kernel.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.