* + lib-add-kunit-boundary-tests-for-percpu_counter_tree-comparisons-fix.patch added to mm-unstable branch
@ 2026-03-17 17:12 Andrew Morton
0 siblings, 0 replies; only message in thread
From: Andrew Morton @ 2026-03-17 17:12 UTC (permalink / raw)
To: mm-commits, mathieu.desnoyers, broonie, devnexen, akpm
The patch titled
Subject: lib: skip percpu_counter_tree boundary kunit tests on single-CPU
has been added to the -mm mm-unstable branch. Its filename is
lib-add-kunit-boundary-tests-for-percpu_counter_tree-comparisons-fix.patch
This patch will shortly appear at
https://git.kernel.org/pub/scm/linux/kernel/git/akpm/25-new.git/tree/patches/lib-add-kunit-boundary-tests-for-percpu_counter_tree-comparisons-fix.patch
This patch will later appear in the mm-unstable branch at
git://git.kernel.org/pub/scm/linux/kernel/git/akpm/mm
Before you just go and hit "reply", please:
a) Consider who else should be cc'ed
b) Prefer to cc a suitable mailing list as well
c) Ideally: find the original patch on the mailing list and do a
reply-to-all to that, adding suitable additional cc's
*** Remember to use Documentation/process/submit-checklist.rst when testing your code ***
The -mm tree is included into linux-next via various
branches at git://git.kernel.org/pub/scm/linux/kernel/git/akpm/mm
and is updated there most days
------------------------------------------------------
From: David Carlier <devnexen@gmail.com>
Subject: lib: skip percpu_counter_tree boundary kunit tests on single-CPU
Date: Tue, 17 Mar 2026 15:39:15 +0000
On single-CPU topologies, accuracy_multiplier is zero, making both
approx_accuracy_range.under and .over zero. The boundary tests in
hpcc_test_compare_value_boundaries and
hpcc_test_compare_counter_boundaries then degenerate to comparing 0 vs 0,
which correctly returns 0 (equal) but the tests expect nonzero results.
Skip these boundary tests with kunit_skip() when accuracy is zero, since
approximation boundaries are meaningless without multi-CPU carry
propagation. Use percpu_counter_tree_items_size() as the topology check
before any allocations to avoid leaking memory on skip.
Link: https://lkml.kernel.org/r/20260317153915.43559-1-devnexen@gmail.com
Signed-off-by: David Carlier <devnexen@gmail.com>
Reviewed-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
Reviewed-by: Mark Brown <broonie@kernel.org>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
---
lib/tests/percpu_counter_tree_kunit.c | 6 ++++++
1 file changed, 6 insertions(+)
--- a/lib/tests/percpu_counter_tree_kunit.c~lib-add-kunit-boundary-tests-for-percpu_counter_tree-comparisons-fix
+++ a/lib/tests/percpu_counter_tree_kunit.c
@@ -93,6 +93,9 @@ static void hpcc_test_compare_value_boun
unsigned long under = 0, over = 0;
int ret;
+ if (!percpu_counter_tree_items_size())
+ kunit_skip(test, "no approximation accuracy on single-CPU topology");
+
counter_items = kzalloc(percpu_counter_tree_items_size(), GFP_KERNEL);
KUNIT_ASSERT_PTR_NE(test, counter_items, NULL);
ret = percpu_counter_tree_init(&pct, counter_items, 32, GFP_KERNEL);
@@ -197,6 +200,9 @@ static void hpcc_test_compare_counter_bo
unsigned long combined;
int ret;
+ if (!percpu_counter_tree_items_size())
+ kunit_skip(test, "no approximation accuracy on single-CPU topology");
+
counter_items = kzalloc(percpu_counter_tree_items_size() * 2,
GFP_KERNEL);
KUNIT_ASSERT_PTR_NE(test, counter_items, NULL);
_
Patches currently in -mm which might be from devnexen@gmail.com are
lib-introduce-hierarchical-per-cpu-counters-fix.patch
lib-add-kunit-boundary-tests-for-percpu_counter_tree-comparisons.patch
lib-add-kunit-boundary-tests-for-percpu_counter_tree-comparisons-fix.patch
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2026-03-17 17:12 UTC | newest]
Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-03-17 17:12 + lib-add-kunit-boundary-tests-for-percpu_counter_tree-comparisons-fix.patch added to mm-unstable branch Andrew Morton
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.