From: Li Wang <liwang@redhat.com>
To: linux-kselftest@vger.kernel.org, linux-kernel@vger.kernel.org,
akpm@linux-foundation.org
Cc: Waiman Long <longman@redhat.com>,
Christoph Lameter <cl@linux.com>,
Johannes Weiner <hannes@cmpxchg.org>,
Michal Hocko <mhocko@kernel.org>,
Shakeel Butt <shakeelb@google.com>, Tejun Heo <tj@kernel.org>,
Vlastimil Babka <vbabka@suse.cz>
Subject: [PATCH 1/2] selftests/cgroup: Fix hardcoded page size in test_percpu_basic
Date: Fri, 6 Mar 2026 15:18:42 +0800 [thread overview]
Message-ID: <20260306071843.149147-1-liwang@redhat.com> (raw)
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
next reply other threads:[~2026-03-06 7:19 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-03-06 7:18 Li Wang [this message]
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
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=20260306071843.149147-1-liwang@redhat.com \
--to=liwang@redhat.com \
--cc=akpm@linux-foundation.org \
--cc=cl@linux.com \
--cc=hannes@cmpxchg.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-kselftest@vger.kernel.org \
--cc=longman@redhat.com \
--cc=mhocko@kernel.org \
--cc=shakeelb@google.com \
--cc=tj@kernel.org \
--cc=vbabka@suse.cz \
/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