From patchwork Thu Jan 25 15:46:06 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Muhammad Usama Anjum X-Patchwork-Id: 13531196 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 D0485C47258 for ; Thu, 25 Jan 2024 15:47:08 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 6EF876B0088; Thu, 25 Jan 2024 10:47:08 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id 675F66B008A; Thu, 25 Jan 2024 10:47:08 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 4C8306B008C; Thu, 25 Jan 2024 10:47:08 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0016.hostedemail.com [216.40.44.16]) by kanga.kvack.org (Postfix) with ESMTP id 3AAE46B0088 for ; Thu, 25 Jan 2024 10:47:08 -0500 (EST) Received: from smtpin19.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay01.hostedemail.com (Postfix) with ESMTP id 0B7D21C1810 for ; Thu, 25 Jan 2024 15:47:08 +0000 (UTC) X-FDA: 81718262136.19.6F6DC40 Received: from madrid.collaboradmins.com (madrid.collaboradmins.com [46.235.227.194]) by imf15.hostedemail.com (Postfix) with ESMTP id 4CB39A000D for ; Thu, 25 Jan 2024 15:47:06 +0000 (UTC) Authentication-Results: imf15.hostedemail.com; dkim=pass header.d=collabora.com header.s=mail header.b=2t58O5rm; spf=pass (imf15.hostedemail.com: domain of usama.anjum@collabora.com designates 46.235.227.194 as permitted sender) smtp.mailfrom=usama.anjum@collabora.com; dmarc=pass (policy=quarantine) header.from=collabora.com ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1706197626; a=rsa-sha256; cv=none; b=1fD3B9b/onaQChj4FwzGCWdUglJPdN33MEtmej9U1G6b7Px35IDrks2mVOCNUzjoslOcLo aJqS72tNhxzndavzc6N/LueaG72b2EN4KRqp5Ml9UB68UJrVnh1yLEOOsNQ+W2Q9xhIf/V FpvaCjRnCmDmtGlK4RCcyST/VurZuzk= ARC-Authentication-Results: i=1; imf15.hostedemail.com; dkim=pass header.d=collabora.com header.s=mail header.b=2t58O5rm; spf=pass (imf15.hostedemail.com: domain of usama.anjum@collabora.com designates 46.235.227.194 as permitted sender) smtp.mailfrom=usama.anjum@collabora.com; dmarc=pass (policy=quarantine) header.from=collabora.com ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1706197626; 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=VSJWOmgWC2wctOCOsPxVkoo+LPGu6ecOAffSp51N7Z0=; b=Fs0UiCwdktSZNWxZ/L0JZyS/4HajF44q9p6tmkn+NWekuCaoPqCcdVhDmHsD5KPLWqohuv 4PIMyoKppCXOUjEsPK24ut4ejVISjkVl2G/Nh3M/V0saKiJ6u/EFVw67ujhcqqCVuSk8jF whYKbhLI+U3zwX9fnbyYUE/acCPKk+Q= DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=collabora.com; s=mail; t=1706197625; bh=nBKP7IMGZyOm1MyLruyEwVqUb1qwqC4I6GuPQzc7lR8=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=2t58O5rmI0tgzLH867h7Hn1M6kVNfXg1lLkW5aaSJ8kOIiA7i+8eEoF3VLDSUN2YQ rpGl7lW1gSYk0OZ1ETs03ckogi2nJ5ycgSeSn39pps9LUWj0OfukoVRqQb1/GfIjku I01q0SqMuZuDp4+or5ccXYBmncJ+FQqJj9JlI3PZNo5nhx1E0c/BcucoeKymBz0ezx A3gIX+8D0HPlvB0IYxnNE/x7ShLnKeOT+4wIZ3oToniYvO6c8v8d0qqFROpGcfXJ6u HvTikaoKxhWZdkpUapnHgaU4FF+KRK1NMkZ5QOvrnxgaYCi5tPlV0hgP2NOopk93PQ Yc+b6VjbTAWKw== Received: from localhost.localdomain (cola.collaboradmins.com [195.201.22.229]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) (Authenticated sender: usama.anjum) by madrid.collaboradmins.com (Postfix) with ESMTPSA id 8756D37820C5; Thu, 25 Jan 2024 15:47:02 +0000 (UTC) From: Muhammad Usama Anjum To: Andrew Morton , Shuah Khan Cc: Muhammad Usama Anjum , kernel@collabora.com, Ryan Roberts , linux-mm@kvack.org, linux-kselftest@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH v3 3/5] selftests/mm: save and restore nr_hugepages value Date: Thu, 25 Jan 2024 20:46:06 +0500 Message-ID: <20240125154608.720072-4-usama.anjum@collabora.com> X-Mailer: git-send-email 2.42.0 In-Reply-To: <20240125154608.720072-1-usama.anjum@collabora.com> References: <20240125154608.720072-1-usama.anjum@collabora.com> MIME-Version: 1.0 X-Rspamd-Server: rspam08 X-Rspamd-Queue-Id: 4CB39A000D X-Stat-Signature: inuntty89zphr9h9stucxqyj1q677sk8 X-Rspam-User: X-HE-Tag: 1706197626-46094 X-HE-Meta: U2FsdGVkX19Qu/PwQvJQk/qKVpcvzTaf5VEOnX2DnttrJfiWmZ2F+wmwwffJsonvA3FL5sv+0kzOOWiDY1qj6tJoLFqw84U4XSLbr2p6syA1jjnM/Ozuokx5MTa1r8Hiv1sKdvif8Wd+PhOQqUsT/enFhTanCMLIDB2TotbGHnI0vUIZfUQyuV18MB2AgitNTvvA4izk7FPQW8x6Az7zj2ygnjRgB0Vv56v0bKT19yunJK/wg3JLSj8aj+zgAy+a9ebRE8Vr0OFH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ner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: List-Subscribe: List-Unsubscribe: Save and restore nr_hugepages before changing it during the test. A test should not change system wide settings. Signed-off-by: Muhammad Usama Anjum --- tools/testing/selftests/mm/charge_reserved_hugetlb.sh | 4 ++++ tools/testing/selftests/mm/hugetlb_reparenting_test.sh | 3 +++ 2 files changed, 7 insertions(+) diff --git a/tools/testing/selftests/mm/charge_reserved_hugetlb.sh b/tools/testing/selftests/mm/charge_reserved_hugetlb.sh index e14bdd4455f2d..d680c00d2853a 100755 --- a/tools/testing/selftests/mm/charge_reserved_hugetlb.sh +++ b/tools/testing/selftests/mm/charge_reserved_hugetlb.sh @@ -11,6 +11,8 @@ if [[ $(id -u) -ne 0 ]]; then exit $ksft_skip fi +nr_hugepgs=$(cat /proc/sys/vm/nr_hugepages) + fault_limit_file=limit_in_bytes reservation_limit_file=rsvd.limit_in_bytes fault_usage_file=usage_in_bytes @@ -582,3 +584,5 @@ if [[ $do_umount ]]; then umount $cgroup_path rmdir $cgroup_path fi + +echo "$nr_hugepgs" > /proc/sys/vm/nr_hugepages diff --git a/tools/testing/selftests/mm/hugetlb_reparenting_test.sh b/tools/testing/selftests/mm/hugetlb_reparenting_test.sh index 615c4d766c909..11f9bbe7dc222 100755 --- a/tools/testing/selftests/mm/hugetlb_reparenting_test.sh +++ b/tools/testing/selftests/mm/hugetlb_reparenting_test.sh @@ -11,6 +11,7 @@ if [[ $(id -u) -ne 0 ]]; then exit $ksft_skip fi +nr_hugepgs=$(cat /proc/sys/vm/nr_hugepages) usage_file=usage_in_bytes if [[ "$1" == "-cgroup-v2" ]]; then @@ -252,3 +253,5 @@ if [[ $do_umount ]]; then umount $CGROUP_ROOT rm -rf $CGROUP_ROOT fi + +echo "$nr_hugepgs" > /proc/sys/vm/nr_hugepages