]> www.infradead.org Git - users/jedix/linux-maple.git/commit
SLUB: Add support for per object memory policies
authorChristoph Lameter <cl@gentwo.org>
Tue, 1 Oct 2024 19:08:06 +0000 (12:08 -0700)
committerVlastimil Babka <vbabka@suse.cz>
Tue, 29 Oct 2024 09:43:53 +0000 (10:43 +0100)
commitf7c80fad6c2b64cf73361772dbd30493879e85f4
treed01eaa7cc320b722c72d1279f0ce636291b537c2
parent704573851b51808b45dae2d62059d1d8189138a2
SLUB: Add support for per object memory policies

The old SLAB allocator used to support memory policies on a per
allocation bases. In SLUB the memory policies are applied on a
per page frame / folio bases. Doing so avoids having to check memory
policies in critical code paths for kmalloc and friends.

This worked on general well on Intel/AMD/PowerPC because the
interconnect technology is mature and can minimize the latencies
through intelligent caching even if a small object is not
placed optimally.

However, on ARM we have an emergence of new NUMA interconnect
technology based more on embedded devices. Caching of remote content
can currently be ineffective using the standard building blocks / mesh
available on that platform. Such architectures benefit if each slab
object is individually placed according to memory policies
and other restrictions.

This patch adds another kernel parameter

    slab_strict_numa

If that is set then a static branch is activated that will cause
the hotpaths of the allocator to evaluate the current memory
allocation policy. Each object will be properly placed by
paying the price of extra processing and SLUB will no longer
defer to the page allocator to apply memory policies at the
folio level.

This patch improves performance of memcached running
on Ampere Altra 2P system (ARM Neoverse N1 processor)
by 3.6% due to accurate placement of small kernel objects.

Tested-by: Huang Shijie <shijie@os.amperecomputing.com>
Signed-off-by: Christoph Lameter (Ampere) <cl@gentwo.org>
Signed-off-by: Vlastimil Babka <vbabka@suse.cz>
Documentation/admin-guide/kernel-parameters.txt
Documentation/mm/slub.rst
mm/slub.c