Re: [PATCH v2 6/7] selftests/cgroup: replace hardcoded page size values in test_zswap
From: Li Wang
Date: Thu Mar 12 2026 - 22:02:16 EST
On Thu, Mar 12, 2026 at 03:44:09PM -0700, Yosry Ahmed wrote:
> On Wed, Mar 11, 2026 at 9:07 PM Li Wang <liwang@xxxxxxxxxx> wrote:
> >
> > test_zswap uses hardcoded values of 4095 and 4096 throughout as page
> > stride and page size, which are only correct on systems with a 4K page
> > size. On architectures with larger pages (e.g., 64K on arm64 or ppc64),
> > these constants cause memory to be touched at sub-page granularity,
> > leading to inefficient access patterns and incorrect page count
> > calculations, which can cause test failures.
> >
> > Replace all hardcoded 4095 and 4096 values with a global pagesize
> > variable initialized from sysconf(_SC_PAGESIZE) at startup, and remove
> > the redundant local sysconf() calls scattered across individual
> > functions. No functional change on 4K page size systems.
> >
> > Signed-off-by: Li Wang <liwang@xxxxxxxxxx>
> > Cc: Johannes Weiner <hannes@xxxxxxxxxxx>
> > Cc: Michal Hocko <mhocko@xxxxxxxxxx>
> > Cc: Michal Koutný <mkoutny@xxxxxxxx>
> > Cc: Muchun Song <muchun.song@xxxxxxxxx>
> > Cc: Nhat Pham <nphamcs@xxxxxxxxx>
> > Cc: Tejun Heo <tj@xxxxxxxxxx>
> > Cc: Roman Gushchin <roman.gushchin@xxxxxxxxx>
> > Cc: Shakeel Butt <shakeel.butt@xxxxxxxxx>
> > Cc: Yosry Ahmed <yosryahmed@xxxxxxxxxx>
>
> It makes more sense to have this patch first, replacing all hardcoded
> values, then patch 5 doing the necessary changes on top.
Make sense.
--
Regards,
Li Wang