From: Sebastian Andrzej Siewior <bigeasy@linutronix.de>
To: Tejun Heo <tj@kernel.org>
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 20:32:57 +0200 [thread overview]
Message-ID: <20250611183257.luuJewNy@linutronix.de> (raw)
In-Reply-To: <aEnAyvLDiX1fUS6I@slm.duckdns.org>
On 2025-06-11 07:45:46 [-1000], Tejun Heo wrote:
> On Wed, Jun 11, 2025 at 06:18:49PM +0200, Sebastian Andrzej Siewior wrote:
> > PERCPU_MODULE_RESERVE defines the maximum size that can by used for the
> > per-CPU data size used by modules. This is 8KiB.
> >
> > Commit 035fcdc4d240c ("openvswitch: Merge three per-CPU structures into
> > one") restructured the per-CPU memory allocation for openvswitch and
> > moved the separate alloc_percpu() invocations at module init time to a
> > static per-CPU variable which is allocated by the module loader.
> >
> > The size of the per-CPU data section for openvswitch is 6488 bytes which
> > is ~80% of the available per-CPU memory. Together with a few other
> > modules it is easy to exhaust the available 8KiB of memory.
> >
> > The memory range for the per-CPU memory is allocated early and pages for
> > its backing are only allocated once the per-CPU memory is allocated.
> > Increasing the map from 8 to 16 KiB adds 256 bytes to the alloc_map and
> > bound_map and 64 bytes to md_blocks (576 bytes in total).
> >
> > Increase the available memory for module's per-CPU data section to
> > 16KiB.
>
> I think a better direction would be keeping using alloc_percpu(). There
> aren't a lot of benefits to using static definitions compared to dynamic
> ones and making it larger increases overhead for everyone.
I could avoid initialising per-CPU locks because of the static build
time init and avoid the alloc_percpu() at module init. I can access
members of the struct avoid one pointer dereference. All this for 576
bytes.
> Thanks.
Sebastian
next prev parent reply other threads:[~2025-06-11 18:33 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 [this message]
2025-06-11 18:37 ` Tejun Heo
2025-06-11 19:06 ` Sebastian Andrzej Siewior
2025-06-11 20:35 ` Tejun Heo
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=20250611183257.luuJewNy@linutronix.de \
--to=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 \
--cc=tj@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 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).