From patchwork Thu Feb 1 03:27:16 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Nhat Pham X-Patchwork-Id: 13540591 Received: from mail-qk1-f175.google.com (mail-qk1-f175.google.com [209.85.222.175]) (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 285D83A1A1; Thu, 1 Feb 2024 03:27:20 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.222.175 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1706758042; cv=none; b=ZnpVVxps5XRULvmBW0LVFXme5+r/EBNiCJtAU0rVBRGHmUBk6w6uHkKhEOqSzqD4YPcC4IoHBJwKnFIMk7EPvKgOQs4oegs9lW3zXnGK9gK9W1slp3JATYf4NneQAvnqM0tWI5fBzhX+ehlb0LJJGggvleVoDG8KZ/za/0veba8= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1706758042; c=relaxed/simple; bh=hG2+PSvAI3WsBVzydgNM+6x1sh/jZST2ajXPP7q9MnU=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=rSKKoa5qymfuujoi2XI8W4zEHGTjHvet+h1HBKutupzwTRXu2BN3a5IiQrG6EWj/8HSdomx+K4eCvcqUbN7ngQ6zn+JCxbN0xl5v5ntcCclvQ8fftf2SHlIYOuiOpTSAXYJbws1ChkUe5ypMLl/xfpkeg+UH5/gkZktQRMxMPGo= 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=gGKsgQCy; arc=none smtp.client-ip=209.85.222.175 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="gGKsgQCy" Received: by mail-qk1-f175.google.com with SMTP id af79cd13be357-783ced12f9bso22469885a.3; Wed, 31 Jan 2024 19:27:20 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1706758040; x=1707362840; 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=t/6d9JyQ3aGDZno7ndLmFvGN72VRjkltv3CVlEpIaB8=; b=gGKsgQCyNSiQxFL0p+HwyzyrnFrqTo/uYAH/54bBISvKrKxn8sqVCxug3NrJo5YvAf fJuLcrGm1u6OmYNLTAcdJhtbrR4ruxxOMEyABKd8iJM8K29adBJRpmc7yRyUjtVdt7f0 wlYY3MC8rYBZ89h9XjGaeML7Q3TPElM3YGvAhhE6poAQp6r4fJLemGE3/NphgyxPGLa2 ALKfEgV2X+cFUtPFqOGruuDWFo4VNcKQiolpALNtodAKxJZraQSwcVz1RmttvwlkmWBD 0akyRZfX7oDOPn+mhQUObpwbY/v2SEUNZ2/GyE+7FCE/DD4GpL129VYURa6PRRGJ8Orv 0Eyw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1706758040; x=1707362840; 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=t/6d9JyQ3aGDZno7ndLmFvGN72VRjkltv3CVlEpIaB8=; b=gC8AKjvHvoy0hFxkaTcJRQbpG/Vl9W3zQkZt+SBhmzeayQQ9Mv1ZmeVD5AwIm17ZnZ mbmBWsfrM2k8teoAHzCt7tFeRld0RAgkQ/0khU5czc4vNvfwmAkcG7jTYYr916I6NgZg 4Q2Pb4zr+GmVXkIqR3LR4093jdBMtHJ29z/H9Zg0sSxK99iT4rex5JVq4LXXHEDXgj8f JBJFllA6grITugRhvMGnFuQSlHdgKxbSyDoTNMwe61BS1Gx/UQ2JsDlmcP+dsJEIR+uB e6gjXaMsf2C/W/9tz1SSPuj6Kn4yJJJHOzUbOlbuTYbODpBgDma/13SHfxYr42PXCoT9 4JIQ== X-Gm-Message-State: AOJu0YxPbBnB6vRd3SR9i0OVgI7wWsNk5XuSkN9y1NCPzjf7I/m/W8DI dhrNR1EPFuLazXiWAWNQd3bX4NwqbpCmqWgYXT+P+X0kuKnNNdfD X-Google-Smtp-Source: AGHT+IHFc27RL7Utmjc1Pq/lujri1IbLrCkXvs37G1YNUuJnCajdoRhIpZd0pK9lV7z8xZOTUBO+kQ== X-Received: by 2002:a05:6214:d45:b0:68c:5a42:41a3 with SMTP id 5-20020a0562140d4500b0068c5a4241a3mr4098862qvr.34.1706758039796; Wed, 31 Jan 2024 19:27:19 -0800 (PST) X-Forwarded-Encrypted: i=0; AJvYcCV6whcYy++TMlKNQrkTFI8cKX+Wo3UA1hSScb7Tc1JPnBdWZVCGfX5YDvtMENDjCUS2fxggT/fh+nuXMwlq5w+LJOEtZ6/oumbQvZK+XVj3PS3WsyNd6+OKpmte+UqEIHumJAkWvTEd1mzvgE6ALEy1C88UxfMWjofNWhzUZMTk1SJFd5ve21yQaMVwoQqDSrb/fc3wUhG2vbe2oIVPwP6kmW+GPY0lkh4AHPc4JwV7QhwBYr/nqm1AizcFjF6hsHJFwyaIAAK3gRiI6WODGEx9++F/eYrf0L8Pq3/X0tjDsU9dN8GeG7IqpccRSG3mXGAza8VcT5PMZzIMzbvZ9xoSdFiNrDpF9jQJCwL3/XA6rNFfBeO1 Received: from localhost (fwdproxy-nao-009.fbsv.net. [2a03:2880:23ff:9::face:b00c]) by smtp.gmail.com with ESMTPSA id lr6-20020a0562145bc600b0068189e9d3a3sm995855qvb.112.2024.01.31.19.27.19 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 31 Jan 2024 19:27:19 -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, linux-mm@kvack.org, kernel-team@meta.com, linux-kernel@vger.kernel.org, cgroups@vger.kernel.org, linux-kselftest@vger.kernel.org Subject: [PATCH v2 1/3] selftests: zswap: add zswap selftest file to zswap maintainer entry Date: Wed, 31 Jan 2024 19:27:16 -0800 Message-Id: <20240201032718.1968208-2-nphamcs@gmail.com> X-Mailer: git-send-email 2.39.3 In-Reply-To: <20240201032718.1968208-1-nphamcs@gmail.com> References: <20240201032718.1968208-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 fecebfc4c0dc..5f60faaefaf2 100644 --- a/MAINTAINERS +++ b/MAINTAINERS @@ -24396,6 +24396,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 Thu Feb 1 03:27:17 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Nhat Pham X-Patchwork-Id: 13540592 Received: from mail-qt1-f178.google.com (mail-qt1-f178.google.com [209.85.160.178]) (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 EF3993A8E3; Thu, 1 Feb 2024 03:27:21 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.160.178 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1706758043; cv=none; b=Mljlj10a1MQ3IIh8aZKd8yBgLFHGCVGbSLr0chak085wYwiIXC4tMsff6U9MDGIvkVji419G4HI3HAT13HfIryiVlHoWf9LWeU9j94HLoUXyqUmV61rTFpD3jxJBJ4HIZiwv/gxfrej3E6rZ33cZm1UARFAYRJTkLmaK9BElKDI= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1706758043; c=relaxed/simple; bh=aTjkVj/ZHoE9XkKc3AYHVjvNxlRZrQwmqbrbwBElTkM=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=lW8k5VI6/4edqQLx5uxr7cgsJAAMXPMoe+Lkd3txMWa4efzHoxRkWR7FgSCzejq6c00EN2r+kVk35qCwMBIQPPJ9mHwhgaezV3afR192v65nc1aha7KlBC0aO4XvHy6SSxZfzESReT+WWx1sKCjg6cB3F9IyQb8apNHexOAktp4= 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=NJlGVuuQ; arc=none smtp.client-ip=209.85.160.178 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="NJlGVuuQ" Received: by mail-qt1-f178.google.com with SMTP id d75a77b69052e-42a99cbb4bbso12515951cf.0; Wed, 31 Jan 2024 19:27:21 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1706758041; x=1707362841; 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=NJlGVuuQZIHh+6e6TErOcbsRO6ygggxl9zgmJVSSjicqnq2Y73IN7U4RJOXNeRZFt2 vA0Vn4PiSdZSqs8ltB2w1R7tR4Dl7cbT2FF83KJ+UNmC+dNUVny1srhN1jRwDTBd5QXo dLvEGkvkVV4BlJQZ0XQwAPPJZqxhmO4D0LltyXqKBMscUNyrHvhShe49efmDjiVpzphe 0zbjl2FzHxI/2kMSxLr4ehJLmsyPo7/J9+bSndl7lRmZ+mRcxue03itcFyIMF09MM5LV RkESOx8FNQ+wDMbZ92To081zeA4SXHm9N9oZ4Y9o23Mr89fnBi9Wy4ExG3Y2tRNgxoNI ebxw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1706758041; x=1707362841; 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=k5zmCCwtk+wfeHbrAi7J2Wh9fk0uQDFitt/ngWDmaj5DvltMRnPQN7RM43G0r0gHgS 56oOJ3njF5TcFqD0ij86S4wRJromM9dHvKjFuIl2ts8946H/beR1iKMPpnisSJ+hZjum /NcJJi2NPXn7WexWVNfBMmomw3BD8qByvw9K96MJlaFYM2FizZoI7Zb9wHsn66gJ7WIn kbUm7oPKs30Se5qmRvWQuIDR+6z4JVZAEWAhwVqCfrFdrrMiUOdAcD647VI5oqLpv1WH p3oNjBs1FfguGVjn6igDSQITtELXOOTZEvJU/iqt4qQT86WoppvIN3hHLxnW9eQXE8tJ 8sNg== X-Gm-Message-State: AOJu0YxTUVqvdM+UiDM7FZPHQPiEQ2ICZZCuLD/xjm9nbJwWuFY//jLl pvrEwz+7Wl6/GL6RQjS4vSKRRJ1URkl3DX1vTOzADvgWCINsAuec X-Google-Smtp-Source: AGHT+IFqcvsUMZYFuYor0H/CUk+pPFiTZOgLITK4N4LX0rCJkB0og9Dc0BMcAnEw/g7377tApIxDQQ== X-Received: by 2002:ac8:4e91:0:b0:42a:8be3:7bf5 with SMTP id 17-20020ac84e91000000b0042a8be37bf5mr7486386qtp.9.1706758040803; Wed, 31 Jan 2024 19:27:20 -0800 (PST) X-Forwarded-Encrypted: i=0; AJvYcCUhQZ1N2tT05OGhr6lKJZ4MS4C5p6jdBy+kND1VAX4ngoMA+XrkdOs3Jg744crNHZzyvCprOvmjiuLtJzz3s8TbHfOILCF+L4ryeOSPQNu1G6rpAVnaTf5EwIk1236AKtJhY9dC5cAKJbkFeqzpU/XIe0SUvDzU7pGsQ6VHK6SWcSVXiGapUjqUPDr1AQ7m5yFVtOrXzWxAU6wW6GJDLOBsozLdNn7sOsPvRXI2WvFx8mYTD+AAqahUTV8tuAj/VA+zy0cKRWOt7vHwyvz+8xgfRQ5ZdbMFJxtZgajN7CPp/hlvE5+iuDy9xqx5rLrNZDIRDVEVi5j+zRX8ITtgcn8lbyXh5vY/HL90aQ3r/1lnDwTOzCt/ Received: from localhost (fwdproxy-nao-008.fbsv.net. [2a03:2880:23ff:8::face:b00c]) by smtp.gmail.com with ESMTPSA id ge10-20020a05622a5c8a00b0042998676bc3sm5570137qtb.43.2024.01.31.19.27.20 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 31 Jan 2024 19:27:20 -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, linux-mm@kvack.org, kernel-team@meta.com, linux-kernel@vger.kernel.org, cgroups@vger.kernel.org, linux-kselftest@vger.kernel.org Subject: [PATCH v2 2/3] selftests: fix the zswap invasive shrink test Date: Wed, 31 Jan 2024 19:27:17 -0800 Message-Id: <20240201032718.1968208-3-nphamcs@gmail.com> X-Mailer: git-send-email 2.39.3 In-Reply-To: <20240201032718.1968208-1-nphamcs@gmail.com> References: <20240201032718.1968208-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 Thu Feb 1 03:27:18 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Nhat Pham X-Patchwork-Id: 13540593 Received: from mail-qk1-f178.google.com (mail-qk1-f178.google.com [209.85.222.178]) (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 ED57E3B18C; Thu, 1 Feb 2024 03:27:22 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.222.178 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1706758046; cv=none; b=gM5PnzqvZTmik7dnJ8nUFSoW/uEY8I6PWlbdtOSVfQa4dQSNW9WTHlms3zoDFLZzxrOkKGapVan41y4G+7qzHP0NnrKng3/NIDDUCuR5cY1KAgMMsTMjsFLyDVdEehuKte+A1wqip9OLBorOFHpKb8ywxaMRZhB+O11scjWRcbI= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1706758046; c=relaxed/simple; bh=SleVqChczJMQNB2boi8n5e6NvqX3ckStjnVVeEsnqB0=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=GWNtqRi6JZosdlRfpOBqFrFI0YlkyJ0jvb8BTcyh2xJaO1CGyYOk5Ru2KXE+ktOjhtpjDwSI+l17z7E3+hHtEIjGPCo9gAn/QYyp1BtROm5CaAu7JADE03G1k/WaKWzUF5Fye88JB+ajnshf5PNFf1+IhlgKAU3J4NTuDuOseZg= 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=lsMZfNxn; arc=none smtp.client-ip=209.85.222.178 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="lsMZfNxn" Received: by mail-qk1-f178.google.com with SMTP id af79cd13be357-783d4b3a00bso35896185a.3; Wed, 31 Jan 2024 19:27:22 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1706758041; x=1707362841; 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=rTqBj0H08VxjpoFeh5ezYndc7+HSVccdU5yqVd6FGXw=; b=lsMZfNxnU3DyZ0qa+sQcgHVt65mxjGI0htzzqP9s7p7UaYHh/7T17kOK39Mi+soR57 NVOJ8FzS39P6rTlAS8z4lcIrI9THUbogVFIg9K0ENjZSc4xMR8Nb5ijx+R0GjS5kYxMb DMPbWtbE4yk3XQGtNC5koYhuUIuWUrrBzU2Plqf1l7HP0LrzjKe7w4v62Tegk9RToZLT NjjFxPgYliGwYU63Jzt8KXSzfATm6QnJXYgz/8i4mKbFUt0i4mLJqBqhJ/IBzrD8vUl8 /Q9fOkVguGWyUmWLehPeq/HTgmVv4lasKxcgMWOsPiDvALuwdF6bqMuiLkemLU4enmyy YbGw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1706758041; x=1707362841; 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=rTqBj0H08VxjpoFeh5ezYndc7+HSVccdU5yqVd6FGXw=; b=evQLl67v42pF1HCHuf2WrB7Gt1e2r1JTQsfRgfOHoAsIMygcVhpu9HbKRskLIaArh7 NA5IRr8ETPqupcQsWhM/vT9YZuqA16cidSC5g4ftBZcq+Fkf/iqJmW3SQa+kPEaqaufG s6RSKJA/PMqCQ1GobfXGZotbuOzg4lsAjbLMJ5XraKAwpL1lToFKb8tC1HME24ciCVQT RK5aK35U43lkFVPxRtZpr+uK1UFkjQW8YIFa2DKJaAE4xONcMbTPfhZ0eV/kExfa3u0f /f6dmvmb1MbTx2HlPJ53tUFsUPNLt3LRqQ/DqRGO2ZBfVUVWZyNst/PFPJpFfOPc5FB1 ktBg== X-Gm-Message-State: AOJu0YzgsuOv3hmmVnAZnTT6KymNgGWfebzzB548eQPpjBQh8UKZPm1z l1991ift+CA+ef5RrIXFv+OlqGF/7a7xV4pKrv7mqeSnfjb6W+BN X-Google-Smtp-Source: AGHT+IHPWXSjkdUZuigp/9B7j6ivfpKy5HxAUMa6O9hLIMzhBIt/uWnFjXMQetpqhcvAu9PSMKwhVQ== X-Received: by 2002:a05:620a:4148:b0:785:46f0:615b with SMTP id k8-20020a05620a414800b0078546f0615bmr358625qko.2.1706758041672; Wed, 31 Jan 2024 19:27:21 -0800 (PST) X-Forwarded-Encrypted: i=0; AJvYcCUIv71tJwO29OMitKPFnpPOCXCL8BuVktI6doG1tJVc7/qR+y0O1AXR3wBOmsC4Qpffj7sUQ/KvOHDJ3cjhityaWK8c6DQta2mok58PQKzyNMRYi0NBxE+fudr705gyldiLvtVDxeVD4Y/YBHb0b/QTNJBIXuB6UgcZyUeKMza5ekf49cqVqrwZ+yFdNzpD4eR3WySWDx0k6eHPjVEjtMAYQMMFpHdujzSNJ24YQgSlib3EdrjukJE9XYj5tQUTBP7eM86wjlW/Eo9XAjgXgVqReu2zzRc0V4aBxOGW8RQSM8/9+pDlticWA+KTxQANd6ZrLRySCqgVqZR+0qhBBavYdTkV8LgIibWRilyUHyT/2lAZKZI/ Received: from localhost (fwdproxy-nao-009.fbsv.net. [2a03:2880:23ff:9::face:b00c]) by smtp.gmail.com with ESMTPSA id v18-20020ae9e312000000b0078535190648sm1450417qkf.67.2024.01.31.19.27.21 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 31 Jan 2024 19:27:21 -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, linux-mm@kvack.org, kernel-team@meta.com, linux-kernel@vger.kernel.org, cgroups@vger.kernel.org, linux-kselftest@vger.kernel.org Subject: [PATCH v2 3/3] selftests: add zswapin and no zswap tests Date: Wed, 31 Jan 2024 19:27:18 -0800 Message-Id: <20240201032718.1968208-4-nphamcs@gmail.com> X-Mailer: git-send-email 2.39.3 In-Reply-To: <20240201032718.1968208-1-nphamcs@gmail.com> References: <20240201032718.1968208-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 --- tools/testing/selftests/cgroup/test_zswap.c | 97 +++++++++++++++++++++ 1 file changed, 97 insertions(+) diff --git a/tools/testing/selftests/cgroup/test_zswap.c b/tools/testing/selftests/cgroup/test_zswap.c index 32ce975b21d1..14d1f18f1098 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_bytes_and_read(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; @@ -133,6 +154,80 @@ 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 zswpout; + + /* Set up */ + 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; + /* Disable zswap */ + 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_bytes_and_read, (void *)MB(32))) + goto out; + + /* Verify that no zswap happened */ + zswpout = get_zswpout(test_group); + if (zswpout < 0) { + ksft_print_msg("Failed to get zswpout\n"); + goto out; + } else if (zswpout > 0) { + ksft_print_msg( + "Pages should not go to zswap 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_no_limit(const char *root) +{ + int ret = KSFT_FAIL; + char *test_group; + + /* 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_bytes_and_read, (void *)MB(32))) + 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 +404,8 @@ struct zswap_test { const char *name; } tests[] = { T(test_zswap_usage), + T(test_swapin_nozswap), + T(test_zswapin_no_limit), T(test_no_kmem_bypass), T(test_no_invasive_cgroup_shrink), };