public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH 1/2] selftests/cgroup: Fix hardcoded page size in test_percpu_basic
@ 2026-03-06  7:18 Li Wang
  2026-03-06  7:18 ` [PATCH 2/2] selftests/cgroup: include slab in test_percpu_basic memory check Li Wang
                   ` (2 more replies)
  0 siblings, 3 replies; 5+ messages in thread
From: Li Wang @ 2026-03-06  7:18 UTC (permalink / raw)
  To: linux-kselftest, linux-kernel, akpm
  Cc: Waiman Long, Christoph Lameter, Johannes Weiner, Michal Hocko,
	Shakeel Butt, Tejun Heo, Vlastimil Babka

MAX_VMSTAT_ERROR uses a hardcoded page size of 4096, which assumes
4K pages. This causes test_percpu_basic to fail on systems where
the kernel is configured with a larger page size, such as aarch64
systems using 16K or 64K pages, where the maximum permissible
discrepancy between memory.current and percpu charges is
proportionally larger.

Replace the hardcoded 4096 with sysconf(_SC_PAGESIZE) to correctly
derive the page size at runtime regardless of the underlying
architecture or kernel configuration.

Signed-off-by: Li Wang <liwang@redhat.com>
Cc: Waiman Long <longman@redhat.com>
Cc: Christoph Lameter <cl@linux.com>
Cc: Johannes Weiner <hannes@cmpxchg.org>
Cc: Michal Hocko <mhocko@kernel.org>
Cc: Shakeel Butt <shakeelb@google.com>
Cc: Tejun Heo <tj@kernel.org>
Cc: Vlastimil Babka <vbabka@suse.cz>
---
 tools/testing/selftests/cgroup/test_kmem.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/tools/testing/selftests/cgroup/test_kmem.c b/tools/testing/selftests/cgroup/test_kmem.c
index eeabd34bf083..249d79113067 100644
--- a/tools/testing/selftests/cgroup/test_kmem.c
+++ b/tools/testing/selftests/cgroup/test_kmem.c
@@ -24,7 +24,7 @@
  * the maximum discrepancy between charge and vmstat entries is number
  * of cpus multiplied by 64 pages.
  */
-#define MAX_VMSTAT_ERROR (4096 * 64 * get_nprocs())
+#define MAX_VMSTAT_ERROR (sysconf(_SC_PAGESIZE) * 64 * get_nprocs())
 
 #define KMEM_DEAD_WAIT_RETRIES        80
 
-- 
2.53.0


^ permalink raw reply related	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2026-04-02  6:46 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-03-06  7:18 [PATCH 1/2] selftests/cgroup: Fix hardcoded page size in test_percpu_basic Li Wang
2026-03-06  7:18 ` [PATCH 2/2] selftests/cgroup: include slab in test_percpu_basic memory check Li Wang
2026-03-19 19:38   ` Waiman Long
2026-03-19 19:37 ` [PATCH 1/2] selftests/cgroup: Fix hardcoded page size in test_percpu_basic Waiman Long
2026-04-02  6:46 ` Li Wang

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox