From patchwork Mon Feb 5 22:56:06 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Nhat Pham X-Patchwork-Id: 13546360 Received: from mail-vs1-f52.google.com (mail-vs1-f52.google.com [209.85.217.52]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id B61DBC148; Mon, 5 Feb 2024 22:56:11 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.217.52 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1707173773; cv=none; b=Mi6zBa46B07jCD6SUJyN0gfoHo+Oixk7aT5X5CLJntL/PJaPL03g9yW9p7757pz2hO7tFdEApI3bikWRBMk8Hk5GAVF61vdBPF91vAzf24FbueLVyaXy8lNIxkmfuBYCpj+a2+IJSjDWedNa+dw8tjnRtOCo1I9DgmZfxyk11zU= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1707173773; c=relaxed/simple; bh=UAPFAa2YoR9r9pULmKsHh3JBLlD3Aq6ViNtLGWwsu4E=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=IXuof2HZbJR3kH7CvD/wb+E4/f3YoTLiBbaZ3Kn6mDV9pwa4MamLsBIqv1hwXizVpIW4T+6pEfQbTszc/tZ4pJ+cEEMi4vyrzFW1BFv8ulIF7hrvxPVJPFq/BQsp/bSegP5BcYNyY08UMZqRLKw86FkkYhSeTqswz/5WENWe0IE= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com; spf=pass smtp.mailfrom=gmail.com; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b=nj+nMklA; arc=none smtp.client-ip=209.85.217.52 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="nj+nMklA" Received: by mail-vs1-f52.google.com with SMTP id ada2fe7eead31-46d2dff740dso355131137.2; Mon, 05 Feb 2024 14:56:11 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1707173770; x=1707778570; darn=vger.kernel.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=0dsOQxIuZglfzGL/UkHixra2YxsOVoucMj4slNXKYQ0=; b=nj+nMklAtRAissrfk62n4MZpM2Ko9rB5NEP2SSxQu1VlR8ujwjE97EggjNKU/Wg8RD cSC99BV0m5qNHFvekvH3iWROae3PXbwQKMcuGpVoXTZ2/2ewfzWQt8pHL9bNSWWqp+7N /9giQZn/AfxmQE32Z3xbkqb07fTXg9HvkNBtY7zdnoGoDZwy82PMehnxgILT/LCKTqzB ZXQebmqP/+wHhcS5XApFGjvuFIGjrvvRMMkgfuWGUF48ThvXZABt9/4BqCM0LV6Ns96W ondR6LBm4wQ34Qvl8LI76d1EuowYWoSDrJCDQa2ktC88qsbP7nBWLGr+UT6uRzZfHmWR Mk6w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1707173770; x=1707778570; 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=0dsOQxIuZglfzGL/UkHixra2YxsOVoucMj4slNXKYQ0=; b=G49EihBdrlNvwwK1oc/OgwH7T2gFqcPIdLD91JsmnIi/xAohVvKfyfWT7MoYG94TL6 pX2zmv+qv6UvM9TRy9xVuxwcKfLf+R+4qIXNx0PUOcm468SN9EOsUCeUyU+ZiCVmOzfH wz/fAlizL+UF15nfSKK6a4IwFG/TKTHD/2drH98UfcPIJzqJgj+p9XKK/RZJEyGZy5fT UA0kYBa5yfa8cGmPMGdrc/DHFWuQuoghnTzhc9TmFWyVflh7/mnNWdi40J9XxoVOAFi/ rdDqzeL4wcq/XmabTqofSsKsDDxTR0yNIL3P7ZgaIDvUK7TE8e+tbLr3aHDd/8SCjD+A OWqg== X-Gm-Message-State: AOJu0YwK5TCho9sfSaoiNBMUFwoyS5KUOH85Xbx+bxQzvIPG/Pize8ux IW41tww8aWq9a7kSL8oXD4PAcb/wMRxYV//Yb0U/FU7PjSnfJzHf X-Google-Smtp-Source: AGHT+IFV1B+G9o8CvxcMN6huuwce6++oo07ZBBECnU4NSWU45WI0gVmfqhod2IRB+zTWiuirM2ArzQ== X-Received: by 2002:a67:f943:0:b0:46d:1a45:fa17 with SMTP id u3-20020a67f943000000b0046d1a45fa17mr297997vsq.7.1707173770466; Mon, 05 Feb 2024 14:56:10 -0800 (PST) X-Forwarded-Encrypted: i=0; AJvYcCXv2T5epHhjVpbPo8Hg+vYMCZlBiki07P+Chd3M52zwZTeQd1rAFiYC5lKFN4O8RLtJxJOEJ3QIHY4vvZjUMU4jv3OAOraB6/NpWN+FMzZY3vRcmuacj4pqGleuweIfJvM/dNZcp61u5lSRJd8ruOUgVyVhFmmAaCCovDU8kXn785oiLgAvM/pnvj3wixwysmjfWA2CSL4GCnJTfczW3SID87jJVgA376FhH81Ofsm2lb2GwLownGFbb2iniL9vd9BjVYsiCNj7lL9BX6Lwl5vDbm74cijKrF73E5lL898jM96kPHExYDMMZ3ht5/K3X7wqfYmbAMXkqS+Ak+Vl5kc3QK2EOJ36MzIDu6SC8Zr12yEKKKd/Yo3quldFrKHOnAC7Q/5ACWD7sEubRGXLIIo= Received: from localhost (fwdproxy-nao-006.fbsv.net. [2a03:2880:23ff:6::face:b00c]) by smtp.gmail.com with ESMTPSA id mu9-20020a056214328900b0068cac993878sm424486qvb.115.2024.02.05.14.56.10 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 05 Feb 2024 14:56:10 -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 1/3] selftests: zswap: add zswap selftest file to zswap maintainer entry Date: Mon, 5 Feb 2024 14:56:06 -0800 Message-Id: <20240205225608.3083251-2-nphamcs@gmail.com> X-Mailer: git-send-email 2.39.3 In-Reply-To: <20240205225608.3083251-1-nphamcs@gmail.com> References: <20240205225608.3083251-1-nphamcs@gmail.com> Precedence: bulk X-Mailing-List: linux-kselftest@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Make it easier for contributors to find the zswap maintainers when they update the zswap tests. Signed-off-by: Nhat Pham Acked-by: Yosry Ahmed --- MAINTAINERS | 1 + 1 file changed, 1 insertion(+) diff --git a/MAINTAINERS b/MAINTAINERS index 6527850f24d1..126090f0e418 100644 --- a/MAINTAINERS +++ b/MAINTAINERS @@ -24398,6 +24398,7 @@ F: include/linux/zpool.h F: include/linux/zswap.h F: mm/zpool.c F: mm/zswap.c +F: tools/testing/selftests/cgroup/test_zswap.c THE REST M: Linus Torvalds From patchwork Mon Feb 5 22:56:07 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Nhat Pham X-Patchwork-Id: 13546361 Received: from mail-qv1-f49.google.com (mail-qv1-f49.google.com [209.85.219.49]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 916791EB49; Mon, 5 Feb 2024 22:56:12 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.219.49 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1707173774; cv=none; b=P+NimLU621nqtjO59P3uB4FsYUjE0TUvWlnTdXRR+iGBETgRg5bgNXsBKc2BUXBWj06W1yqgDRE25oZLAFTlRlFglwJWG40zL7suGtD7nQOav8fJjoYJX57B7qg+Lux3POO0Ia0tG1Rosi32uehNKeHhvZk2tWMwQIGEEbtI1b4= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1707173774; c=relaxed/simple; bh=aTjkVj/ZHoE9XkKc3AYHVjvNxlRZrQwmqbrbwBElTkM=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=gUK0h4xQh0kZEK3lag8cz8UBS6ZXH1Ay6v5VjpNrvfdj5ylGNnIeBW/zPA4WKHFAbFhbAXlUzGz6BeuclkZIahIkhiXTg3NFCp9lcahiLi98YQTpaAMtpIZtynmOy7dnV5Aq4aUSTfYRRsKbbncC1MVdbBSF4uDI9y5ZU89u/40= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com; spf=pass smtp.mailfrom=gmail.com; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b=h2zxHlcm; arc=none smtp.client-ip=209.85.219.49 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="h2zxHlcm" Received: by mail-qv1-f49.google.com with SMTP id 6a1803df08f44-6869e87c8d8so17947896d6.2; Mon, 05 Feb 2024 14:56:12 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1707173771; x=1707778571; darn=vger.kernel.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=leL/vEiB0VeH8ZIF97IARUVmsuNbNROoZaGIt1HbTGM=; b=h2zxHlcmbZ5BSW+x9t5GCDGWtx3UrQQpvPS06+4ycEdvso8t3mDgbGDE7e/m2FQTyP eo2GwzY0p3y6IEiGdoqOAp+3IwCcJexboXclaWQgHq3ZYO7oM8wbNmjq1rkmXqU/cFhn OqT5zHTQKU5k8uu9De/ew8U6xV6RGvsHtvRKEvllj4imbacsGtE7dvF7v7gMSey088XN cyh8bXBvl7vx2Y6G9alfIOerXUsJ9je7wF5qAe0Y/tuYmYA8u6AnFGTQ5SUAP0R1IJEM AZJkyk1KtL4TY+fgmHxKnyIcPB20+IaWihPhJRZ7P/z0boIDH2XxO2y+IHyiPPYxMWF+ F3/w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1707173771; x=1707778571; 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=leL/vEiB0VeH8ZIF97IARUVmsuNbNROoZaGIt1HbTGM=; b=cAOkEPY/QUimvBKR4Iqf9LEUBPFHR/PM05SAgk+jDJaWO1fw2u0ifXpOQ5gtNePAq4 srN+5bArHlRKk3l3ED4nsik+IznICY6m2o2p7E8p05QXPjE261sOYZkS4L/KieQhsJbl 88q6BaQPa0h5y+5k0BksN9bg/SLGghK7GXeQiDhsyKoCfGw/NZ+opO7Yb6iAvPQ4BZ4N 3h342FK2n3Jo00gIaLKscCm/QNOMFqJCRL5FNeiKkUQLD0R7zJMmcW9nC+PskVMdLxjb AnG1dm0wrdk2ZKl/vlS803bJ/lMI0HwGstLIZb59gcOYnflDAMfJPMut7o7JAZEovcwn W8lg== X-Gm-Message-State: AOJu0YzhMnpZwvXRRvQ3sR2IXDD2psQSLYttWapqz7wT3ISPsIX62h5b drx4W+ZKuXNwTzmWst8Vx1zK/rile82Fb7221661HAinipa1gs+O X-Google-Smtp-Source: AGHT+IESv97Kd8go2vQYFQli2hhUNviKbARAN2odGnIcieOptqRe4kVgIWNQc5zdOUprmXtRMEzg3Q== X-Received: by 2002:a05:6214:19ce:b0:68c:930e:6f49 with SMTP id j14-20020a05621419ce00b0068c930e6f49mr458443qvc.36.1707173771373; Mon, 05 Feb 2024 14:56:11 -0800 (PST) X-Forwarded-Encrypted: i=0; AJvYcCUCB274hPBtIag/AKoEk9o51vlokXWUWAxRE5V+Cz4My769VWoTejn2B1RAUCKKHbwcPLGoh+DbFwmU6KsfZgCcgH0wRnXWCOZngGJD7cmcs4vcKLVE9sTY6JFoELRq2eYGkxocLIj2as554uq56BmopBHWg5x8HAhLEaBOFRtdI4IRQDB6ccDlZfNGKLjtJ1eSpUn+JZ62iooCUAeriwm9z+w5PdcnTstjiBFbtcjmH+3giaUqKCAjZ9hOJeJF10XqvdB6jHHxjK2rrhGU+IKj+e7U0gQXMgTYkhNC4/+l8uI4oE9Lb4ZHnfpg3zOjQAfpk70OaOK5z464WgSLo9zW7cGhZBBAH9YCl1DYhGox66WdzafeB10RxjBNMUMi4Rawu+mYI0t6VUsMLM2mRb4= Received: from localhost (fwdproxy-nao-004.fbsv.net. [2a03:2880:23ff:4::face:b00c]) by smtp.gmail.com with ESMTPSA id e15-20020a0cf74f000000b0068c4b445991sm428451qvo.67.2024.02.05.14.56.11 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 05 Feb 2024 14:56:11 -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 2/3] selftests: fix the zswap invasive shrink test Date: Mon, 5 Feb 2024 14:56:07 -0800 Message-Id: <20240205225608.3083251-3-nphamcs@gmail.com> X-Mailer: git-send-email 2.39.3 In-Reply-To: <20240205225608.3083251-1-nphamcs@gmail.com> References: <20240205225608.3083251-1-nphamcs@gmail.com> Precedence: bulk X-Mailing-List: linux-kselftest@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 The zswap no invasive shrink selftest breaks because we rename the zswap writeback counter (see [1]). Fix the test. [1]: https://patchwork.kernel.org/project/linux-kselftest/patch/20231205193307.2432803-1-nphamcs@gmail.com/ Fixes: a697dc2be925 ("selftests: cgroup: update per-memcg zswap writeback selftest") Signed-off-by: Nhat Pham Acked-by: Yosry Ahmed --- 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/selftests/cgroup/test_zswap.c index 47fdaa146443..32ce975b21d1 100644 --- a/tools/testing/selftests/cgroup/test_zswap.c +++ b/tools/testing/selftests/cgroup/test_zswap.c @@ -52,7 +52,7 @@ static int get_zswap_stored_pages(size_t *value) static int get_cg_wb_count(const char *cg) { - return cg_read_key_long(cg, "memory.stat", "zswp_wb"); + return cg_read_key_long(cg, "memory.stat", "zswpwb"); } static long get_zswpout(const char *cgroup) From patchwork Mon Feb 5 22:56:08 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Nhat Pham X-Patchwork-Id: 13546362 Received: from mail-qt1-f176.google.com (mail-qt1-f176.google.com [209.85.160.176]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 83DA6482CD; Mon, 5 Feb 2024 22:56:13 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.160.176 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1707173775; cv=none; b=Qi3HCP2GlYjZ+/Qr26XqSFKiznf6a2EaZanzJqLUIljGl3KkGwWMIlNca1NyJrLqatPwN8s75bByFa5D8GscmsuBN6qmNYQVi+U62XfFKD2y4M8aPigISyArt+TPqbMcGnmk8ritaizLUZUvfbMsQNDYvcErw3FurIug1cCYXgU= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1707173775; c=relaxed/simple; bh=Tie7E5mz6Z/lTyy1A0uRA2fDXZNOAArdxEQCEDzT0do=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=BfOt7DvuMB6G5UoRzb1kSLsOKXA6W92F0Q+QD1OmAe6bcDv+XBwa9L31XjkB1uHb+GfClBb7Azt4csoobRQKZGebll0TvXtzHsK++YctGxQBS6DwFhhJTji5GZX4rNqxhKHJOnVeOOIHTSSPQ0Chkb3FmQ62mByi9ja0tsKi6u0= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com; spf=pass smtp.mailfrom=gmail.com; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b=mTaCl+gl; arc=none smtp.client-ip=209.85.160.176 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="mTaCl+gl" Received: by mail-qt1-f176.google.com with SMTP id d75a77b69052e-42ab7522c75so28861251cf.0; Mon, 05 Feb 2024 14:56:13 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1707173772; x=1707778572; darn=vger.kernel.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=8HqWjgU6D10aye5QHEqX+OBFLhtZ/fQssfKAsKXBKvY=; b=mTaCl+glq5+P0E/uvDegW3hvaSAfJWv8eJA61HO8+76+lv9C/vbGob+qhaARnzpKPo Oj8YalEnBSZsEAFMtZlV3oETUmglose3w0jy+6TZ+XA1QsLuUZuZjXyoAK20mmi87Ek4 o+fnaWLeTNycZE7rsw3qJfw1WGIq3zFMHDK9WUAvlmqW+g+ryLMDA+d41FqRlpN7ysAM JDQutzmFpijK5RHfX9Hr7K7xYWnemj0YxAYcsgusRNO/nJ3nbu14Id6hsgLia9oVVYoH YqRPhunMB/bwNgsvTemLqWSWruDIxgQqsYuN2spp1itduEL6Aj8RGdR28RAGs0GlNGeV zM4Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1707173772; x=1707778572; 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=8HqWjgU6D10aye5QHEqX+OBFLhtZ/fQssfKAsKXBKvY=; b=p7DQ1XqgkxXOkxAdmbeVFBgR2F2x+BZFbLBQl+jOCqQWWtWQHIJZQZvFQBs72w9jBz 2oRT9NGEbXh6MVYcGLP2D9PpIyTQpNL0Ul8L8gnSEh3P/8TMNhNYsrzCq3Wkm3QchRbG PqdAMYsbctyDNwmOwBwFh3bzHnpl0A+E0zHqSGn0cvMPTj72ciQ9YqVTVtojMEoP3pl4 dH3ndwKKnMx2S30fk604xhRecsYMchTXa8EUdqjNgqkoT7tXM4cidIizJBZ3/gVt8Isu TLAEWMJwD6QCha+uFNxe5Mc1myw+k86sdIifGaiKlfQKcrORospimpjlL7pe5RIXFXIG WJLg== X-Gm-Message-State: AOJu0Yw3R3WPK+Nou0a4t6u1AnYpapSCl0ZeCm/Fq3jrmC72D34ZktAy XD9EhdRrUSK/taoRtsTlRkmQHkyrXFgDY8XTF90mXGaBRMjTp3mS X-Google-Smtp-Source: AGHT+IGCJNv8Ji8AU8IubQXBQCs37V3e6UKJOoL7efbPjiM7OFm3oBHUGScLF4gh82NdJqEYVnvINw== X-Received: by 2002:a05:622a:48c:b0:42a:4350:64c7 with SMTP id p12-20020a05622a048c00b0042a435064c7mr856118qtx.68.1707173772351; Mon, 05 Feb 2024 14:56:12 -0800 (PST) X-Forwarded-Encrypted: i=0; AJvYcCUqJ/8EC/uAZwZYtWAjBIdqbUeGbSxx64XcNJIk/q+Br0fd2ZnF42wZpS0SYMUietCy0wo5VDpFFrErX3imrvpZO7WUNzR0srWRl30TV27h+6vc/IS6iQWrv4/WZwlIoPcLjhVHGiLlYCHcOhLHtmU/XHgKHVHhuxMDRGoHmyQMpIEtQEnWW34EFfNe4blyDBX6rzDg4TWP0sFRajPTZJgN3taO51FviZbbDsTb2g6pQs2CZ1VtBqISF4HUt3BAYXagM3lV6duO/3YsUmZC9mGd1ykVuOVgbrKn5/IrLdfdhnCAgZS9LRo7X/PgcaV4z62Tujb6K1xdzYVGR7dc+ZgfZgASlu5mhpHQiT4/C7oRjIHVukimfyzDAXIBatf/OZoWz0Lci4ZJjl5Ne7STXbQ= Received: from localhost (fwdproxy-nao-001.fbsv.net. [2a03:2880:23ff:1::face:b00c]) by smtp.gmail.com with ESMTPSA id e2-20020ac845c2000000b0042c2034c54fsm367932qto.17.2024.02.05.14.56.11 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 05 Feb 2024 14:56:12 -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 Date: Mon, 5 Feb 2024 14:56:08 -0800 Message-Id: <20240205225608.3083251-4-nphamcs@gmail.com> X-Mailer: git-send-email 2.39.3 In-Reply-To: <20240205225608.3083251-1-nphamcs@gmail.com> References: <20240205225608.3083251-1-nphamcs@gmail.com> Precedence: bulk X-Mailing-List: linux-kselftest@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Add a selftest to cover the zswapin code path, allocating more memory than the cgroup limit to trigger swapout/zswapout, then reading the pages back in memory several times. This is inspired by a recently encountered kernel crash on the zswapin path in our internal kernel, which went undetected because of a lack of test coverage for this path. Add a selftest to verify that when memory.zswap.max = 0, no pages can go to the zswap pool for the cgroup. Suggested-by: Rik van Riel Suggested-by: Yosry Ahmed Signed-off-by: Nhat Pham Acked-by: Yosry Ahmed --- tools/testing/selftests/cgroup/test_zswap.c | 120 +++++++++++++++++++- 1 file changed, 119 insertions(+), 1 deletion(-) diff --git a/tools/testing/selftests/cgroup/test_zswap.c b/tools/testing/selftests/cgroup/test_zswap.c index 32ce975b21d1..c263610a4a60 100644 --- a/tools/testing/selftests/cgroup/test_zswap.c +++ b/tools/testing/selftests/cgroup/test_zswap.c @@ -60,6 +60,27 @@ static long get_zswpout(const char *cgroup) return cg_read_key_long(cgroup, "memory.stat", "zswpout "); } +static int allocate_and_read_bytes(const char *cgroup, void *arg) +{ + size_t size = (size_t)arg; + char *mem = (char *)malloc(size); + int ret = 0; + + if (!mem) + return -1; + for (int i = 0; i < size; i += 4095) + mem[i] = 'a'; + + /* 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; + } + + free(mem); + return ret; +} + static int allocate_bytes(const char *cgroup, void *arg) { size_t size = (size_t)arg; @@ -100,7 +121,6 @@ static int test_zswap_usage(const char *root) int ret = KSFT_FAIL; char *test_group; - /* Set up */ test_group = cg_name(root, "no_shrink_test"); if (!test_group) goto out; @@ -133,6 +153,102 @@ static int test_zswap_usage(const char *root) return ret; } +/* + * Check that when memory.zswap.max = 0, no pages can go to the zswap pool for + * the cgroup. + */ +static int test_swapin_nozswap(const char *root) +{ + int ret = KSFT_FAIL; + char *test_group; + long swap_peak, zswpout; + + test_group = cg_name(root, "no_zswap_test"); + if (!test_group) + goto out; + if (cg_create(test_group)) + goto out; + if (cg_write(test_group, "memory.max", "8M")) + goto out; + if (cg_write(test_group, "memory.zswap.max", "0")) + goto out; + + /* Allocate and read more than memory.max to trigger swapin */ + if (cg_run(test_group, allocate_and_read_bytes, (void *)MB(32))) + goto out; + + /* Verify that pages are swapped out, but no zswap happened */ + swap_peak = cg_read_long(test_group, "memory.swap.peak"); + if (swap_peak < 0) { + ksft_print_msg("failed to get cgroup's swap_peak\n"); + goto out; + } + + if (swap_peak == 0) { + ksft_print_msg("pages should be swapped out\n"); + goto out; + } + + zswpout = get_zswpout(test_group); + if (zswpout < 0) { + ksft_print_msg("failed to get zswpout\n"); + goto out; + } + + if (zswpout > 0) { + ksft_print_msg("zswapout > 0 when memory.zswap.max = 0\n"); + goto out; + } + + ret = KSFT_PASS; + +out: + cg_destroy(test_group); + free(test_group); + return ret; +} + +/* Simple test to verify the (z)swapin code paths */ +static int test_zswapin(const char *root) +{ + int ret = KSFT_FAIL; + char *test_group; + long zswpin; + + /* Set up */ + test_group = cg_name(root, "zswapin_test"); + if (!test_group) + goto out; + if (cg_create(test_group)) + goto out; + if (cg_write(test_group, "memory.max", "8M")) + goto out; + if (cg_write(test_group, "memory.zswap.max", "max")) + goto out; + + /* Allocate and read more than memory.max to trigger (z)swap in */ + if (cg_run(test_group, allocate_and_read_bytes, (void *)MB(32))) + goto out; + + zswpin = cg_read_key_long(test_group, "memory.stat", "zswpin "); + if (zswpin < 0) { + ksft_print_msg("failed to get zswpin\n"); + goto out; + } + + if (zswpin == 0) { + ksft_print_msg("zswpin should not be 0\n"); + goto out; + } + + ret = KSFT_PASS; + +out: + cg_destroy(test_group); + free(test_group); + return ret; +} + /* * 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 @@ -309,6 +425,8 @@ struct zswap_test { const char *name; } tests[] = { T(test_zswap_usage), + T(test_swapin_nozswap), + T(test_zswapin), T(test_no_kmem_bypass), T(test_no_invasive_cgroup_shrink), };