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: 204561 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:7300:aa16:b0:108:e6aa:91d0 with SMTP id by22csp29484dyb; Wed, 21 Feb 2024 20:31:50 -0800 (PST) X-Forwarded-Encrypted: i=3; AJvYcCVfIXo+0GLHk8JWek1FEYWPP7o69jmItYu3GJPAZV7naZFBRHiBSkfiU+O0YDy8m3Dq493AE/2dC8CRRp3wpDmc92HPeg== X-Google-Smtp-Source: AGHT+IHS2QfcDmoydXRw/KYJ4Us0OB5lz9CK3GiJW3FfeULKgPYAt+8i3/nQ1ObRk1FrE7P9JjFZ X-Received: by 2002:a05:620a:d5b:b0:785:d4ad:f3cc with SMTP id o27-20020a05620a0d5b00b00785d4adf3ccmr21735403qkl.14.1708576309909; Wed, 21 Feb 2024 20:31:49 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1708576309; cv=pass; d=google.com; s=arc-20160816; b=0DNoR1gGXiyFxsxr63kHBdMgOduXSCJiBd8cnYHn2HccnDFLCiLU5+d2fTfbYKQzgd OaPAbmuge+8Wopw4MsORrvqvQtA9KP4cKK121jnZoB0LXMLBEcf4SopA1tVO9+7UAuSY +sf4GONFthGqwLo4loq053MiIVo8CrwPrs41eirqRepjmnyK1MRgHA4YNMknoYhd8lxV 8GbiRjQemwt8UGXyXTP6G2Uv5yOd/H40zoZ471bT5OjgoyDUKG/5EINIHNVS8wL9VIRK c6VKV5cF1njlTqLqQcordu50fML63s4VjaSfSg9OEVwKgxB9FBwZB8ngIDgt+AlY5bAM 8Waw== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:references:in-reply-to:message-id :date:subject:cc:to:from:dkim-signature; bh=1qe6sezPW9Q3wTsxfWJprqeu8KJLsVxqYQYWx727S4g=; fh=XA6bafken89SRrUeD58unevPCvbiPz6gyVYXCOZZ6aM=; b=04RAYT8r/B941CJJjpnz8l9PFG1Dch/01L7IKqjIsQ6wf9BdTRW4VLPgiN1zOBCzoI 7QRUWemKt1k2brw+c+wckhxf/KOex23anMyZZ5cDnihVdwEkz4KMHS1rlkIA68a2SZDJ 3fVHgWBJSSh2AOYdq/Q17b/g0rTp6DHvDlEctf0HooLWXE2pc18ZB8PxhmNbCISFnAQ3 vKsUFBgLOXJtXYWVpn2OjRwDBoJu+jafupY1WmKyZ9q0XfRTabq+WFBZoiIBTC2y1kIa fDxefYN6QeT73xPpRtg3YStG3+6e+UI9RUNBsUjlcBThkcrVwdqLWkHXpyfQOsUUsGrC smbg==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@gmail.com header.s=20230601 header.b=E0JoAUak; arc=pass (i=1 spf=pass spfdomain=gmail.com dkim=pass dkdomain=gmail.com dmarc=pass fromdomain=gmail.com); spf=pass (google.com: domain of linux-kernel+bounces-75898-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-75898-ouuuleilei=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: from ny.mirrors.kernel.org (ny.mirrors.kernel.org. [2604:1380:45d1:ec00::1]) by mx.google.com with ESMTPS id op36-20020a05620a536400b007878204c68bsi3466973qkn.662.2024.02.21.20.31.49 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 21 Feb 2024 20:31:49 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-75898-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) client-ip=2604:1380:45d1:ec00::1; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20230601 header.b=E0JoAUak; arc=pass (i=1 spf=pass spfdomain=gmail.com dkim=pass dkdomain=gmail.com dmarc=pass fromdomain=gmail.com); spf=pass (google.com: domain of linux-kernel+bounces-75898-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-75898-ouuuleilei=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ny.mirrors.kernel.org (Postfix) with ESMTPS id B15531C220A8 for ; Thu, 22 Feb 2024 04:31:49 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id A605010E6; Thu, 22 Feb 2024 04:31:40 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="E0JoAUak" Received: from mail-pl1-f181.google.com (mail-pl1-f181.google.com [209.85.214.181]) (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 8166A382; Thu, 22 Feb 2024 04:31:36 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.214.181 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1708576297; cv=none; b=ajzOzz1z407IVGV0Da7zPGRZeN80IAR53DGDmhjNWNgaWvakOos7AAJYhO4qw/rftndJOxr5l86Mg4WXyOx7aZtU0JizREfL1tTare/hS9XwAMOZ2E5VjUSG2qJUalQULcj/dGZpctJYMphabA0q72XwFxuoRD7dfTZCZeXnXmI= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1708576297; c=relaxed/simple; bh=TcxyxtMCbWKsSZiCUDElieO84b/6DAH0dX5gHM8ttJw=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=PpBzJiJEZOjgjx6R0OCXzBIOeRZI/PNtQhSKAEEpvBjxmyX+QBieDP+ncDOSunybBE6B+UKfAuu7yLQ9r4IfWGazD831flFus84oqVdjcabLI1PX4Gt2b0bG15h5gw3BpbWDgSf14I0rV9Y4ivHuouKJzMPhULcLf1sydfLawKg= 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=E0JoAUak; arc=none smtp.client-ip=209.85.214.181 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 Received: by mail-pl1-f181.google.com with SMTP id d9443c01a7336-1dc1ff3ba1aso20445315ad.3; 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=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=1qe6sezPW9Q3wTsxfWJprqeu8KJLsVxqYQYWx727S4g=; b=E0JoAUakPUxqeHintqW/EHQWOLTDkdIDdcf3iCScb5k4OAGX9d/ZPRIRcs+1+OBnqs UrgaspMrfPt407lz+mLhI8O9pZm1yyOLqm3exAs9ZTRrhGZP4eRSMfwKo5EZxVATH362 /QmGXj36IZP/MqPqwtCcqB8OSQqQHbs+fkJB/M6xmvNm0H+uIZ+71NLJoig+esj+Ig1F bI30fkTeAe94Yu4QcxRcnWSEnHq+jNDfwGttpVzWEuiV7lO94yJ6hLp5Uy9eJn9BX06A 2IhMUXcH5mZXNe0MGjq6U5wngBs0bpXbtRIMAG5gKt1xixcvm32/Id7hY0gzk8IdCtdf O9sw== 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=wu/RgrQ1BqLTXbSVUXcD0ybt1rXApm9TJrPGBc09rbpCTumRO3REG6Q8iyC/F+XxXg zKKXe15fx9D7q+8rj6nhbRzbkiYRoF3biiEyYRvEPEBv1lGYfxEhBMovRW9XITXA6Gsm 08B/hvh3Oo0u1qBmoSsdVyw439MHJM2O1LVOmmNEe8/c+aJ8mQ9nZ9Z0nEhgQGgMEKw7 BxcI86ky6fvJ6/PMyM90McN+bD0Dy/fmT1TsanFQt5naiDosJ4OzY0y/47Rrg+VcdnJl tNczc3SY7mjn3c3c9GyHr0JJb+Su0EA0XMDxw07OvstF2JudNPe5lvbIIrUzgdt8NOId 3etg== X-Forwarded-Encrypted: i=1; AJvYcCX1PcegUacOu2G4U/DVB3i5oLAmm5MecVfupYB0mcxm08F/DQJhUqeeY5IxM+Wayxx/sid/bP53+/RwiBe/drYpECPP32DaKV0Z64pIQfB20xmaAn5PDevXpJeqA3/KXbgVdk6lRFaANaYO7QqQioOklMrIUfJHroqi6yl8hlN+mvq12WCV0g== X-Gm-Message-State: AOJu0YxEnOouD8+PkXaND97RRm70cMP/IEeXp376VCCC/8cmGq8eWhUq zO+9eSIQHWEe7rdu8Tgzcxf1poh+Yig2G98VK9AWNdSHKwMw/KG/ 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> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1791572113015158858 X-GMAIL-MSGID: 1791572113015158858 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;