On Wed, Apr 1, 2026 at 11:38 PM 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/4 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. > > Fix this by: > - Always allocating 1024 pages regardless of page size. This ensures > enough anonymous pages to reliably populate zswap and trigger > writeback, while keeping the original 4M allocation on 4K systems. > - Setting zswap.max to zswap_usage/4 instead of zswap_usage/2 to > create stronger writeback pressure, ensuring reclaim reliably > triggers writeback even on large page size systems.
Makes sense to me. We should scale the test by PAGE_SIZE. Acked-by: Nhat Pham <[email protected]>

