linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
From: David Laight <david.laight.linux@gmail.com>
To: Mateusz Guzik <mjguzik@gmail.com>
Cc: Vlastimil Babka <vbabka@suse.cz>,
	Lorenzo Stoakes <lorenzo.stoakes@oracle.com>,
	Andrew Morton <akpm@linux-foundation.org>,
	David Hildenbrand <david@kernel.org>,
	"Liam R . Howlett" <Liam.Howlett@oracle.com>,
	Mike Rapoport <rppt@kernel.org>,
	Suren Baghdasaryan <surenb@google.com>,
	Michal Hocko <mhocko@suse.com>,
	oliver.sang@intel.com, linux-mm@kvack.org,
	linux-kernel@vger.kernel.org
Subject: Re: [PATCH] mm: avoid use of BIT() macro for initialising VMA flags
Date: Fri, 12 Dec 2025 13:02:43 +0000	[thread overview]
Message-ID: <20251212130243.03538bc3@pumpkin> (raw)
In-Reply-To: <CAGudoHHFeuEQ0kBYfrYuUPxNQdw4YHNG81JiHPFHq0evUcEczw@mail.gmail.com>

On Fri, 12 Dec 2025 13:24:57 +0100
Mateusz Guzik <mjguzik@gmail.com> wrote:

> So I had a look where the timing difference is coming from and I think
> I have the answer: init_ipc_ns does not have a guaranteed cacheline
> placement and things get moved around with the patch.
> 
> On my kernels (nm vmlinux-newbits | sort -nk 1 | less)
> 
> before:
> ffffffff839ffb60 T init_ipc_ns
> ffffffff83a00020 t event_exit__msgrcv
> 
> after:
> ffffffff839ffbc0 T init_ipc_ns
> ffffffff83a00080 t event_exit__msgrcv
> 
> This is the pervasive problem of vars from all .o files placed
> adjacent to each other, meaning changes in one .o file result in
> offsets changing in other files and then you get performance
> fluctuations as not-explicitly-padded variables share (or no longer
> share) cachelines.

Those look like text symbols, not data ones.
But moving code about can make the same sort of changes.

> I brought this up a year ago elsewhere:
> https://gcc.gnu.org/pipermail/gcc/2024-October/245004.html

My guess is that all the extra padding increases the cache footprint
of the code and that causes other cache lines to displaced and then
needing to be re-read from memory.
So while a specific benchmark may improve, overall system performance
goes down.

Excessive loop unrolling has the same effect.

	David

> 
> maybe i should pick it up again and see it through
> 
> as for the thing at hand, someone(tm) will want to make sure the
> namespace is cacheline aligned and possibly pad its own internals
> afterwards. Personally I can't be bothered.



  reply	other threads:[~2025-12-12 13:02 UTC|newest]

Thread overview: 30+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-12-05 17:50 Lorenzo Stoakes
2025-12-05 17:52 ` Lorenzo Stoakes
2025-12-05 18:43 ` David Laight
2025-12-05 19:18   ` Lorenzo Stoakes
2025-12-05 21:34     ` David Laight
2025-12-06 16:43       ` Lorenzo Stoakes
2025-12-08 16:42         ` Lorenzo Stoakes
2025-12-08 18:57           ` David Laight
2025-12-09  8:28           ` Vlastimil Babka
2025-12-09  9:26             ` Mateusz Guzik
2025-12-10 16:18               ` Lorenzo Stoakes
2025-12-10 22:44                 ` Mateusz Guzik
2025-12-12 12:24               ` Mateusz Guzik
2025-12-12 13:02                 ` David Laight [this message]
2025-12-12 13:13                   ` Mateusz Guzik
2025-12-12 15:03                 ` Lorenzo Stoakes
2025-12-12 17:26                   ` Mateusz Guzik
2025-12-05 21:49     ` David Laight
2025-12-06 16:47       ` Lorenzo Stoakes
2025-12-05 19:56 ` John Hubbard
2025-12-06 16:42   ` Lorenzo Stoakes
2025-12-05 20:15 ` Andrew Morton
2025-12-05 20:18   ` David Hildenbrand (Red Hat)
2025-12-06  0:40   ` Stephen Rothwell
2025-12-06  3:12     ` Andrew Morton
2025-12-06 16:35       ` Lorenzo Stoakes
2025-12-06  1:14 ` Al Viro
2025-12-06  1:26   ` Al Viro
2025-12-06 12:35     ` Vlastimil Babka
2025-12-06 16:34       ` Lorenzo Stoakes

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=20251212130243.03538bc3@pumpkin \
    --to=david.laight.linux@gmail.com \
    --cc=Liam.Howlett@oracle.com \
    --cc=akpm@linux-foundation.org \
    --cc=david@kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mm@kvack.org \
    --cc=lorenzo.stoakes@oracle.com \
    --cc=mhocko@suse.com \
    --cc=mjguzik@gmail.com \
    --cc=oliver.sang@intel.com \
    --cc=rppt@kernel.org \
    --cc=surenb@google.com \
    --cc=vbabka@suse.cz \
    /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