From mboxrd@z Thu Jan 1 00:00:00 1970 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 F106F37C93A for ; Mon, 13 Apr 2026 08:46:36 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=pass smtp.client-ip=170.10.133.124 ARC-Seal:i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1776069998; cv=pass; b=s3w/O9YEdpl5gQSsj+rvo6VvSvOLg3vZXn7KXjrq27leN/sBAfl8iEJGxMxO7lviwK5HUQBssNaByA/LZVUuwwZXrxgDlyy+UP55YHevNNtgQCyjSX/F1fxhv+NXxZtMgy17u7QCRLRULInLe+yTJENR2fdk/pgB1DEj5ZuY5Pw= ARC-Message-Signature:i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1776069998; c=relaxed/simple; bh=51K1dSOwx77FUDK5PTj+zi2/Idf/3F0Kn/F+IWkeRRM=; h=MIME-Version:References:In-Reply-To:From:Date:Message-ID:Subject: To:Cc:Content-Type; b=U5e7u0qUTqMauoqdwOgXaJuJ3ItIvTSCHvp0JcSoS9mhVzr0fIgYIm3VtZZKrg8mFDGzC9HPUx5Aw3KKkvBTmm0FsCnTQOpU72sg/Y2fpWTfC2o8inagRC+BfmTPhBwuP27NLAO9gOmZqdNTjneo36N+09gaLA3wOgT4b1w+sDY= ARC-Authentication-Results:i=2; 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=OlifcbZO; dkim=pass (2048-bit key) header.d=redhat.com header.i=@redhat.com header.b=ic7fnvAq; arc=pass 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="OlifcbZO"; dkim=pass (2048-bit key) header.d=redhat.com header.i=@redhat.com header.b="ic7fnvAq" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1776069996; 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=o0213UnEMOod9W6HJe+rSGORixl1p8NPdPniRuWrrH0=; b=OlifcbZO55P92m2QNBhlREE7cdhfVlEyap8L8UH5wJmax9qb7i9wfqDSUg3qWAjHl//4st TDrP2cnN5ubzeh7JsqkjNyon7soBpe0J3d82YptTU14jGasnJnQX5cfwAKIi5xuC2kJ8MM WQxInbVsxYSNhgMHcBasGFBXWTkl8wc= Received: from mail-dy1-f198.google.com (mail-dy1-f198.google.com [74.125.82.198]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-582-fdSERBYLMy-wKEWYAIqImg-1; Mon, 13 Apr 2026 04:46:34 -0400 X-MC-Unique: fdSERBYLMy-wKEWYAIqImg-1 X-Mimecast-MFC-AGG-ID: fdSERBYLMy-wKEWYAIqImg_1776069994 Received: by mail-dy1-f198.google.com with SMTP id 5a478bee46e88-2bdf75bc88fso5873602eec.0 for ; Mon, 13 Apr 2026 01:46:34 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1776069993; cv=none; d=google.com; s=arc-20240605; b=aEn8MdslP3pXRwVRsp/9n9Q5wde6XJbOU4w9BCssi/zeeIV76DOl1oXu8e9g+i6LbJ oYGUhqF0d+Z4cBvQnloIzOOiXRRUn6jwwMfAhymUetPWyqzWujChytnnYJugZuo2426D Y/i0tqYY3fGfuZ8XDf8T1lalDEhNa/Dp1cpTXA+QeyCyygYJkRSIW6YhOxUVI4BR9C22 PIRzEJrwa8OnUMPIRQNgucor3IfKu2lKEs/Rb+mtc3Y27BV6jO5OeUPIfSdyoxKxAZxk /1EgBo/2xWmg9M7bwV8ciU9zX3jc9T9pYo8DEg+TlHxMGlFAvq1EDIhuV0MLqsW1htWS L8nw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20240605; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:dkim-signature; bh=o0213UnEMOod9W6HJe+rSGORixl1p8NPdPniRuWrrH0=; fh=XpBWp26tE+4laSOB2BMppVxLFi+zTaZFMb+z0gltJe0=; b=DhAxgYlR9RhA6y74XiK2SreStriwdn8/2d/R7A/A4rffzAon7+bmzfnxUFcOg0HWhB gaGnbU2BaDgo5JMySx5uZa5h6HH2QmEczn1y+isra83BR6BaDWDCji2UaBsfylAkVDzT r7uBpcvcheTJFRUTlX/Xzjw4iKbFyeft9owIWgGlUdAdDr8dq/M9PhgzlKJy37PRnERw 13hjMFFmlHt45wJDoKs7oIoYv95hkAc9jE3gfEuz9gp6cjM2TT64+B195E6FC5JfY/yS A7WXqk8pQdTmqPdPQtKuk02gNITRrOkUGlAw0nZcVaG7t+8PK45nHCmet3YgWnK3hAqz AfdA==; darn=vger.kernel.org ARC-Authentication-Results: i=1; mx.google.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=google; t=1776069993; x=1776674793; darn=vger.kernel.org; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:from:to:cc:subject:date :message-id:reply-to; bh=o0213UnEMOod9W6HJe+rSGORixl1p8NPdPniRuWrrH0=; b=ic7fnvAqxwC8JgJpSOH+2y0gTHukPpqikAlhxckE1oE7ccy5rjEcNbHcDcBn/QZ0/j u3PljoHYsXNPtswTAdn7mQiCSCgGNC7EF39NnOpbkMerJxYQH4p3iR1PWU5K6/y2sNus tNEJgwzDTZY6EtWACtRoytgfGEwvI+Fxz9PHD5364qdBkhv5o8XxsGEkaGY1qGAg29IW 0CDuoe7ptAeBrkzrPkWUsZ2BTtoV5/d1gDvEZ3CX8jEPJBcTnOeaR4CCRcQQkNCTdWno 5zewRTJUnZegp/htVFW7zOuuHGgAr3+sVlT/RW5KpVfMiIFBnVdCEf3u0ipREhAbg88U FAjQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1776069993; x=1776674793; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:x-gm-gg:x-gm-message-state:from :to:cc:subject:date:message-id:reply-to; bh=o0213UnEMOod9W6HJe+rSGORixl1p8NPdPniRuWrrH0=; b=dlHKBko+qev3yBHFnUG1Whwqy+BJRvw5DDSNx2qlBFarUDfDWjdc4MdoMOnfX0ir5d idH7yH7hf2V4R5jmMCf4CiKWL9xcryVsYGDMhrXrhRDYxO02nhBxep8jZC75XA5kXyDA es3U3Qi5wQ0d6i/tvY4qmGur+XOa4kpqfIFlKbiJLV/MjCQhIOWkXJOxn8hxCM3jiDkB w4HylmLg3vRqwczIJudHaViQ56GELu7CRsb70hGMjEyRoE3ipopkCJDJkTUTjR4BL/7S mcNMFdgacn59BqFxJUJPIUB1qD9bMPrLyUq7T3Ggt1gL1ilHLw8a3rm8dWf2yoVHmUit 15vw== X-Forwarded-Encrypted: i=1; AFNElJ/U5YF7oqmg17JdxTo2R79Q6KVPlkNhspCdzeWxNtQ8LKe5WEORyW5PssZ4Xepe2a1sidz2XtKqopyCm+A=@vger.kernel.org X-Gm-Message-State: AOJu0YwitP3AJBoNuxWwdiuAj9oApm5+41UYYb2WSGjtpGiZJeKiNw2d 3fG5DSWaPqIdjclpnNRzf6izEw9O8XNBBWdyQ422M37df1mEOgN8BgTaGIkYYppZORuhbBAv8QH 1Nrsi3F16NBS1NHPW0iNJWShD7Qrnn1bx2VESSQNRpIfyUQw4lsgQMEuowynQjGCreV6ugJ7L14 NStD0psX+9BFvxq4fikB3SzdyA5jnTMrqEoO8bzQzA X-Gm-Gg: AeBDiesk+WFa6CGWGMNXcpbzDMGJF8yhmpcI0RH+iVVHABkSKW1ADr73lL0CTWEQ5De dIG20U7TQ/ekFCYi9E1yNdvhmZS8FGD+z+lqrXYfhYl4XR1Svr6CN2VIwb2loEuO1E7PonrZiva Xlrq4355RTBaGOpsDWmAYmdL1hi5C1pZHYVK/9OborJVVPeD/IFFSmhvLSJmk0UtxX7LOOfZLkt iQ3kg== X-Received: by 2002:a05:7301:fa0e:b0:2c4:b8d6:45d3 with SMTP id 5a478bee46e88-2d5877991cdmr6669867eec.10.1776069993420; Mon, 13 Apr 2026 01:46:33 -0700 (PDT) X-Received: by 2002:a05:7301:fa0e:b0:2c4:b8d6:45d3 with SMTP id 5a478bee46e88-2d5877991cdmr6669840eec.10.1776069992889; Mon, 13 Apr 2026 01:46:32 -0700 (PDT) Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 References: <20260402063714.55124-1-liwang@redhat.com> <20260402063714.55124-7-liwang@redhat.com> In-Reply-To: From: Li Wang Date: Mon, 13 Apr 2026 16:46:19 +0800 X-Gm-Features: AQROBzATy_Du7HEcqoEpfm3ecefJ913kdNeZVB-cXtC9R6JcAITrAGqsNlgA3uk Message-ID: Subject: Re: [PATCH v6 6/8] selftest/cgroup: fix zswap test_no_invasive_cgroup_shrink on large pagesize system To: Nhat Pham Cc: akpm@linux-foundation.org, rppt@kernel.org, david@kernel.org, hannes@cmpxchg.org, yosry@kernel.org, ljs@kernel.org, Liam.Howlett@oracle.com, mhocko@suse.com, shuah@kernel.org, chengming.zhou@linux.dev, longman@redhat.com, linux-mm@kvack.org, linux-kselftest@vger.kernel.org, linux-kernel@vger.kernel.org, cgroups@vger.kernel.org, Michal Hocko , =?UTF-8?Q?Michal_Koutn=C3=BD?= , Muchun Song , Tejun Heo , Roman Gushchin , Shakeel Butt , Yosry Ahmed , liwang Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable On Mon, Apr 13, 2026 at 8:29=E2=80=AFAM Nhat Pham wrote= : > > On Wed, Apr 1, 2026 at 11:38=E2=80=AFPM Li Wang wrote= : > > > > test_no_invasive_cgroup_shrink sets up two cgroups: wb_group, which is > > expected to trigger zswap writeback, and a control group (renamed to > > zw_group), which should only have pages sitting in zswap without any > > writeback. > > > > There are two problems with the current test: > > > > 1) The data patterns are reversed. wb_group uses allocate_bytes(), whic= h > > writes only a single byte per page =E2=80=94 trivially compressible, > > especially by zstd =E2=80=94 so compressed pages fit within zswap.ma= x and > > writeback is never triggered. Meanwhile, the control group uses > > getrandom() to produce hard-to-compress data, but it is the group > > that does *not* need writeback. > > > > 2) The test uses fixed sizes (10K zswap.max, 10MB allocation) that are > > too small on systems with large PAGE_SIZE (e.g. 64K), failing to > > build enough memory pressure to trigger writeback reliably. > > > > Fix both issues by: > > - Swapping the data patterns: fill wb_group pages with partially > > random data (getrandom for page_size/4 bytes) to resist compression > > and trigger writeback, and fill zw_group pages with simple repeated > > data to stay compressed in zswap. > > - Making all size parameters PAGE_SIZE-aware: set allocation size to > > PAGE_SIZE * 1024, memory.zswap.max to PAGE_SIZE, and memory.max to > > allocation_size / 2 for both cgroups. > > - Allocating memory inline instead of via cg_run() so the pages > > remain resident throughout the test. > > > > =3D=3D=3D Error Log =3D=3D=3D > > # getconf PAGESIZE > > 65536 > > > > # ./test_zswap > > TAP version 13 > > ... > > ok 5 test_zswap_writeback_disabled > > ok 6 # SKIP test_no_kmem_bypass > > not ok 7 test_no_invasive_cgroup_shrink > > I assume the test passed after fix? ;) That's right! This patchset is targeted to thoroughly fix various bugs. I rerun it too many times on various arches. All works well :). > > 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 > > Cc: Yosry Ahmed > > --- > > > > Notes: > > v5: > > - Swap data patterns: use getrandom() for wb_group and simple > > memset for zw_group to fix the reversed allocation logic. > > - Rename control_group to zw_group for clarity. > > - Allocate memory inline instead of via cg_run() so pages remai= n > > resident throughout the test. > > > > tools/testing/selftests/cgroup/test_zswap.c | 70 ++++++++++++++------- > > 1 file changed, 49 insertions(+), 21 deletions(-) > > LGTM. Thanks for fixing the tests :) > > Acked-by: Nhat Pham Thanks a lot! --=20 Regards, Li Wang