linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
From: Michael Matz <matz@suse.de>
To: Lorenzo Stoakes <lorenzo.stoakes@oracle.com>
Cc: Vlastimil Babka <vbabka@suse.cz>,
	 Andrew Morton <akpm@linux-foundation.org>,
	 "Liam R. Howlett" <Liam.Howlett@oracle.com>,
	Jann Horn <jannh@google.com>,
	 Thorsten Leemhuis <regressions@leemhuis.info>,
	linux-mm@kvack.org,  linux-kernel@vger.kernel.org,
	Petr Tesarik <ptesarik@suse.com>,
	 Gabriel Krisman Bertazi <gabriel@krisman.be>,
	 Matthias Bodenbinder <matthias@bodenbinder.de>,
	stable@vger.kernel.org,  Rik van Riel <riel@surriel.com>,
	Yang Shi <yang@os.amperecomputing.com>
Subject: Re: [PATCH hotfix 6.12] mm, mmap: limit THP aligment of anonymous mappings to PMD-aligned sizes
Date: Mon, 28 Oct 2024 14:45:01 +0100 (CET)	[thread overview]
Message-ID: <fe231f2d-fcb1-05c9-49c3-405c533a0200@suse.de> (raw)
In-Reply-To: <2b89811b-5957-4fad-8979-86744678d296@lucifer.local>

Hello,

On Thu, 24 Oct 2024, Lorenzo Stoakes wrote:

> > benchmark seems to create many mappings of 4632kB, which would have
> > merged to a large THP-backed area before commit efa7df3e3bb5 and now
> > they are fragmented to multiple areas each aligned to PMD boundary with
> > gaps between. The regression then seems to be caused mainly due to the
> > benchmark's memory access pattern suffering from TLB or cache aliasing
> > due to the aligned boundaries of the individual areas.
> 
> Any more details on precisely why?

Anything we found out and theorized about is in the suse bugreport.  I 
think the best theory is TLB aliasing when the mixing^Whash function in 
the given hardware uses too few bits, and most of them in the low 21-12 
bits of an address.  Of course that then still depends on the particular 
access pattern.  cactuBSSN has about 20 memory streams in the hot loops, 
and the accesses are fairly regular from step to step (plus/minus certain 
strides in 3D arrays).  When their start addresses all differ only in the 
upper bits, you will hit TLB aliasing from time to time, and when the 
dimensions/strides are just right it occurs often, the N-way associativity 
doesn't save you anymore and you will hit it very very hard.

It was interesting to see how broad the range of CPUs and vendors was that 
exhibited the problem (in various degrees of severity, from 50% to 600% 
slowdown), and how more recent CPUs don't show the symptom anymore.  I 
guess the micro-arch guys eventually convinced P&R management that hashing 
another bit or two is worthwhile the silicon :-)


Ciao,
Michael.


  parent reply	other threads:[~2024-10-28 13:45 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-10-24  7:45 darktable performance regression on AMD systems caused by "mm: align larger anonymous mappings on THP boundaries" Thorsten Leemhuis
2024-10-24  9:58 ` Vlastimil Babka
2024-10-24 10:23   ` Vlastimil Babka
2024-10-24 10:49     ` Petr Tesarik
2024-10-24 10:56       ` Vlastimil Babka
2024-10-24 11:13         ` Petr Tesarik
2024-10-24 13:29           ` Vlastimil Babka
2024-10-24 14:14             ` Petr Tesarik
2024-10-24 11:20     ` Matthias Bodenbinder
2024-10-24 15:12 ` [PATCH hotfix 6.12] mm, mmap: limit THP aligment of anonymous mappings to PMD-aligned sizes Vlastimil Babka
2024-10-24 15:47   ` Lorenzo Stoakes
2024-10-24 16:00     ` Lorenzo Stoakes
2024-10-24 16:04     ` Vlastimil Babka
2024-10-24 16:17       ` Lorenzo Stoakes
2024-10-28 13:45     ` Michael Matz [this message]
2024-10-24 18:32   ` Yang Shi

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=fe231f2d-fcb1-05c9-49c3-405c533a0200@suse.de \
    --to=matz@suse.de \
    --cc=Liam.Howlett@oracle.com \
    --cc=akpm@linux-foundation.org \
    --cc=gabriel@krisman.be \
    --cc=jannh@google.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mm@kvack.org \
    --cc=lorenzo.stoakes@oracle.com \
    --cc=matthias@bodenbinder.de \
    --cc=ptesarik@suse.com \
    --cc=regressions@leemhuis.info \
    --cc=riel@surriel.com \
    --cc=stable@vger.kernel.org \
    --cc=vbabka@suse.cz \
    --cc=yang@os.amperecomputing.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