linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
From: Andrew Morton <akpm@linux-foundation.org>
To: zenghongling <zenghongling@kylinos.cn>
Cc: dennis@kernel.org, tj@kernel.org, cl@gentwo.org,
	linux-mm@kvack.org, zhongling0719@126.com
Subject: Re: [PATCH] mm/percpu-internal.h: optimise pcpu_chunk_struct to save memory
Date: Thu, 26 Mar 2026 22:16:41 -0700	[thread overview]
Message-ID: <20260326221641.7a2edff04ebb51561c8818e4@linux-foundation.org> (raw)
In-Reply-To: <20260305073043.571691-1-zenghongling@kylinos.cn>

On Thu,  5 Mar 2026 15:30:43 +0800 zenghongling <zenghongling@kylinos.cn> wrote:

> Subject: [PATCH] mm/percpu-internal.h: optimise pcpu_chunk_struct to save memory

There is no pcpu_chunk_struct,  I'll change this to "struct pcpu_chunk".

> Date: Thu,  5 Mar 2026 15:30:43 +0800
> Sender: owner-linux-mm@kvack.org
> X-Mailer: git-send-email 2.25.1
> 
> The pcpu_chunk_struct has a hole of 4 bytes and pushes the struct to three
> cachelines.  Relocating the three booleans upwards allows for the struct
> to only use two cachelines.

before:

(gdb) p sizeof(struct pcpu_chunk)
$2 = 256

after:

(gdb) p sizeof(struct pcpu_chunk)
$1 = 192

That's remarkable.  It was an allmodconfig build which tends to add
bloat, but the only source-level alteration was this patch.


Another consideration here is that moving members around can have a
performance impact - it can cause more (or less) cacheline
invalidations.  I worry that because someone has carefully commented
all the member offsets, this might have been a consideration.

Also I think your patch may have made those comments incorrect?


Dennis, Tejun, Christoph: I think we want this space saving.  Can
you please advise?

Thanks.


  reply	other threads:[~2026-03-27  5:16 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-03-05  7:30 zenghongling
2026-03-27  5:16 ` Andrew Morton [this message]
2026-03-27  7:08   ` dd
2026-03-27  7:32   ` Dennis Zhou
  -- strict thread matches above, loose matches on Subject: below --
2026-03-05  7:26 zenghongling

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=20260326221641.7a2edff04ebb51561c8818e4@linux-foundation.org \
    --to=akpm@linux-foundation.org \
    --cc=cl@gentwo.org \
    --cc=dennis@kernel.org \
    --cc=linux-mm@kvack.org \
    --cc=tj@kernel.org \
    --cc=zenghongling@kylinos.cn \
    --cc=zhongling0719@126.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