From patchwork Thu Feb 22 04:31:32 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Nhat Pham X-Patchwork-Id: 13566754 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by smtp.lore.kernel.org (Postfix) with ESMTP id 8BDBCC48BF8 for ; Thu, 22 Feb 2024 04:31:40 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id AA0856B006E; Wed, 21 Feb 2024 23:31:39 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id A50F06B0071; Wed, 21 Feb 2024 23:31:39 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 918B56B0072; Wed, 21 Feb 2024 23:31:39 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0017.hostedemail.com [216.40.44.17]) by kanga.kvack.org (Postfix) with ESMTP id 7FFFF6B006E for ; Wed, 21 Feb 2024 23:31:39 -0500 (EST) Received: from smtpin02.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay08.hostedemail.com (Postfix) with ESMTP id C086C140A97 for ; Thu, 22 Feb 2024 04:31:38 +0000 (UTC) X-FDA: 81818166276.02.531C968 Received: from mail-pl1-f176.google.com (mail-pl1-f176.google.com [209.85.214.176]) by imf16.hostedemail.com (Postfix) with ESMTP id 1C8C518000D for ; Thu, 22 Feb 2024 04:31:36 +0000 (UTC) Authentication-Results: imf16.hostedemail.com; dkim=pass header.d=gmail.com header.s=20230601 header.b=VieDdKx3; spf=pass (imf16.hostedemail.com: domain of nphamcs@gmail.com designates 209.85.214.176 as permitted sender) smtp.mailfrom=nphamcs@gmail.com; dmarc=pass (policy=none) header.from=gmail.com ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1708576297; h=from:from:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references:dkim-signature; bh=1qe6sezPW9Q3wTsxfWJprqeu8KJLsVxqYQYWx727S4g=; b=5x5o6qaoE2DOxsfqrrMOTSJS3V/6V6pH0wNd2yESl1+Y0eq29ylyLviI74XYpx5lBOXmcO lkzkvSuMPpWy+FoVVme15RsFlMLacfG2F4MQ1XnH2JT/7CwguMaexdGdxGt1WIFbCI2xRP 7lVnEAK0jPRBUCjgcA10hbH4NcvdSwI= ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1708576297; a=rsa-sha256; cv=none; b=8AdwxRpvrsKwdkH6bsd/a710Xm6MATPRfy7ybDpuTQn8xRTWq3q9zbsEihxZwU0vNXnpJs Cakgvwn1YZ5VUOajWd2GeQUbkT3wHdQAchWci2GJi7mp7rI7wUr0uETPU+MoDWh6wyHkWP Ht/waaFP9ttmn5DW/uwPqg4vbCrV+gQ= ARC-Authentication-Results: i=1; imf16.hostedemail.com; dkim=pass header.d=gmail.com header.s=20230601 header.b=VieDdKx3; spf=pass (imf16.hostedemail.com: domain of nphamcs@gmail.com designates 209.85.214.176 as permitted sender) smtp.mailfrom=nphamcs@gmail.com; dmarc=pass (policy=none) header.from=gmail.com Received: by mail-pl1-f176.google.com with SMTP id d9443c01a7336-1d944e8f367so59520555ad.0 for ; Wed, 21 Feb 2024 20:31:36 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1708576296; x=1709181096; darn=kvack.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=1qe6sezPW9Q3wTsxfWJprqeu8KJLsVxqYQYWx727S4g=; b=VieDdKx3Ph7CPwOlmYhpuhJd+RzBIGFhb6o9nbFUash4Kd5Cuv/UynPFhRVBokwh4h p0gLK/ykW3Q0E0U7cr0w6is5zDx9YSYZLape7dewUV5yzHVAELegCdr2O1myKeHyXSRT CY6xyJNrogO/XIVWb02NjjQEK62XBRafbG9QhO2PBEbPCH4vt24uead0VX9+3gVd7tQD 15/eeRnFEj8ByiDip4cL/YCvvXnNzhdtdZk3zPh7/KCPv5KcSqUSkJEEv7KPcbr7Vkqp 4v/Q+QdNGuOXU+CgmIFM7eiN8WIDiG/J39Wxyv/JS98kXJW8YIvmKsYYxqidLAFJUYyx kUpA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1708576296; x=1709181096; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=1qe6sezPW9Q3wTsxfWJprqeu8KJLsVxqYQYWx727S4g=; b=axGDDwzcj/VzYVgL7VpjqUIp5aKPOodhLKzIO35P9z4j1DJ94HzHDT2KdTykRvgOST v/4GIFw8SVy9k3IstzEMxnX8mZzolNVXthWN6nkb9YZwjiKywvAguhotP4EOdwwy63x1 ObMsuoeW3PxMdl5vHhfQUcChqYfRvY9/ML52QKVsMZ5aDBda6PLH0COKrPSM54Nqq5ez h7pNYVD1r2jZRC1OFGgamdTfwox+1Ic+Ns0OL166BDm+oRqOgghTn6bzSSe1xids0tWB K2oCJYOioF+c9MiP0Wpoj3XiK5S8XgmMg6E6RrMxyJ2sg8z2hnUih6DKjbaOJ6eqEdqI V9Qg== X-Forwarded-Encrypted: i=1; AJvYcCWuUY9ico36nXCBnjLW/y/xtwZrC7BV17rud30J2jGbD9bIo/8oM8buoP69WIHH8oxId4mUViRseYCjszC3IZWlMyk= X-Gm-Message-State: AOJu0YxlbMpBaEZF9NPFtsaqjFBqm0ztdUq/U7+d/LXR6zYxZCjCd0wu UIAl0Rj8CtU1HrUrdkAnUFki9RYVJZWZXEuzeqTbQzp2a0LDrDIy X-Google-Smtp-Source: AGHT+IFvwhrdrl0JmcZYiX3fu1qeJSYVF8Ug338hF3xvhP1lnZXSpsbvYZMu3w6zkcy1H5hqE3qsWw== X-Received: by 2002:a17:902:6b82:b0:1d9:edf5:c858 with SMTP id p2-20020a1709026b8200b001d9edf5c858mr17146757plk.52.1708576295686; Wed, 21 Feb 2024 20:31:35 -0800 (PST) Received: from localhost ([113.22.93.93]) by smtp.gmail.com with ESMTPSA id s4-20020a17090330c400b001db9cb62f7bsm8947356plc.153.2024.02.21.20.31.34 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 21 Feb 2024 20:31:35 -0800 (PST) From: Nhat Pham To: akpm@linux-foundation.org Cc: riel@surriel.com, shuah@kernel.org, hannes@cmpxchg.org, yosryahmed@google.com, tj@kernel.org, lizefan.x@bytedance.com, roman.gushchin@linux.dev, linux-mm@kvack.org, kernel-team@meta.com, linux-kernel@vger.kernel.org, cgroups@vger.kernel.org, linux-kselftest@vger.kernel.org Subject: [PATCH v3 3/3] selftests: add zswapin and no zswap tests (fix) Date: Wed, 21 Feb 2024 20:31:32 -0800 Message-Id: <20240222043132.616320-1-nphamcs@gmail.com> X-Mailer: git-send-email 2.40.1 In-Reply-To: <20240205225608.3083251-4-nphamcs@gmail.com> References: <20240205225608.3083251-4-nphamcs@gmail.com> MIME-Version: 1.0 X-Stat-Signature: behzkkjbxqnyezg3re71yoygcoqjy3br X-Rspamd-Server: rspam10 X-Rspamd-Queue-Id: 1C8C518000D X-Rspam-User: X-HE-Tag: 1708576296-628318 X-HE-Meta: U2FsdGVkX1/ANsWiYRQ72LUUEUEihUXQbEw9WEQdIx9b06P5kxQd9I/FofD5XER/+l15rwRPgVXuQWn1hWdoGuusaM3Fx/i+fSmNKBeuGe+G5c3a80skbQLjt4UwicARUsOcNhXXvrdppfF2cAhFsenM5X2Xoat0rNPDunSFV7D+m0DNTsHIicrmTUuvxDLM68NhOkrKDBv/FwOfgXRJa7Jytk3Dt04izqaVyX0apOyVai6qXsYVX11UxgcVSCAbq9y5aJvelkhLT1Lehw4dEY1Vd8rUyY3tJP6dxS34y0UhHPyrTLN68IuMNz4Xyx0Io2eGg/mnTIUFFO2+sOH+68wfgYxtrToq8CT1Lh6i1/cfe/rREZ+RAN/i2ZiUrzrE2981R/ZOb3Agkeqz5gInVM2FNQDUfMOhbu55Y84e6vtttWcOLXOcPcOGlnh/8qtMP07kmC1T6Mjq1iLK2XoDAlle4ejMPxHHef7CzpdJvx+nXnkZzQ3Wq/Hy4sdq8hgdbUaLgU5cVMNIlVm6xFip+hWBhZ8XME+RN3BTgOnkM3BN7xQNRr31TlJzm6S0/MxmFshB9t01CaLyoF+K2m2TNVmVrmtOVUiUB6xk0PrZ15ui0d65jy8AsU2WW2okdp11a45bpvEvrN3NDlO13YzaxugIroY8Fl9F1by3djs+7iAnLeVO2kj37xcGjB8JHp5fcZTLxkFVdmo4QDopDInNwTx5E1dndMZGkH+dsf4CF1gXysPRY53HbGM1cMp/zQeHSxQlnLxYM4ludV4U+Oo1nBQPcvuJZf08PmkcQZvGYE/X4tGanxjcTyZUNe5P91pm5RCu394sQaSD+40XaWyE4MPAyBVqQ6uFtoSHmSOOwWRTXSmRF8B3fgP6f/8yfqqD459FfO03D8cYlkYfP+I5yXV6pnnkzFln3+gai84W0SftdFQZrMET8BJxjIP5fLD8lXXQYNinShOt6ZLhIdn ODCyKDVO e4j95dnZgn4IZGNgvF81PqpsD+ZO0I2npfhie4quUcSXCECAfLU/wIep6J1mSt6AhQtHsRO+iQ7l1bgy8F04sktIWVjgX02xhlQrEzXnn1mH03q55dzvnBELXQQ== X-Bogosity: Ham, tests=bogofilter, spamicity=0.000357, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: List-Subscribe: List-Unsubscribe: Remove redundant "set up" comment and add check to ensure enough data is swapped out (in swapin test) and zswapped-in. Suggested-by: Yosry Ahmed Signed-off-by: Nhat Pham --- tools/testing/selftests/cgroup/test_zswap.c | 12 +++++------- 1 file changed, 5 insertions(+), 7 deletions(-) base-commit: 9d193b36872d153e02e80c26203de4ee15127b58 -- 2.40.1 diff --git a/tools/testing/selftests/cgroup/test_zswap.c b/tools/testing/selftests/cgroup/test_zswap.c index c263610a4a60..f0e488ed90d8 100644 --- a/tools/testing/selftests/cgroup/test_zswap.c +++ b/tools/testing/selftests/cgroup/test_zswap.c @@ -71,7 +71,7 @@ static int allocate_and_read_bytes(const char *cgroup, void *arg) for (int i = 0; i < size; i += 4095) mem[i] = 'a'; - /* go through the allocated memory to (z)swap in and out pages */ + /* Go through the allocated memory to (z)swap in and out pages */ for (int i = 0; i < size; i += 4095) { if (mem[i] != 'a') ret = -1; @@ -184,8 +184,8 @@ static int test_swapin_nozswap(const char *root) goto out; } - if (swap_peak == 0) { - ksft_print_msg("pages should be swapped out\n"); + if (swap_peak < MB(24)) { + ksft_print_msg("at least 24MB of memory should be swapped out\n"); goto out; } @@ -215,7 +215,6 @@ static int test_zswapin(const char *root) char *test_group; long zswpin; - /* Set up */ test_group = cg_name(root, "zswapin_test"); if (!test_group) goto out; @@ -236,8 +235,8 @@ static int test_zswapin(const char *root) goto out; } - if (zswpin == 0) { - ksft_print_msg("zswpin should not be 0\n"); + if (zswpin < MB(24) / PAGE_SIZE) { + ksft_print_msg("at least 24MB should be brought back from zswap\n"); goto out; } @@ -260,7 +259,6 @@ static int test_no_invasive_cgroup_shrink(const char *root) size_t control_allocation_size = MB(10); char *control_allocation, *wb_group = NULL, *control_group = NULL; - /* Set up */ wb_group = setup_test_group_1M(root, "per_memcg_wb_test1"); if (!wb_group) return KSFT_FAIL;