On Wed, Mar 11, 2026 at 11:58:34AM -0700, Yosry Ahmed wrote: > On Wed, Mar 11, 2026 at 4:06 AM Li Wang <[email protected]> wrote: > > > > In attempt_writeback(), a memsize of 4M only covers 64 pages on 64K > > page size systems. When memory.reclaim is called, the kernel prefers > > reclaiming clean file pages (binary, libc, linker, etc.) over swapping > > anonymous pages. With only 64 pages of anonymous memory, the reclaim > > target can be largely or entirely satisfied by dropping file pages, > > resulting in very few or zero anonymous pages being pushed into zswap. > > > > This causes zswap_usage to be extremely small or zero, making > > zswap_usage/2 insufficient to create meaningful writeback pressure. > > The test then fails because no writeback is triggered. > > > > On 4K page size systems this is not an issue because 4M covers 1024 > > pages, and file pages are a small fraction of the reclaim target. > > > > Scale memsize up to 64M on systems with page size larger than 4K, so > > that enough anonymous pages are allocated to reliably populate zswap > > and trigger writeback. The original 4M is kept for 4K page size systems > > to avoid unnecessary memory usage and test runtime. > > > > === Error Log === > > # uname -rm > > 6.12.0-211.el10.ppc64le ppc64le > > > > # getconf PAGESIZE > > 65536 > > > > # ./test_zswap > > TAP version 13 > > 1..7 > > ok 1 test_zswap_usage > > ok 2 test_swapin_nozswap > > ok 3 test_zswapin > > not ok 4 test_zswap_writeback_enabled > > ... > > > > Signed-off-by: Li Wang <[email protected]> > > Cc: Johannes Weiner <[email protected]> > > Cc: Michal Hocko <[email protected]> > > Cc: Michal Koutný <[email protected]> > > Cc: Muchun Song <[email protected]> > > Cc: Nhat Pham <[email protected]> > > Cc: Tejun Heo <[email protected]> > > Cc: Roman Gushchin <[email protected]> > > Cc: Shakeel Butt <[email protected]> > > Cc: Yosry Ahmed <[email protected]> > > --- > > tools/testing/selftests/cgroup/test_zswap.c | 2 +- > > 1 file changed, 1 insertion(+), 1 deletion(-) > > > > diff --git a/tools/testing/selftests/cgroup/test_zswap.c > > b/tools/testing/selftests/cgroup/test_zswap.c > > index 30d3fbf6b4fb..2d065184eea4 100644 > > --- a/tools/testing/selftests/cgroup/test_zswap.c > > +++ b/tools/testing/selftests/cgroup/test_zswap.c > > @@ -264,7 +264,7 @@ static int test_zswapin(const char *root) > > static int attempt_writeback(const char *cgroup, void *arg) > > { > > long pagesize = sysconf(_SC_PAGESIZE); > > - size_t memsize = MB(4); > > + size_t memsize = pagesize > 4096 ? MB(64): MB(4); > > pagesize << 10 or pagesize * 1024?
Sure, I will go pagesize * 1024 which clearly shows the numbers of page. -- Regards, Li Wang

