From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-alma10-1.taild15c8.ts.net [100.103.45.18]) (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 BFF3245D90F; Fri, 18 Sep 2026 05:43:47 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=100.103.45.18 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1789710229; cv=none; b=rD3FcXqKLk0kYFQiym0KNHa220nON0n1aCB3fcYnUBAoIB0ms3OmIbgp+E2Abgqd9CgUViKfKQOZi8xZ+qoFIj+If0OWseTqbebjZlIgzL/kCrgEAHtqLPrFsjexyc82/dW82G3mkjs0/caH7KWRKFDthEvoGc1VV8saWVPXtAk= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1789710229; c=relaxed/simple; bh=H5jqX+RN6rLp6Eumoi0WrSF0aeyqX9xppaqMs5eOSak=; h=Date:To:From:Subject:Message-Id; b=B1M98IvI9+Xv/wmzQfc4liFgLqfCdFG/koBp+Ld80M5zOIy61cu3hdr2e5BJXIVQGFhvR5eu1tpQTzh2XsK5RxYLpto1YLMPzOz3ldqyIvzrRCNYMl8mzgk2Fisbi9mnWQ3ty8QtjTXnLCMdK4Hlgm2qGUFF3kGwJCa0q7lTHKY= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linux-foundation.org header.i=@linux-foundation.org header.b=YQudlWoU; arc=none smtp.client-ip=100.103.45.18 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linux-foundation.org header.i=@linux-foundation.org header.b="YQudlWoU" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 490351F000FF; Fri, 18 Sep 2026 05:43:47 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linux-foundation.org; s=korg; t=1789710227; bh=JIKLXyGRzyzUuLCALhca9biA7J6xbTbFJmdjvlcAKA4=; h=Date:To:From:Subject; b=YQudlWoUWBu6dDl9SGuGvWGTA4tKseI8uPM7lhZ6Q03G3qWBNXZjyUH2xZ8wEioCn r7cFK0bigPU9cf8et0BS92SvnJCDG9b1XOAMkfBJq7g1jU4GPySXqxfoSLUyPM87aR 6rtNc/NjyUSiKiYdoFM/8WCXk8BsyB7dJDd7g3Mo= Date: Thu, 17 Sep 2026 22:43:46 -0700 To: mm-commits@vger.kernel.org,stable@vger.kernel.org,nphamcs@gmail.com,krushchavan@outlook.com,joshua.hahnjy@gmail.com,akpm@linux-foundation.org From: Andrew Morton Subject: [merged mm-hotfixes-stable] selftests-cgroup-account-for-zswap-shrinker-writeback.patch removed from -mm tree Message-Id: <20260918054347.490351F000FF@smtp.kernel.org> Precedence: bulk X-Mailing-List: mm-commits@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: The quilt patch titled Subject: selftests/cgroup: account for zswap shrinker writeback has been removed from the -mm tree. Its filename was selftests-cgroup-account-for-zswap-shrinker-writeback.patch This patch was dropped because it was merged into the mm-hotfixes-stable branch of git://git.kernel.org/pub/scm/linux/kernel/git/akpm/mm ------------------------------------------------------ From: Joshua Hahn Subject: selftests/cgroup: account for zswap shrinker writeback Date: Wed, 2 Sep 2026 12:45:20 -0700 The test_no_invasive_cgroup_shrink selftest checks that when a cgroup has zswapped out more memory than memory.zswap.max, it does not trigger writeback for other cgroups. To do this, it compares the writeback count in a control cgroup and makes sure that it is 0, and then checks the writeback count in an aggressor cgroup who does expect to see writeback. However, when the zswap shrinker is enabled, the victim cgroup can see legitimate writebacks not triggered by the aggressor. In some Meta CI tests, we have seen this failure mode happen. Instead of checking that the victim cgroup has 0 writeback, compare the writeback values before and after the aggressor runs and check that the victim cgroup did not perform any additional writeback. Note that this can still lead to probabilistic failures if writebacks take longer than 5 seconds, but this should fix the systematic failure case and make "not ok test_no_invasive_cgroup_shrink" less likely. Link: https://lore.kernel.org/20260902194521.3652178-1-joshua.hahnjy@gmail.com Fixes: b5ba474f3f51 ("zswap: shrink zswap pool based on memory pressure") Signed-off-by: Joshua Hahn Signed-off-by: Andrew Morton Reported-by: Krush Chavan Suggested-by: Nhat Pham Cc: --- tools/testing/selftests/cgroup/test_zswap.c | 28 ++++++++++++++++-- 1 file changed, 26 insertions(+), 2 deletions(-) --- a/tools/testing/selftests/cgroup/test_zswap.c~selftests-cgroup-account-for-zswap-shrinker-writeback +++ a/tools/testing/selftests/cgroup/test_zswap.c @@ -20,6 +20,7 @@ static int page_size; #define PATH_ZSWAP "/sys/module/zswap" #define PATH_ZSWAP_ENABLED "/sys/module/zswap/parameters/enabled" +#define PATH_ZSWAP_SHRINKER_ENABLED "/sys/module/zswap/parameters/shrinker_enabled" #define PATH_ZSWAP_STORED_PAGES "/sys/kernel/debug/zswap/stored_pages" static int read_int(const char *path, size_t *value) @@ -444,6 +445,16 @@ static int test_zswap_writeback_disabled return test_zswap_writeback(root, false); } +static bool zswap_shrinker_enabled(void) +{ + char value[2]; + + if (read_text(PATH_ZSWAP_SHRINKER_ENABLED, value, sizeof(value)) <= 0) + return 0; + + return value[0] == 'Y'; +} + /* * When trying to store a memcg page in zswap, if the memcg hits its memory * limit in zswap, writeback should affect only the zswapped pages of that @@ -453,6 +464,7 @@ static int test_no_invasive_cgroup_shrin { int ret = KSFT_FAIL; unsigned int off; + long zswpwb_before, zswpwb_after, zswpwb_target; size_t allocation_size = page_size * 1024; unsigned int nr_pages = allocation_size / page_size; char zswap_max_buf[32], mem_max_buf[32]; @@ -488,6 +500,14 @@ static int test_no_invasive_cgroup_shrin if (cg_read_key_long(zw_group, "memory.stat", "zswapped") < 1) goto out; + /* If the shrinker is enabled, try to let the writebacks finish first */ + if (zswap_shrinker_enabled()) + sleep(5); + + zswpwb_before = get_cg_wb_count(zw_group); + if (zswpwb_before < 0) + goto out; + /* Push wb_group memory into zswap with hard-to-compress data to trigger wb */ if (cg_enter_current(wb_group)) goto out; @@ -500,9 +520,13 @@ static int test_no_invasive_cgroup_shrin getrandom(&wb_allocation[off], page_size/4, 0); } - /* Verify that only zswapped memory from gwb_group has been written back */ - if (wait_for_writeback(wb_group, 5000) > 0 && get_cg_wb_count(zw_group) == 0) + /* Verify that only zswapped memory from wb_group has been written back */ + zswpwb_target = wait_for_writeback(wb_group, 5000); + zswpwb_after = get_cg_wb_count(zw_group); + + if (zswpwb_target > 0 && zswpwb_before == zswpwb_after) ret = KSFT_PASS; + out: cg_enter_current(root); if (zw_group) { _ Patches currently in -mm which might be from joshua.hahnjy@gmail.com are