From patchwork Thu Jan 25 15:46:04 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: 13531194 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 1DF73C47422 for ; Thu, 25 Jan 2024 15:47:04 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 90F5A6B0080; Thu, 25 Jan 2024 10:47:03 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id 8BF246B0081; Thu, 25 Jan 2024 10:47:03 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 787AA6B0083; Thu, 25 Jan 2024 10:47:03 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0017.hostedemail.com [216.40.44.17]) by kanga.kvack.org (Postfix) with ESMTP id 5F28A6B0080 for ; Thu, 25 Jan 2024 10:47:03 -0500 (EST) Received: from smtpin16.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay03.hostedemail.com (Postfix) with ESMTP id 0C3D4A0D89 for ; Thu, 25 Jan 2024 15:47:03 +0000 (UTC) X-FDA: 81718261926.16.6C3E49D Received: from madrid.collaboradmins.com (madrid.collaboradmins.com [46.235.227.194]) by imf25.hostedemail.com (Postfix) with ESMTP id 55B43A0004 for ; Thu, 25 Jan 2024 15:47:00 +0000 (UTC) Authentication-Results: imf25.hostedemail.com; dkim=pass header.d=collabora.com header.s=mail header.b=Cvs8XYav; spf=pass (imf25.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=1706197620; 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=QPNNBb1AllwHWpUSkWP0hf0fqhJdOhcnqOK5Ovk6pwA=; b=3mjbPsssGuOcUKpI5SoxX2IWM6Z1OgXr0P8jBSRQ1myD1Eulb3fC+3hci27cVImUiS4MQg VKP9Ujz9WCgD/Bi8pDCkTveIra5K0n3VEVX9zs3hBTnRD57kSjHUxS8YMvIVo3bdvM0TxH 7n/6M7TwVz6whgRMrTFfVFQtAxwcz1Q= ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1706197620; a=rsa-sha256; cv=none; b=MnnBUgG2Wa3IoRZkTiCJZkkaZ7tWPDM+CaT9pN9uGDoFDzcIvRye3YcORMX3JDDu9Fyo+5 Rm3arwhis5Xs6r5dNjIej/ukBvnFp5ZVVhlRQ4TotryTTX9fBwxRuB5pEdHJAOXzOcoPkq fejgsgXs9AShFcVgUOJ1VYGxffQErC0= ARC-Authentication-Results: i=1; imf25.hostedemail.com; dkim=pass header.d=collabora.com header.s=mail header.b=Cvs8XYav; spf=pass (imf25.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 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=collabora.com; s=mail; t=1706197619; bh=0g3nVHgPakWyFnqmE2VOcV8rmzcy5ewq0uXokzf81Yc=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=Cvs8XYavKfSBYNupi+Y+jbticrVBzIq3/yAmyVcSx3LYyVZcGy96fS24P7TGVvBgy Jry7K08jTUcOxf0EOeYzhp4qxuN0y+mD1rcLe7W5Xl3VnFgzBS/qSlHPAonYzQNNt+ 1KbyHIFFP5BLTrGjyPMEgMggflI5GVzYkfIMofCLTcwIKGi4jceA0K595IfzN74IBz R2ORQGztFyx9++HTA9voZZnYjutxu1Rh00Yvf/okggzIV+FDKSmTPodtTXiIMW01Ns DJ9BHbBV254X7VWqFvTHbqGaNfZy1Dx9Xl14KpSYc+8KgdwP7pvwE/TtQKMenhNjk0 IDLS2029Ueu1w== 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 6475837820C3; Thu, 25 Jan 2024 15:46:56 +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 1/5] selftests/mm: hugetlb_reparenting_test: do not unmount Date: Thu, 25 Jan 2024 20:46:04 +0500 Message-ID: <20240125154608.720072-2-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-Queue-Id: 55B43A0004 X-Rspam-User: X-Rspamd-Server: rspam11 X-Stat-Signature: sxej1skr8oz8me3dgr75x6msm8nuqf3h X-HE-Tag: 1706197620-727446 X-HE-Meta: U2FsdGVkX1/6SpCPgk1uDgbHuOkEb44/ijPMpi6Y8+srcUBQnOSASEnFUXnUBjucO0a3SspHzY9RCMnJVozZhB58Ks3Wa3xtoxeSOgArVAJzvUtmsDSblyMeLP8qpTHAc2v9BhU5O34f17mGg36L3FnU2dqGqVQd0U8XzzDBMvbqKefImjXlaIgtqxLyLYAgaefas47rtb4qIfD7VbTDXcLUMDNiOzJ/adOWzPXuwE94FC6a0PwoWqZcp3gDyC7itkaaL2ROpLyE+MIuv0C4I10fWJkNs+heNBgfU8zmkeIoP8ijKMkA9cpnwRSP+3aoEm67mFBT6DhWsUoLIGrBc3gE5LuDYUpSdSCuzCBG47BTgTR2QtSglJp/nriN2xL4urwjprkPXNvztM0AyYxRqnQkele5VXHSz6/clzV6YGakYJ2Uv5xlaGX2M4AlmiC2NGEiXQJtxrMgarO1cXO9I5BizooBE77cyA3qd3RipwKnWn5+omPgqM3TCXgFi6S2qyV5gUYvDpOfuZ3rR1/nIwbEsjfEyghO9K4G9LUAuEFhfItU5zE5tgEU9UsIRd+ewLZ7QIrb10IV8Xw/154pNSWD8AiisMIbuQK6KIlNLlyMSJhXMLAOOFTxGg3auyNYLmj6Iy+bDmb3BT804IQKYJ04u2vK+u8YEe5n8IfilNJrrILKUP1NbhhHe3L9zdrYHrbr4mU2tWcW0jkTGEioxqx+YMAY/Qo0jNk/dLnUElXjdj0tb6clj/W8t8jIDfGIiAYYkSksB1hJrUvF/ahvSILu7OyaC0aFctevwclwG6jeM1gHSfngJH9xwNucZmov2ZIRJKG2HifDUS6sIu4cUz0/0h/YNL9dDa1WAnl8us+B5bID0CgdvDXFV9IyulUfDKkTPDC72xLhzKzPz8pLvau4yVZoysWP6g+LlAl43ifKSrFtpIRc4oqDqhMl1dXusqgpe04ESZlm+XHFWhn iKSWoVyl V7mnsk3K4FWn9GFZZ9Dxsuuxt0gSrPSxrLRYOoGKs7rI3fxsXH17H5bu8dM5PoKVcoQ/tN7KuRbIEWJbXE/ndkzz/5P1Tyc/sKrbWBAs9OVj/KfovHAOnrXAR1ZnhlOL8qPH/lXQjCxc3CReJWXKiNaezITIhLg7mrtQu5SoHDdMbybxHL9bL97drRKTiCWihVX5Be11IiM1nZt8ImEfHbKYWdPAnV9a23YWTszTJZMXyWK6F7S99qbvMexyhic1W1crzwZLqt4SNYfrg6Br7GJb2kV49hlMLr8k1kyJXvEALUe4= X-Bogosity: Ham, tests=bogofilter, spamicity=0.000000, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: List-Subscribe: List-Unsubscribe: Do not unmount the cgroup if it wasn't mounted by the test. The earlier patch had fixed this for charge_reserved_hugetlb, but not for this test. I'm adding fixes tag to that earlier patch. Fixes: 209376ed2a84 ("selftests/vm: make charge_reserved_hugetlb.sh work with existing cgroup setting") Signed-off-by: Muhammad Usama Anjum --- tools/testing/selftests/mm/hugetlb_reparenting_test.sh | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/tools/testing/selftests/mm/hugetlb_reparenting_test.sh b/tools/testing/selftests/mm/hugetlb_reparenting_test.sh index 14d26075c8635..615c4d766c909 100755 --- a/tools/testing/selftests/mm/hugetlb_reparenting_test.sh +++ b/tools/testing/selftests/mm/hugetlb_reparenting_test.sh @@ -248,5 +248,7 @@ cleanup echo ALL PASS -umount $CGROUP_ROOT -rm -rf $CGROUP_ROOT +if [[ $do_umount ]]; then + umount $CGROUP_ROOT + rm -rf $CGROUP_ROOT +fi From patchwork Thu Jan 25 15:46:05 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: 13531195 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 BA85CC47258 for ; Thu, 25 Jan 2024 15:47:05 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 47CEF6B0083; Thu, 25 Jan 2024 10:47:05 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id 3908C6B0087; Thu, 25 Jan 2024 10:47:05 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 209A36B0088; Thu, 25 Jan 2024 10:47:05 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0012.hostedemail.com [216.40.44.12]) by kanga.kvack.org (Postfix) with ESMTP id 0E79D6B0083 for ; Thu, 25 Jan 2024 10:47:05 -0500 (EST) Received: from smtpin01.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay05.hostedemail.com (Postfix) with ESMTP id B6D2440884 for ; Thu, 25 Jan 2024 15:47:04 +0000 (UTC) X-FDA: 81718261968.01.3687950 Received: from madrid.collaboradmins.com (madrid.collaboradmins.com [46.235.227.194]) by imf13.hostedemail.com (Postfix) with ESMTP id 272D320008 for ; Thu, 25 Jan 2024 15:47:02 +0000 (UTC) Authentication-Results: imf13.hostedemail.com; dkim=pass header.d=collabora.com header.s=mail header.b=bWAq2bSV; spf=pass (imf13.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=1706197623; 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=uilryMeodp0O80cLkN9ybFWwLPFVf+owRaEV1bjSCww=; b=AdY4/pFPl1jO/YY+5uf4ecdebVVApHbg3QmLYDV5tihE3rBUPp55jgHpf3jgSmeD4OObbS Mok5w12eS6hSIJBWpWOa5qWogBWh8bnAMiEswIbPPFO4ekD8lahg1TKjbWn41YoDOk5iT4 XrZQfjAqAyyS0zTliC6jnMsIUrZqgy0= ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1706197623; a=rsa-sha256; cv=none; b=akycAkAnbEJHXfOg8CeMeya9xyyQnF+5T3P2u2cIODVBbiaWTarL5aw62DrdhuuAdCFdiV othyHUezOHlpfdWlB0YiJEPi9Wfh5nHNSTlpUiOgr4qLdhDkOHXav1+IpQ8byupwbN14pe HZGaPoj6Aspd4WMeewY4WpI60J5fXj0= ARC-Authentication-Results: i=1; imf13.hostedemail.com; dkim=pass header.d=collabora.com header.s=mail header.b=bWAq2bSV; spf=pass (imf13.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 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=collabora.com; s=mail; t=1706197622; bh=gyo185f2D57JFqFMORChf4Ercnde+3pA9Al2pF3TwpA=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=bWAq2bSVSNCidNYDMrbqrdFFYzZv9pb2h4iaMc9m0oz1yYUMZ04MoVMg2XeWwcSjo 0lU9piRePhdrqJu0+OY3mJdi3xxUuIbomGx8+n6jXUyeQprrjSxTls49AQcw1M8LK4 4SUMj9IdkpS1cA++zEsNfbx7qU+CcHReDQoDQBFjzv5h+UInk3WPc7lzNZJ4QqveJo DY7Svwdpco2q1EtJ+6cKdLlhsZCDDAKiYQiBnG2hwNXdwkW9O8h9Dh+REFQZPWiBov zSX4aH9PFjdu/KAgVspHZ/74zXc6rAJrDlZUAja8f8TiW+lnTZKPpYzwEwT/fzogGX wiUDegEf7obLw== 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 757F237820C2; Thu, 25 Jan 2024 15:46:59 +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 2/5] selftests/mm: run_vmtests: remove sudo and conform to tap Date: Thu, 25 Jan 2024 20:46:05 +0500 Message-ID: <20240125154608.720072-3-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-Queue-Id: 272D320008 X-Rspam-User: X-Rspamd-Server: rspam11 X-Stat-Signature: cz74or739crbf19isfqw513eypmqrf9g X-HE-Tag: 1706197622-480095 X-HE-Meta: U2FsdGVkX1/xokU5E3s736kJ4Da2m2HvOK+gcMTwIwz2JG1XAADUA1J5vQKVMhW4VlFBAG5Ab0kXrK2SZZKwc6DVSNVN3fEjEKYG4+r5fgLoyEVeH+7EfqUiK/CTbxddD8/iHPir1JV9Czwh/+0qSqfD1fsZXABianmDjeS6PtIvGkpSrJGp4OfxbIGx/pZRfP2vmDcpktSEOXu5gai5gy6Xt41ONH86dhPTyf2gdjlQBBfvCsl6Yty3y+4C0w1h5s9LyO5s3stNEv6Sv1/OChzsJ4a90WTVlqmKMvg7DCDFad01e7bh22kWaHoOdwa4yJKNvNFkVSMC1igZeEzasOcFhCapv6MUa/BytHkNhrnT6g3eb+2qih5aebk8vBWg2Klo0lQfjAD6trgVwmmAEuLL9B5ncZ0gqW+DWsntz3JmlqvVoUSj8eEgOmimjPmihEYzQB1yNc8nbeZdfsCemuRwWp4X4K+/m6hT1JUJgnIlUS0pwJ1k4TRTi2xcYTrrcinIVel3RgtYwGnhUCcu1Dvbp4vJXbUWO5PfdOn2w0RR/JQMPjc2MyRe+TFNpEIttSnjbBazGXvJsL78bCufHoTNnOlKs/jRFFsdVugPchRIovsJp5810dS5SbLDeAtmOtnKtHrCPrB25AZXdBMvNSp5/IsHs/5/jDdMlR+WzLgYQevXA9NhzeEP2LoiwxadHctcWdLDm2GiOBCv/PeA9NORjmn5D5CAdRvZaqik51HYiJDp7/rna8XRdGUTEXTY140+z1Y9gVdzu5FkxbSYzHlJdAwuk07jFGYYI45CgCdd5PGRvKeZKlAW8aYVFmFvNMS3d/7UxUTx+fXDs/cCAIsEglE6tfBJifjZNR4jQUEEMab0vfZBtLrcyaN8sq6oUjijQYRd+/Uqurkxerb/+eWej7LWJxup2p1BDErYOIk3cmVfwuBUZ0vpNGpeiSSwn3Xd2EbeLmfy0dXFOmQ WDAJzoHd 6g0IFICdHW36fLDY= X-Bogosity: Ham, tests=bogofilter, spamicity=0.000000, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: List-Subscribe: List-Unsubscribe: Remove sudo as some test running environments may not have sudo available. Instead skip the test if root privileges aren't available in the test. Signed-off-by: Muhammad Usama Anjum --- Changes since v1: - Added this patch in v2 We are allocating 2*RLIMIT_MEMLOCK.rlim_max memory and mmap() isn't failing. This seems like true bug in the kernel. Even the root user shouldn't be able to allocate more memory than allowed MEMLOCKed memory. Any ideas? --- tools/testing/selftests/mm/on-fault-limit.c | 36 ++++++++++----------- tools/testing/selftests/mm/run_vmtests.sh | 2 +- 2 files changed, 18 insertions(+), 20 deletions(-) diff --git a/tools/testing/selftests/mm/on-fault-limit.c b/tools/testing/selftests/mm/on-fault-limit.c index b5888d613f34e..0ea98ffab3589 100644 --- a/tools/testing/selftests/mm/on-fault-limit.c +++ b/tools/testing/selftests/mm/on-fault-limit.c @@ -5,40 +5,38 @@ #include #include #include +#include "../kselftest.h" -static int test_limit(void) +static void test_limit(void) { - int ret = 1; struct rlimit lims; void *map; - if (getrlimit(RLIMIT_MEMLOCK, &lims)) { - perror("getrlimit"); - return ret; - } + if (getrlimit(RLIMIT_MEMLOCK, &lims)) + ksft_exit_fail_msg("getrlimit: %s\n", strerror(errno)); - if (mlockall(MCL_ONFAULT | MCL_FUTURE)) { - perror("mlockall"); - return ret; - } + if (mlockall(MCL_ONFAULT | MCL_FUTURE)) + ksft_exit_fail_msg("mlockall: %s\n", strerror(errno)); map = mmap(NULL, 2 * lims.rlim_max, PROT_READ | PROT_WRITE, MAP_PRIVATE | MAP_ANONYMOUS | MAP_POPULATE, -1, 0); + + ksft_test_result(map == MAP_FAILED, "Failed mmap\n"); + if (map != MAP_FAILED) - printf("mmap should have failed, but didn't\n"); - else { - ret = 0; munmap(map, 2 * lims.rlim_max); - } - munlockall(); - return ret; } int main(int argc, char **argv) { - int ret = 0; + ksft_print_header(); + ksft_set_plan(1); + + if (getuid()) + ksft_test_result_skip("Require root privileges to run\n"); + else + test_limit(); - ret += test_limit(); - return ret; + ksft_finished(); } diff --git a/tools/testing/selftests/mm/run_vmtests.sh b/tools/testing/selftests/mm/run_vmtests.sh index 246d53a5d7f28..e373d592dbf5c 100755 --- a/tools/testing/selftests/mm/run_vmtests.sh +++ b/tools/testing/selftests/mm/run_vmtests.sh @@ -291,7 +291,7 @@ echo "$nr_hugepgs" > /proc/sys/vm/nr_hugepages CATEGORY="compaction" run_test ./compaction_test -CATEGORY="mlock" run_test sudo -u nobody ./on-fault-limit +CATEGORY="mlock" run_test ./on-fault-limit CATEGORY="mmap" run_test ./map_populate 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+a9ebRE8Vr0OFHOxJ/AGt+9CKwCr7u6S5umsM2wMXWHhOLk/h3Yj5UmAF1QHIsgWtgR+NombzpoNHVVkO5bRzf6YqpWeZrEC1W5bjpbwIhdJ+VnvGTAePJ9GtF0X2UIWhdhViufLaWPA0t5JNPKNw3ZhlsfPwIVSxyrMjKSPv3ymS2VD8EZxIaWSnmZmYbPDI5ixU8wz9QKzwGNqM5b+bSv0p/gPVOPON7t0u5KKRecCACt+jptwLm/KPaFWn5ZEtqA1Se5R5GwVucKpNS3TS/jsF1ZorpLdolEifd3U/HtG7dtfv/cxnb+q2ov+sayzXKvKWZfkZn1mYJvfOjy3bX0BUmwiaB4Gdz7aBQ6a5SiuxgoPxT5y8rmRVNDQC7hWHuefgok/b9Epcj590kwwUo6mpHY+m/FGtqUKoIFF5E3bGVDQOxQSiDL78stLr99nNdQbJEj4GF/QTXJHWUVZfo5XvapyKkmJ3n0W499OxrW+l2KV8zx/34K1qyqUzEnd8REbXUyFElnbqN8R82FGRhjU3n4e3zRqd0e0nI57kHVJjD167ZhZiN0quofuxUPCzi0zbLG+1ol0aoDeKTYfa4JtQ1N3XgbJQ3PiG3va2IPOe+mrJS//g9YHcQQLIKbC6wSeRN9/mAgqcqVF9uNf7Tm1XpDA0Imtvl08lTAgGjjX2YTo8Xrr2zoRd6ZOr/H7tF8H6xcIkq5k3YVLowLR6 RmEY7Lcj V4FhW5tIZLXMrjITCELnGV8BykH/zKgTO6gpIHM4bcUNohGLv3g3MMwO4wE6MBURtJ8S5Q4TptyvTcsvczmiVM0k5v+2eiq6YttqDXlHl263DNxxrNocQH1GEjt1B8TlNOg84ILMHsBUQ2CizrtkTtyN2UyToKOVNsFN0bvx5VAIFEm/t06e4O6OQP41PsK6bMsiFc2yRa9lj3biysQRzcCyk752cKQo3deKJRAKDq3DksrMSIQkv2juTpekCrYYFBhnVP68odQFjNqAi7ZybYnX56EdIRY9/NHUm9BbCkWW5DIs= X-Bogosity: Ham, tests=bogofilter, spamicity=0.000000, version=1.2.4 Sender: owner-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 From patchwork Thu Jan 25 15:46:07 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: 13531197 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 99184C47258 for ; Thu, 25 Jan 2024 15:47:12 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 2F6C56B008C; Thu, 25 Jan 2024 10:47:12 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id 2A5186B0092; Thu, 25 Jan 2024 10:47:12 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 147D16B0093; Thu, 25 Jan 2024 10:47:12 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0010.hostedemail.com [216.40.44.10]) by kanga.kvack.org (Postfix) with ESMTP id 011786B008C for ; Thu, 25 Jan 2024 10:47:11 -0500 (EST) Received: from smtpin05.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay09.hostedemail.com (Postfix) with ESMTP id 5C7A0807DE for ; Thu, 25 Jan 2024 15:47:11 +0000 (UTC) X-FDA: 81718262262.05.A21822E Received: from madrid.collaboradmins.com (madrid.collaboradmins.com [46.235.227.194]) by imf12.hostedemail.com (Postfix) with ESMTP id ACF4640026 for ; Thu, 25 Jan 2024 15:47:09 +0000 (UTC) Authentication-Results: imf12.hostedemail.com; dkim=pass header.d=collabora.com header.s=mail header.b=FrGw2wr9; spf=pass (imf12.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=1706197629; a=rsa-sha256; cv=none; b=w8OsyeMUt/vP+0jFw/OU73nlgnqYqthV7jRyCxW+vfnrAqtic4d4MZgltOPybl6BfnEWRh PDVk2Vm32tPunsyakwLXu0GjcNsFgaOVLfzLpoGarU25dR7P+vyVXzGl1NC/v3AVFgPlSH lorYJlU8TJlfFa3AH9LMO+6AxSZH5lM= ARC-Authentication-Results: i=1; imf12.hostedemail.com; dkim=pass header.d=collabora.com header.s=mail header.b=FrGw2wr9; spf=pass (imf12.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=1706197629; 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=/Vt0auslnwTqOQlpWBRcRWAUjgRqu5psbNXLByWhXNA=; b=1tNlf8X6V+i4Dt/soXJyS2CpiXe06pc7yDeA55cGm2tgvnsRtk3dBHPaAlYKB1vdrC+Nbi wfP/I9oQ4ArddBq3/qwNegeYH4ydQywngxt+8U0RMVxtpjR7Hd/SRDiYuiW55ifAWgTmoK Xa1hjHmXmSSrY7nVPacYR48ht72L374= DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=collabora.com; s=mail; t=1706197628; bh=VhAHDNe75pln/83b0IF4gK7LDikmUOQyoWwqkY00mK4=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=FrGw2wr9tOpj1o2El1l4vuB1W314NWo7egQbv93gBtqVgLnN9/8lMnVd5QEISk0i/ P+PfLP8Rf5Hs/DWxR8CntipCjFruIfWx4s/9b3OmhDoxgRlwQVzTpdWWU1e+R+nyQE aXoeOEZFU5n6MSvmzYxED9LKOtGTK6bV6SHBXUfvbZJXqWhH8okkJp9pUGGUKrFQqz vMyQtOMGlHzsBAd0G6l4tC6NWDSssISpgeq2vc5wZM3DPhzwZ91tKva1fIguYTAtqj 0YHgF9SMDHf7V/s98YMljk1yQh5tpUkoyagRJEuUlXESfzsMMqc+Ek0m7OPQ3ETE4+ ru1PKBGXn2I6w== 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 B314837820C2; Thu, 25 Jan 2024 15:47:05 +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 4/5] selftests/mm: protection_keys: save/restore nr_hugepages settings Date: Thu, 25 Jan 2024 20:46:07 +0500 Message-ID: <20240125154608.720072-5-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: ACF4640026 X-Stat-Signature: ys61gb9faxu5761h15ghabirogcj3rzd X-Rspam-User: X-HE-Tag: 1706197629-786075 X-HE-Meta: U2FsdGVkX1+2uwWN2Xh4LvF0J9zgu8tMnKTOhRIs+sVQwQg4oYT5fr6dbaYsBqTZdpXSl+O8zD3+c3pz48aeRpWOfetWDO9FEgkzHzNvybgeDl51x70z2T6k/ybYXFuEMgN/5/E8NBLCIb747jBDdfmmxibcP4z3KSLCzLcZqWE5PMdZCSDYT9s6+3p8Rw5YdTPAuQVMhemEbvfp33tiihN4hv87oE83XQVBsOVGNvxGoIrVKXm2JbPG4aUuvQ+XkOCLXtQI0781TDPIMwQd1yoR9Gt+X3eNXPCPWltpS/TBaf8MspFjK1Wby93Kdk0tt2uUXZMy7mbi1XlfqnDKB2sQuSDJII8aIIs+pl5uzs8XfO8mc+YdkmdQ70CSZpAM7wkM3ZgDRjopIp/lDrt35i6BKrAb26ayiwugAW9hDrG0RvSMTW/Gl439BjUw0n812GNEjzZAyPdw/3OsIo4CtDGIWktQlbDccR0O/w/f3oinGwyjbt+lRypHAZzRB6RD4H0MhIpL/Xaax8typeSbuWHzopRKg7hVE53zHor9nzoTW7RMy5efDwq7V6ddC9fw6i4zaiphimveSOB4TTEwHY4iyLf0ms29r+z1+TbZoABUF+Ft42/KVPg4JxydAxsaML6KSg95Wb8lOppIG8bvii+9TCSo1LQUSy7iSsy67GW3CUb4BBniZofse0INzXt63BwIPjvIoUR/FoAapcznDv0z9NoJJzZqz5WEnFt4nQAHXlsZ8CqxX8l+6ZZXvEF+65bmrnG3K/925RO5WQna/0tFcNfHnG8jvnaHtMWFo5oHQPThBCKXBPhB1lya1jhCbGigqU9C1PjbwrIarRNgB1KXL1dVf/LRsqJ6vrpbomzmqGMqEBwOF5/5stV8Zcly44E1D8hq6LeCTyRUn4jpBZsWKf1nxrIdbuQGzymP1IGJIbkMuWVC/hxUVFyAr9MVeQWXq4VLK9Ytf2PimJ2 DcE5HrCj xr3YnLwwt1TU71ZROS7hLF+Fy3Cljx1tWpYo6esRAoP+dXCgBh1LxDxmTpUo5pow+O2Mb4qIpd+a3cl12e1zcck9jUCVWdwxU/tm7ady+EsWqV/EPenRYA8qnzuVeajhqTTxgze0MdnSVrJ9wT6KG8gv/T52mzxjj9PDaiJfSBdfyxWXPLNHuM9LspHh/o6AbwazJ0JaFIflcN5AWimylHEEQmjbOe5SeT4m9McWBX2tjTmNTmJTpuO/TotLF7gt2dP7Zj9ggL054stcNTd4t7Z8jk+GyRZyDZMb2B48oIZ90OIQ= X-Bogosity: Ham, tests=bogofilter, spamicity=0.000000, version=1.2.4 Sender: owner-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. Fixes: 5f23f6d082a9 ("x86/pkeys: Add self-tests") Signed-off-by: Muhammad Usama Anjum Tested-by: Joey Gouly --- tools/testing/selftests/mm/protection_keys.c | 34 ++++++++++++++++++++ 1 file changed, 34 insertions(+) diff --git a/tools/testing/selftests/mm/protection_keys.c b/tools/testing/selftests/mm/protection_keys.c index 48dc151f8fca8..f822ae31af22e 100644 --- a/tools/testing/selftests/mm/protection_keys.c +++ b/tools/testing/selftests/mm/protection_keys.c @@ -54,6 +54,7 @@ int test_nr; u64 shadow_pkey_reg; int dprint_in_signal; char dprint_in_signal_buffer[DPRINT_IN_SIGNAL_BUF_SIZE]; +char buf[256]; void cat_into_file(char *str, char *file) { @@ -1744,6 +1745,38 @@ void pkey_setup_shadow(void) shadow_pkey_reg = __read_pkey_reg(); } +void restore_settings_atexit(void) +{ + cat_into_file(buf, "/proc/sys/vm/nr_hugepages"); +} + +void save_settings(void) +{ + int fd; + int err; + + if (geteuid()) + return; + + fd = open("/proc/sys/vm/nr_hugepages", O_RDONLY); + if (fd < 0) { + fprintf(stderr, "error opening\n"); + perror("error: "); + exit(__LINE__); + } + + /* -1 to guarantee leaving the trailing \0 */ + err = read(fd, buf, sizeof(buf)-1); + if (err < 0) { + fprintf(stderr, "error reading\n"); + perror("error: "); + exit(__LINE__); + } + + atexit(restore_settings_atexit); + close(fd); +} + int main(void) { int nr_iterations = 22; @@ -1751,6 +1784,7 @@ int main(void) srand((unsigned int)time(NULL)); + save_settings(); setup_handlers(); printf("has pkeys: %d\n", pkeys_supported); From patchwork Thu Jan 25 15:46:08 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: 13531198 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 58246C47258 for ; Thu, 25 Jan 2024 15:47:15 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id D552B6B0093; Thu, 25 Jan 2024 10:47:14 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id CB71A6B0095; Thu, 25 Jan 2024 10:47:14 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id B57FE6B0098; Thu, 25 Jan 2024 10:47:14 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0014.hostedemail.com [216.40.44.14]) by kanga.kvack.org (Postfix) with ESMTP id A694C6B0093 for ; Thu, 25 Jan 2024 10:47:14 -0500 (EST) Received: from smtpin02.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay04.hostedemail.com (Postfix) with ESMTP id 64C7B1A0487 for ; Thu, 25 Jan 2024 15:47:14 +0000 (UTC) X-FDA: 81718262388.02.555134A Received: from madrid.collaboradmins.com (madrid.collaboradmins.com [46.235.227.194]) by imf08.hostedemail.com (Postfix) with ESMTP id 9A280160025 for ; Thu, 25 Jan 2024 15:47:12 +0000 (UTC) Authentication-Results: imf08.hostedemail.com; dkim=pass header.d=collabora.com header.s=mail header.b=spQERbvP; dmarc=pass (policy=quarantine) header.from=collabora.com; spf=pass (imf08.hostedemail.com: domain of usama.anjum@collabora.com designates 46.235.227.194 as permitted sender) smtp.mailfrom=usama.anjum@collabora.com ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1706197632; 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=h31klViYMkbxGI9sbm0zz7BUsw1UOXfpklv23HIiovU=; b=AlZcSrKUor+UAqat9wlA7X3VCRPFIr0xgrPvA8UygC3wieNpakAwCeXVX18JFz8YmbGJv9 gXTABlGClwQlIH6+o/zEIKsj/fPPLJr+t5hb4sWQp7pT4+nwxmgIy4fav+KPe8J4JwIdDc LAMdph6QtutzwCFWpEj59yp2ddxHQG8= ARC-Authentication-Results: i=1; imf08.hostedemail.com; dkim=pass header.d=collabora.com header.s=mail header.b=spQERbvP; dmarc=pass (policy=quarantine) header.from=collabora.com; spf=pass (imf08.hostedemail.com: domain of usama.anjum@collabora.com designates 46.235.227.194 as permitted sender) smtp.mailfrom=usama.anjum@collabora.com ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1706197632; a=rsa-sha256; cv=none; b=n8n3y6lN4vqzTZ7xqtwoX0mG4m4HsSHhNF+kNKSO4VOYBhAu/Jsj93hx2Q1j8hTAysPyLI NoWKuxF49SnfT8loDJIK5u/vKgpvkV5F8xTXPdzORfFyWgWKgSdaLLWtMT7H3ffaBTQQ5D 1Rq13KRG2WMr40Adiqu3ugLg9y8Ar6w= DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=collabora.com; s=mail; t=1706197631; bh=zJmZgfxWIaYLZOFMPT1jD8KyCb1GdfoJ77F3vo97p4I=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=spQERbvPbrDUUyL60ZyWYlK+MZp56OErqHy8CwHbVAFap8AHI1Cli622MWdnld8Aq TwrHHehfcs8JZFmZqcaO2enEofICBe5wzVbDWlb1D8QiJXEqIusR9jUQIC6rnsgoXa 3KYVOqzo6hgu2Vq9YzXFpkrOs7jo+IFO6J0mY84SVJBxJvWgaNryCiARh783mOqQZn NhuqkS6FzsWMQKat6kiOVEnBQsHuEyflRBYKkRjSmgK0nQsFStNyJ2SBsfkh9WdtoA iAevWDtNz/VCkSYlH8veDwFpBgNKwa3UyH3WPKaRf0VRS00NXT0j6BMvwSFl5u2zTU i7BuFoEPy1Tfw== 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 01DD737820C3; Thu, 25 Jan 2024 15:47:08 +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 5/5] selftests/mm: run_vmtests.sh: add missing tests Date: Thu, 25 Jan 2024 20:46:08 +0500 Message-ID: <20240125154608.720072-6-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-Queue-Id: 9A280160025 X-Rspam-User: X-Rspamd-Server: rspam04 X-Stat-Signature: zads73pjoz1duw4eax4dmympaqx6rwhn X-HE-Tag: 1706197632-459253 X-HE-Meta: U2FsdGVkX19syuAlOeZbEmtqg61/slJt0d7V0RUlxT5vTr5XL8Rf+pRlAFm9mRMykpiubF7kPd6m3g5gcY0I93+yAaQrPnW5Ao2X9WeWUAn0vgGPg7FKgXvoly3cyKLJVBWJqk9YGX504IpYPsB+IQ+YWfW6pw0M5/sFSUqkCK1Eq7zr2+jl9HfNbp2U0rv6x6rnAeq94gYYw5V8c2eBxkp48s1H5KTljX11SWEwDPqxNnKc8zfKV8nQJSBKMfW0igaH2Gs2647qEkJjJ+kpSh5Bk7v6Aapi/9t/1fQHH+ntEh7Xe6/bgcQXNYA740G7T3IKTbTS19BWZh6mnb79wfrt/zIGtTmDdzOA4GWWIb19oq3ASxxpymss5vDWZWzfNT5qkaT/40Z2b+F5nE/L/enijBpoUF9lxRODFYwcgMWNRuzh2Zb3aIoKj+/xllvbc8089KnRhEQGvzzwuWAIgLCWyu2TOItdhadNc51YZTzXP1lW4CzcuPhauHtDWp3Kt6KdysQeQDUIOWtO3y7vUvlgIaVmNPcF8Kjw4IIGKmsyG866xfj0lRMv+UHh9SM+18+LwOVaJUkM8sbG8GDant9TKD8DfMpvmugDQk8YSfdaA+FPRUowfXnRTpskc7DbuH48+O10b96WhsFX4XBo5nNQnP1FcEkZlE6WRH5gCUDNwMD2R8fuqfiLbLJsML5uorIme1DLe/ahUQvh0DPX0xZFMI4d/JCFm9GJlfLJakkUuNh6SHotiw4hRdzJ8sImVLCQmTWDAayqDD2bg7U1aNJvFA51E9agMVZivQVuLbedQZQv5WiGFeOpTwr3iqI2/lTArlHcogIileqUltnYE/MiyWL8cyoCAX11SqmM97vlDSddZt0/i2MUngv41RceUD0tlOEpK2DCx5V7ezKV6fByYrPZ90x2rmRFSwNj6wpxmVR154ei2UAA+tqeP/2Wz8dGLJgATPuLyg37JAs MiLO5sph ksnRhSsvQ7Yb4AJsKBQD0BDND/sDHz2jtoXDKj96i+IgeUb5HC3IjSFIACaiH6QK7p2rt/c+K8vYqwdMBQYumu3dSCL7Mzn4UTj5ufYDT/oQlN/TkApMPBzOrnp8Wo7S5wO6iTOhrmy9bxCFBuut0YWO/jt7ydA2T8q5MKuxoBQIERCAM60sFJAVI2MEm3yinz7Y25T3xK31Y7DrUXVOXfru9PbgGX+R42k3/mQplJoSDhZ+SPabWLl3utlTJtDTmcUzmCJdg6h11oTr6jXn0tYiTWh9SNwbuuEvfeoQn/hOux2ed7btv3wJLmUc/nwgIZWN7V3meQQK466074khxUcsrxkPld9m89rKXdqMp3oEfjWE= X-Bogosity: Ham, tests=bogofilter, spamicity=0.000208, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: List-Subscribe: List-Unsubscribe: Add missing tests to run_vmtests.sh. The mm kselftests are run through run_vmtests.sh. If a test isn't present in this script, it'll not run with run_tests or `make -C tools/testing/selftests/mm run_tests`. Cc: Ryan Roberts Signed-off-by: Muhammad Usama Anjum --- Changes since v1: - Copy the original scripts and their dependence script to install directory as well Changes since v2: - Add a comment - Move tests down in the file - Add "-d" option which poisons the pages and aren't being useable after the test --- tools/testing/selftests/mm/Makefile | 5 +++++ tools/testing/selftests/mm/run_vmtests.sh | 8 ++++++++ 2 files changed, 13 insertions(+) diff --git a/tools/testing/selftests/mm/Makefile b/tools/testing/selftests/mm/Makefile index 2453add65d12f..f3aec7be80730 100644 --- a/tools/testing/selftests/mm/Makefile +++ b/tools/testing/selftests/mm/Makefile @@ -114,6 +114,11 @@ TEST_PROGS := run_vmtests.sh TEST_FILES := test_vmalloc.sh TEST_FILES += test_hmm.sh TEST_FILES += va_high_addr_switch.sh +TEST_FILES += charge_reserved_hugetlb.sh +TEST_FILES += hugetlb_reparenting_test.sh + +# required by charge_reserved_hugetlb.sh +TEST_FILES += write_hugetlb_memory.sh include ../lib.mk diff --git a/tools/testing/selftests/mm/run_vmtests.sh b/tools/testing/selftests/mm/run_vmtests.sh index e373d592dbf5c..a0f37e4438937 100755 --- a/tools/testing/selftests/mm/run_vmtests.sh +++ b/tools/testing/selftests/mm/run_vmtests.sh @@ -19,6 +19,7 @@ usage: ${BASH_SOURCE[0]:-$0} [ options ] -t: specify specific categories to tests to run -h: display this message -n: disable TAP output + -d: run destructive tests The default behavior is to run required tests only. If -a is specified, will run all tests. @@ -79,6 +80,7 @@ EOF } RUN_ALL=false +RUN_DESTRUCTIVE_TEST=false TAP_PREFIX="# " while getopts "aht:n" OPT; do @@ -87,6 +89,7 @@ while getopts "aht:n" OPT; do "h") usage ;; "t") VM_SELFTEST_ITEMS=${OPTARG} ;; "n") TAP_PREFIX= ;; + "a") RUN_DESTRUCTIVE_TEST=true ;; esac done shift $((OPTIND -1)) @@ -304,6 +307,11 @@ CATEGORY="process_mrelease" run_test ./mrelease_test CATEGORY="mremap" run_test ./mremap_test CATEGORY="hugetlb" run_test ./thuge-gen +CATEGORY="hugetlb" run_test ./charge_reserved_hugetlb.sh -cgroup-v2 +CATEGORY="hugetlb" run_test ./hugetlb_reparenting_test.sh -cgroup-v2 +if $RUN_DESTRUCTIVE_TEST; then +CATEGORY="hugetlb" run_test ./hugetlb-read-hwpoison +fi if [ $VADDR64 -ne 0 ]; then