Received: by 2002:a05:7412:3290:b0:fa:6e18:a558 with SMTP id ev16csp43682rdb; Thu, 25 Jan 2024 07:48:03 -0800 (PST) X-Google-Smtp-Source: AGHT+IERt8dOoSTCN68WCLIRKHv8O+tB6801psgKuHR8V2sM3WD+Ko10FQkeD/4Z6aM4L3apgY4P X-Received: by 2002:a17:906:dd0:b0:a31:3a85:c5dc with SMTP id p16-20020a1709060dd000b00a313a85c5dcmr753842eji.51.1706197683032; Thu, 25 Jan 2024 07:48:03 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1706197683; cv=pass; d=google.com; s=arc-20160816; b=zxY5EVoSfiMiqMUl1yCABqHh3qgTtBD8BljhBBn6+cbxP089HKOlvSzX1DkxDWEUWJ l1dusgn1KsYZnuKVjZJDOsDrWq2t/DQb40jJSeJFxy4GaB93bM2yUSEY5ntf5oDbwfV0 yNYHS4CodcRWTi0pDsVPmoCbLqAoy+6yzKP8k/eg5cTLVZFupaYsJ/Tyt5kolxbwXrhh UiPz3/MIQBTpX57xMcxmiXMBhfAI71YzOkj0pyvS0mu0Ea77idczQOikNc3JKHIUXMKW Oi3xzTCEzXpjMoxBPTwrNNW1TgDM1H2/avfPMMKBa2XaHh93CNIaJhn1A1NjikfiRne2 eVJw== 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=VSJWOmgWC2wctOCOsPxVkoo+LPGu6ecOAffSp51N7Z0=; fh=GI+QUBHPqwETgj91+OjmAHfGmBmxeZg5KGm08En4mD4=; b=QmucRwLGFUoenoTXmrwvJ5htOTsAjpvBXKf6+3QZMPdc5wIBGWHmF6oMyu/5ZL6uSz TWQGD4WpJuKKkDtl7h5DW5rgUEFBCqvBAGVE8AKazdF3wCYzwEMIMsFOwxX0NOrGVC+D kgsZIiQBg+K9OXYIZqDo2q2uq75OcMXLDR9oFct0dnZKXv59EvPkCVDi4xoZVXoU0dMq J6OkV/0w5DBEhN8Z3qdbIe/2+ShaCfJV2BFm5cVv8Vzo3D5TpxAV6uSwSDnii6IzFjg+ 5wJd423faBRdCeePrxnKEoaWKGBV6Mn9es+L4B9+yOJrbfckCod9YmWMi3JbKcco3Iet likA== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@collabora.com header.s=mail header.b=2t58O5rm; arc=pass (i=1 spf=pass spfdomain=collabora.com dkim=pass dkdomain=collabora.com dmarc=pass fromdomain=collabora.com); spf=pass (google.com: domain of linux-kernel+bounces-38845-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) smtp.mailfrom="linux-kernel+bounces-38845-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=collabora.com Return-Path: Received: from am.mirrors.kernel.org (am.mirrors.kernel.org. [2604:1380:4601:e00::3]) by mx.google.com with ESMTPS id b11-20020a170906038b00b00a2361a30b82si1027137eja.875.2024.01.25.07.48.02 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 25 Jan 2024 07:48:03 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-38845-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) client-ip=2604:1380:4601:e00::3; Authentication-Results: mx.google.com; dkim=pass header.i=@collabora.com header.s=mail header.b=2t58O5rm; arc=pass (i=1 spf=pass spfdomain=collabora.com dkim=pass dkdomain=collabora.com dmarc=pass fromdomain=collabora.com); spf=pass (google.com: domain of linux-kernel+bounces-38845-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) smtp.mailfrom="linux-kernel+bounces-38845-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=collabora.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 am.mirrors.kernel.org (Postfix) with ESMTPS id C4EFF1F2141B for ; Thu, 25 Jan 2024 15:48:02 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 5A83076901; Thu, 25 Jan 2024 15:47:09 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=collabora.com header.i=@collabora.com header.b="2t58O5rm" Received: from madrid.collaboradmins.com (madrid.collaboradmins.com [46.235.227.194]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 217E9768EA; Thu, 25 Jan 2024 15:47:06 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=46.235.227.194 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1706197628; cv=none; b=mCKFXVM2DZp32jzPyfob0sQQmzkgzr06/wiXlKl5hqZHTNnHmMNrMtbvYbj2+PbaoOB/G70eMDNKCA6dGKMZxJmZB4SiP5yV1IE7X05vkhqFgbQq0xpYbZ5FUhWL2nVVCDTly72H9UuOPZQpLiD+3pm9xPC+SZ4r0kqFrvroJlU= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1706197628; c=relaxed/simple; bh=nBKP7IMGZyOm1MyLruyEwVqUb1qwqC4I6GuPQzc7lR8=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=pj3PAGaXlhq1SUnuq2t2BlAviDAzm6iXMd1lnGtu1VmhcYd6seft5NF2BxFy32YcIz+u9BWBeyvbeieEoE13WCvcgDJAxRz9ICsRp4F2JnwieG/6dKetycTSAFlU6wJmLzYPOflybFZtNIPGyA8tY/5n382RhTyP5lmXKpyp6ds= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=collabora.com; spf=pass smtp.mailfrom=collabora.com; dkim=pass (2048-bit key) header.d=collabora.com header.i=@collabora.com header.b=2t58O5rm; arc=none smtp.client-ip=46.235.227.194 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=collabora.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=collabora.com 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> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit 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 -- 2.42.0