From: Tejun Heo <tj@kernel.org>
To: Sebastian Andrzej Siewior <bigeasy@linutronix.de>
Cc: linux-mm@kvack.org, Dennis Zhou <dennis@kernel.org>,
Christoph Lameter <cl@gentwo.org>, Gal Pressman <gal@nvidia.com>,
Peter Zijlstra <peterz@infradead.org>,
Thomas Gleixner <tglx@linutronix.de>
Subject: Re: [PATCH] mm: percpu: Increase PERCPU_MODULE_RESERVE
Date: Wed, 11 Jun 2025 10:35:27 -1000 [thread overview]
Message-ID: <aEnoj0rUWZz3oZ0T@slm.duckdns.org> (raw)
In-Reply-To: <20250611190642.UHcmUwVg@linutronix.de>
On Wed, Jun 11, 2025 at 09:06:42PM +0200, Sebastian Andrzej Siewior wrote:
> On 2025-06-11 08:37:13 [-1000], Tejun Heo wrote:
> > Yeah but for that, you're making all machines that run the kernel to waste
> > two more pages per CPU. Modern machines are big and the overhead quickly
> > gets into megs. Sure, it's not a huge amount of memory but it's going to be
> > memory that almost nobody uses, relatively speaking, which just sits there
> > and gets wasted.
>
> Not sure I waste two pages waste because the memory is allocated once
> used.
The reserve percpu pages need to be allocated on every machine and most
machines wouldn't be using openvswitch, right?
> Anyway, let me redo it to the dynamic allocation then. The memory of the
> single module is quite huge. I looked at the per-CPU allocation of all
> modules built with a Debian config on x86-64 and (ignoring alignment and
> the openvswitch module) it was below 4KiB…
Yeah, the percpu module static reserve is intended for things like
individual pointers or counters, not big structs. The limitation comes from
how the reserve area is implemented. Because of the addressing limitations,
it has to be close to the built-in percpu static area and it's beneficial to
put the built-in area in address area that's covered by huge pages, so we
can't really sparse map them. So, the end result is not the greatest -
modules can only use small static percpu memory areas.
Maybe it'd be better to outright require all percpu areas to be dynamically
allocated for modules but that seems unnecessarily draconian if you need
like a couple counters, so this is where we ended up.
Thanks.
--
tejun
prev parent reply other threads:[~2025-06-11 20:35 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-06-11 16:18 [PATCH] mm: percpu: Increase PERCPU_MODULE_RESERVE Sebastian Andrzej Siewior
2025-06-11 17:45 ` Tejun Heo
2025-06-11 18:32 ` Sebastian Andrzej Siewior
2025-06-11 18:37 ` Tejun Heo
2025-06-11 19:06 ` Sebastian Andrzej Siewior
2025-06-11 20:35 ` Tejun Heo [this message]
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=aEnoj0rUWZz3oZ0T@slm.duckdns.org \
--to=tj@kernel.org \
--cc=bigeasy@linutronix.de \
--cc=cl@gentwo.org \
--cc=dennis@kernel.org \
--cc=gal@nvidia.com \
--cc=linux-mm@kvack.org \
--cc=peterz@infradead.org \
--cc=tglx@linutronix.de \
/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;
as well as URLs for NNTP newsgroup(s).