From nobody Mon Apr 6 10:43:23 2026 Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id D610736C0CF for ; Sun, 22 Mar 2026 06:11:49 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=170.10.133.124 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1774159911; cv=none; b=OAB61Sv8/YcLsFfM0SblWakuP3IgtuVXgY2Du2AEpt9Sz4MfedYy/5Dqy/f48LWjKHKRQgGDm5azxC/IDYnX34jMm2lYYf3mSO+XStVIEiAf28mZeGYe0y21mqZSPeaU8kRF2C4t6kWpnqeFXA1tTBrNiYt+qVbAPF+TvZFCX18= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1774159911; c=relaxed/simple; bh=fBwQcNCGckBbW5StnisPOyP/m96IC/Xzo0HrgVS5BoU=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=mQYChhfeIVdOm0ybTKEdYvgCKDjrRyoUhEzQS+bwDyC6K+mpZJ9rVbnFDbqG9c2LW5yWnObpa/9wnx2fxRsMXi08NGVl8hnCkcB/Ha1J10q4b63n0JbICK0AFmBBa7QuVUh1K7sgCn+3AHL+QnCDCXaP2XXJFiyQ8FLVh6vIfps= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=redhat.com; spf=pass smtp.mailfrom=redhat.com; dkim=pass (1024-bit key) header.d=redhat.com header.i=@redhat.com header.b=U2hBDHk9; arc=none smtp.client-ip=170.10.133.124 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=redhat.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=redhat.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=redhat.com header.i=@redhat.com header.b="U2hBDHk9" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1774159908; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=lu5jwEEecEkDiX7ux2A/sS85AyKDVmY0PIrDjssqoFY=; b=U2hBDHk9OqCRi1Cuyb4WEwCxuRbJyRk4TovFJwtBzwd9AIBMSc4MFRbiFqLDKfFrTfB5hM H08sIFI48jKHtzovad3gTjFD1qwVRNVWDNf0CSRS3nxhfOObEqwL7ax5kBS+A2sSa5jZEx cyIX9Hy6SRJ++PW66JL6ArJum6M90VM= Received: from mx-prod-mc-08.mail-002.prod.us-west-2.aws.redhat.com (ec2-35-165-154-97.us-west-2.compute.amazonaws.com [35.165.154.97]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-524-CPQcHYE-NIm0Lz_NxNd6ow-1; Sun, 22 Mar 2026 02:11:42 -0400 X-MC-Unique: CPQcHYE-NIm0Lz_NxNd6ow-1 X-Mimecast-MFC-AGG-ID: CPQcHYE-NIm0Lz_NxNd6ow_1774159900 Received: from mx-prod-int-03.mail-002.prod.us-west-2.aws.redhat.com (mx-prod-int-03.mail-002.prod.us-west-2.aws.redhat.com [10.30.177.12]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by mx-prod-mc-08.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTPS id 55590180044D; Sun, 22 Mar 2026 06:11:40 +0000 (UTC) Received: from fedora-laptop-x1.redhat.com (unknown [10.72.112.34]) by mx-prod-int-03.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTPS id 10C271955F21; Sun, 22 Mar 2026 06:11:33 +0000 (UTC) From: Li Wang To: akpm@linux-foundation.org, yosry@kernel.org, yosryahmed@google.com, nphamcs@gmail.com, hannes@cmpxchg.org, mhocko@kernel.org, mkoutny@suse.com, muchun.song@linux.dev, tj@kernel.org, roman.gushchin@linux.dev, shakeel.butt@linux.dev Cc: longman@redhat.com, liwang@redhat.com, linux-kselftest@vger.kernel.org, linux-kernel@vger.kernel.org, linux-mm@kvack.org Subject: [PATCH v4 7/7] selftest/cgroup: fix zswap attempt_writeback() on 64K pagesize system Date: Sun, 22 Mar 2026 14:10:38 +0800 Message-ID: <20260322061038.156146-8-liwang@redhat.com> In-Reply-To: <20260322061038.156146-1-liwang@redhat.com> References: <20260322061038.156146-1-liwang@redhat.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-Scanned-By: MIMEDefang 3.0 on 10.30.177.12 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. 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 page size systems. =3D=3D=3D Error Log =3D=3D=3D # 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 Cc: Johannes Weiner Cc: Michal Hocko Cc: Michal Koutn=C3=BD Cc: Muchun Song Cc: Nhat Pham Cc: Tejun Heo Cc: Roman Gushchin Cc: Shakeel Butt Acked-by: Yosry Ahmed --- Notes: v4, v3: - No changes. v2: - use pagesize * 1024 which clearly shows the page numbers. 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/se= lftests/cgroup/test_zswap.c index ec7f0bd515e1..107b20db2fec 100644 --- a/tools/testing/selftests/cgroup/test_zswap.c +++ b/tools/testing/selftests/cgroup/test_zswap.c @@ -269,7 +269,7 @@ static int test_zswapin(const char *root) */ static int attempt_writeback(const char *cgroup, void *arg) { - size_t memsize =3D MB(4); + size_t memsize =3D pagesize * 1024; char buf[pagesize]; long zswap_usage; bool wb_enabled =3D *(bool *) arg; --=20 2.53.0