From: "Vlastimil Babka (SUSE)" <vbabka@kernel.org>
To: David Rientjes <rientjes@google.com>,
Andrew Morton <akpm@linux-foundation.org>,
David Hildenbrand <david@kernel.org>
Cc: Christoph Lameter <cl@gentwo.org>,
Mathieu Desnoyers <mathieu.desnoyers@efficios.com>,
Sarthak Sharma <sarthak.sharma@arm.com>,
Johannes Weiner <hannes@cmpxchg.org>,
Suren Baghdasaryan <surenb@google.com>,
Brendan Jackman <brendan.jackman@linux.dev>,
Zi Yan <ziy@nvidia.com>, Harry Yoo <harry@kernel.org>,
Hao Li <hao.li@linux.dev>,
Roman Gushchin <roman.gushchin@linux.dev>,
linux-mm@kvack.org, linux-kernel@vger.kernel.org
Subject: Re: [patch v2 2/2] mm: slab_kunit: add synthetic benchmark for the slab allocator
Date: Wed, 2 Dec 2026 13:11:34 +0100 [thread overview]
Message-ID: <b53b0914-5c9a-4876-8a65-05f7c9436b7d@kernel.org> (raw)
In-Reply-To: <20261129212551.1812084-3-rientjes@google.com>
On 11/29/26 22:25, David Rientjes wrote:
> From: Christoph Lameter <cl@gentwo.org>
>
> Add a synthetic benchmark that can be used to measure performance of the
> slab allocator. This is used to analyze any improvements or regressions
> in kmalloc() and kfree(), which are used throughout the kernel in hot code
> paths.
>
> This is the third of three tests that measure the execution times of
> critical MM functions anticipated to be used by developers to measure the
> impact of any core changes that would end up causing workload performance
> issues. Google has carried these tests internally and kept them updated
> since Christoph posted them back in 2009 for this purpose.
>
> This can also be used to detect regressions over time, from kernel
> version to kernel version, independent of development use cases.
>
> The benchmark covers, for kmalloc object sizes that are powers of two:
>
> - allocating a batch of objects and then freeing them, from a single
> thread
> - allocating and immediately freeing an object, from a single thread
> - both of the above concurrently on all online CPUs
> - allocating objects on all CPUs but one and freeing them all from that
> one CPU (remote free)
> - allocating objects on one CPU while all other CPUs concurrently free
> them (1 alloc N free)
>
> Allocations use __GFP_NORETRY | __GFP_NOWARN so that the benchmark does not
> invoke the oom killer on small systems; if memory runs out, the results
> are reported for the objects that could be allocated.
>
> This is a performance benchmark and is complementary to the functional
> tests in lib/tests/slub_kunit.c.
>
> The test is run by KUnit or doing modprobe slab_kunit directly.
>
> Sample output (abbreviated):
> KTAP version 1
> 1..1
> KTAP version 1
> # Subtest: slab
> # module: slab_kunit
> 1..6
> # slab_test_kmalloc_then_kfree: size 8: 10000 ops: kmalloc -> 996 cycles (248 ns/op), kfree -> 449 cycles (111 ns/op)
> ...
> ok 1 slab_test_kmalloc_then_kfree
> # slab_test_kmalloc_kfree_pair: size 8: 10000 ops: kmalloc/kfree pair -> 832 cycles (206 ns/op)
> ...
> ok 2 slab_test_kmalloc_kfree_pair
> # slab_test_concurrent_kmalloc_then_kfree: size 8: 4 cpus, 40000 ops: kmalloc -> 951 cycles (236 ns/op), kfree -> 530 cycles (131 ns/op)
> ...
> ok 3 slab_test_concurrent_kmalloc_then_kfree
> # slab_test_concurrent_kmalloc_kfree_pair: size 8: 4 cpus, 40000 ops: kmalloc/kfree pair -> 1071 cycles (263 ns/op)
> ...
> ok 4 slab_test_concurrent_kmalloc_kfree_pair
> # slab_test_remote_free: size 8: 4 cpus, 30000 ops: kmalloc -> 1118 cycles (280 ns/op), remote kfree -> 420 cycles (103 ns/op)
> ...
> ok 5 slab_test_remote_free
> # slab_test_alloc_n_free: size 8: 4 cpus, 30000 ops: kmalloc -> 902 cycles (223 ns/op), remote wait+kfree -> 2705 cycles (665 ns/op)
> ...
> ok 6 slab_test_alloc_n_free
> # slab: pass:6 fail:0 skip:0 total:6
> # Totals: pass:6 fail:0 skip:0 total:6
> ok 1 slab
>
> Signed-off-by: Christoph Lameter <cl@gentwo.org>
> Signed-off-by: David Rientjes <rientjes@google.com>
In this case the co-developed-by should include Mathieu as well? And then
also S-o-b to be according to the rules?
...
> +
> +MODULE_LICENSE("GPL");
> +MODULE_AUTHOR("Christoph Lameter <cl@gentwo.org>");
> +MODULE_AUTHOR("Mathieu Desnoyers <mathieu.desnoyers@efficios.com>");
^ because this
> +MODULE_AUTHOR("David Rientjes <rientjes@google.com>");
> +MODULE_DESCRIPTION("KUnit benchmark test for the slab allocator");
next prev parent reply other threads:[~2026-12-02 12:11 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-11-29 21:25 [patch v2 0/2] mm: kunit: complete the 2009 mm test suite trifecta David Rientjes
2026-11-29 21:25 ` [patch v2 1/2] mm: page_alloc_kunit: add synthetic benchmark for the page allocator David Rientjes
2026-12-02 9:37 ` Vlastimil Babka (SUSE)
2026-11-29 21:25 ` [patch v2 2/2] mm: slab_kunit: add synthetic benchmark for the slab allocator David Rientjes
2026-12-02 12:11 ` Vlastimil Babka (SUSE) [this message]
2026-12-02 12:09 ` [patch v2 0/2] mm: kunit: complete the 2009 mm test suite trifecta Vlastimil Babka (SUSE)
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=b53b0914-5c9a-4876-8a65-05f7c9436b7d@kernel.org \
--to=vbabka@kernel.org \
--cc=akpm@linux-foundation.org \
--cc=brendan.jackman@linux.dev \
--cc=cl@gentwo.org \
--cc=david@kernel.org \
--cc=hannes@cmpxchg.org \
--cc=hao.li@linux.dev \
--cc=harry@kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mm@kvack.org \
--cc=mathieu.desnoyers@efficios.com \
--cc=rientjes@google.com \
--cc=roman.gushchin@linux.dev \
--cc=sarthak.sharma@arm.com \
--cc=surenb@google.com \
--cc=ziy@nvidia.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
all inboxes | Powered by JetHome®