From patchwork Fri Jan 10 23:50:27 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Zi Yan X-Patchwork-Id: 13935598 Received: from NAM10-MW2-obe.outbound.protection.outlook.com (mail-mw2nam10on2040.outbound.protection.outlook.com [40.107.94.40]) (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 413D01ACEB8; Fri, 10 Jan 2025 23:50:32 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=fail smtp.client-ip=40.107.94.40 ARC-Seal: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1736553034; cv=fail; b=L85t/WlKckMumXqSphGAfsMqolFrL2mxPAwlBTMWStTvPdwMOifD/yKgHJjA709qSR/cA3/T+NYRrYRGnJ4fSDk5K507rKa290EoHQQEvZ1ZUcleFrq01sMFY6qa02zSrUiqimIv+gvK4jxGBgTb6GlqQjT0LYhewesJ2m+X1tY= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1736553034; c=relaxed/simple; bh=AtLKsIIsxMQyEEX0kD0aydaUfP7LX4JEygwoM29x6Ww=; h=From:To:Cc:Subject:Date:Message-ID:Content-Type:MIME-Version; b=tUKss7hfsOPrUk6m+eDc1TYcUke7p9xTbpd/Bspv9FbISx44k8MeBns6NNv1e/6ZeT/oD/wfeYaOV2Obg0GZ/fyzu+lgKNFlC3trbXBD3fYwIg4GbGotfODy43RS8cmcaHTI+l2Fsa4CA+79mhFMPtLmorN5Gw3NJM5ekQXYsMQ= ARC-Authentication-Results: i=2; smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=nvidia.com; spf=fail smtp.mailfrom=nvidia.com; dkim=pass (2048-bit key) header.d=Nvidia.com header.i=@Nvidia.com header.b=rikZQAlQ; arc=fail smtp.client-ip=40.107.94.40 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=nvidia.com Authentication-Results: smtp.subspace.kernel.org; spf=fail smtp.mailfrom=nvidia.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=Nvidia.com header.i=@Nvidia.com header.b="rikZQAlQ" ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=UVPLjhs4T0KxFAtQePS3gmFnADBxjEXF+UxGrN98EtUxMkkFtLXAE6Ijj3IhKHzdjf1pFLbxvgBHAARN3h7AutPEpvTv0yiArcVmS6yN8GFojLpPafPSr1ZFlrG31LzFQPxzrNYXu2ndg7AIhUATAQfxKAjjIj9gBu4CYTf7qVagbIkWj3q+DXsTQOUWnqNFwlnAjh0oIGulhXbhtPt1fbHxfxwpjfwTbn27d0svmH0rBOIAptC3S6HvaUVsdoMfgw0e8QNCl3rcsRpdgA8uYkURPb2/ql3waJnKDA+qQuik80q91v4Fl/41NjsB4wiGkIe2dH/nKEqAxoXCYwyjMQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector10001; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=pvuo0DQWBpDZQjd2+y9sIIdbZUUKkDzGaFuMGZpzt3k=; b=XHOXLhpNSrtUD5seJogV1RQK1tU4er52pIJniR6KQJmMTxTUNhVyEXIT7FGvO9uJLWc8yokdLUSgtUAa8XCatnY4K4q7lriWJ+03NC3jBDDCpxp0zRk7pMjRkzjlvU1yy70MpH00DarAtw86jTtCBX1A/VMnB+HUmWy4Wfs7v2qZZP5SGBEDEmVQMQuEQG6MQfmjRubUahL3887PuHPS7XCFDJI7QyktVx2zAji4dwYeq8oFQZE0L+hrrz2PuuBPp8U85t7jjMbaVbHIOQgnsSAMy2dx4dD7ucLAEIa4Sm1+jvpH4D1CKh0nJ50recgU5tqVgNnfOfX9lg2h6uezKQ== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=nvidia.com; dmarc=pass action=none header.from=nvidia.com; dkim=pass header.d=nvidia.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=Nvidia.com; s=selector2; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=pvuo0DQWBpDZQjd2+y9sIIdbZUUKkDzGaFuMGZpzt3k=; b=rikZQAlQiaGyVWG0pW9gqXKpE/lTZPcTLCppEnGci3df22Cz+oXtSaz1JPx/lC9oT64tMRvM+Z5TicH8RF/kYlQBcjkGeBGRzxTL0SmQSf9kIx1IRSA0A7kSNEhxrc7jml2kFQsMPmlRukpiR8wM7n4iLGW0mQC4Lug0ZhvyrCeSWnq5PTpz9qyl2+wgYrOK0XRVxQgpLRj/batmgamPQg5lyWslhUwcl5iCyxWh3q50UqQFgh3YDDM/olf34rOqaWdKrYyNt8bSJegL+P+NCGeU6N2BCr3CjOCPRKtr+s+tyiDm6B/6T5rSaTYFZiMhBjVYxIo9ENAxHzI2M26iTA== Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=nvidia.com; Received: from DS7PR12MB9473.namprd12.prod.outlook.com (2603:10b6:8:252::5) by CY8PR12MB7753.namprd12.prod.outlook.com (2603:10b6:930:93::13) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8335.11; Fri, 10 Jan 2025 23:50:30 +0000 Received: from DS7PR12MB9473.namprd12.prod.outlook.com ([fe80::5189:ecec:d84a:133a]) by DS7PR12MB9473.namprd12.prod.outlook.com ([fe80::5189:ecec:d84a:133a%3]) with mapi id 15.20.8335.011; Fri, 10 Jan 2025 23:50:30 +0000 From: Zi Yan To: linux-mm@kvack.org, Andrew Morton Cc: Shuah Khan , Rik van Riel , Alexander Zhu , Usama Arif , linux-kselftest@vger.kernel.org, linux-kernel@vger.kernel.org, Zi Yan Subject: [PATCH 1/2] selftests/mm: use selftests framework to print test result. Date: Fri, 10 Jan 2025 18:50:27 -0500 Message-ID: <20250110235028.96824-1-ziy@nvidia.com> X-Mailer: git-send-email 2.45.2 X-ClientProxiedBy: BN9P221CA0019.NAMP221.PROD.OUTLOOK.COM (2603:10b6:408:10a::34) To DS7PR12MB9473.namprd12.prod.outlook.com (2603:10b6:8:252::5) Precedence: bulk X-Mailing-List: linux-kselftest@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: DS7PR12MB9473:EE_|CY8PR12MB7753:EE_ X-MS-Office365-Filtering-Correlation-Id: 46ee9696-2a14-49f0-2e82-08dd31d190eb X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0;ARA:13230040|376014|366016|1800799024; X-Microsoft-Antispam-Message-Info: hNGo5CZSqNuLXVsqJZdERHIzPnKI4mY2kFYLOo+IaXPrchvhktmvzWC3iQkNLYIHbX9qfE+LVlZ7ELL55+q+TDzqDGO2aFhu6FLsb0mReYmtLiSKc9gulE++qlYsfKk5MQHz7YU7DaxrZm+LLtB4ai0M3Ryso+KT4CWuNKOmkVMt/0hOyrhhKmiOVzr49uSMaQvLiuuS3t/7TY5jD72VlisS2WM1Ny25gPgxYhD+PM8qSwB3Z1xLfokg/IKrzDP6J9HMzRdrh/dHZPNjM/jxmnaCEaD6g3yNBfjLkcMZVBJ2eu6C4fN84GFB1lfOFjeAVt2e8BurTVx0nuRsMW6ozIrHxVE076Zz09wcKz9Pn1SH6ZHIcQoP9apMCMSWK1tBy5EyJZkhofeOOBfJEw3COQzTRmUr9GHqFSRK1cVa+Io2iS+IUfagi3EFrjo8cmSkip/hscz8ygyoyKnKg7fxAcHG/1a3FQpGZ989nmT0YuTJ6UJTqk84swJGI8TVZswTpeDAiutHyVQJXHSCb2fldz7nich4RggEKSqgvCv58QpaMa1dw9BFiSmQ3js9BMfrAtb6Ds1PMpTDL0KAF5qhv7Bai6ERruLPcJYVD3vFeF650QkZJooiZj3HtIPfdpjhqi3nVjp9MMj3zfnzKWxyw3qD//oppgsGMi80j9+gDbTnaAREQitGpNUHZgkHS1h9LqGkBD4uv0bm8gsoQpyCklvL6zIqrIE4FixRR/yTlBwQmtRC5jTdW8Q9skP3F3EVPzjeTODZUrFRfZNQQYvvz/6mM2nbUdl3G0BRRorueIl4JsGoBE5XrqG/Ykti5XQq9k0orcRlDitElQhSFuZUTpwIzRUq9ksRBcf0+bfKfMZR69JR6zX+4Okq9hgAQEvpu5MxeJ1By8Ros10U18+1aqe4eYxazWAchlMqb0DlNTG3bN+1vbHT2FzCJiYIcdGnUvkfbJHd6+kdo9+PAYj+t9ITQr6gBI2Xn4N362i1dW7a84ZA32hbPZ7A9nVbBaTGnd4fBuTKvTHqBES5mLSTUxHqBPq2sLImobdFBkBHRdI9wPNQqCm2glo+sZIVbVS0ig/4pCbklTInzs7g0kMYq9M0f0BEz4ae/htgsc89hqsTAWoERoDPCkxf8dArJywHaLdRPRGuSJBln6uwuuWjCK3zAP/eFybu5B6U4TQfZO7Nefs7MnXqTSuJcFCUO1QHLJyCR9hnrpmY9izv8LuaNHTq1OMEYPoFNbThAeucCzO/5EheUgxr1OBMDH2lrbyI1aRahSG9ykVKzv02L8yKQg46gvEf2uQFlOL6uVg6+SlmfXXEsSxUy+Fz7cSeFq4utj2KQICLjIV57pBZVaaDFX2fpaLNarwVW2PGQTug/OgyRhQ7CZ1zyEQl+9pWoDge X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:DS7PR12MB9473.namprd12.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230040)(376014)(366016)(1800799024);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X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07RRWYyasyGcDPs/oieyfhtbj+lZfkenodLqdtxIgyL67kyw0C+OMKefzrdnGMzrH7FO1dwAZF9rs5w8FQUkXpERYi5oAZ8V9iJl3Wq4zk6KXbQ6r0lLKxj9XyHCdf+qH0HNEKO1PtI0NNSLQ513ZQu2O8tD4mJQpHIJdwgimA6l9iIAmZHx1o665eLbk25y8Nfbf5BTGsyI3YaToTfn10gJPujg9hWD0Fbwax4E+3LZfExFhbz2l2FW4FmgAij6Hdeo8fgAEsOffPB30cskicdNyH9aW4seP0cC6ITQ5XA79V+82zkSVX2k3pBo31iXR4lhxUp6+MjN+5Wo/bzXEpfnVE38g3bx8qBAHayq6qZ6rb0PvBwzAdgOg3HN8n+TPCzZ6ozAIpRccjQGsuD54mBupjuHCtMKjV0Kd49ENX7WMOfJbckfT/llBQFGdRo1ozs3WbSFH5MO1hYmcnIdVcJ5iE2F2yY9oq8AsDwFe//7paOaXQQwpmGmURVh1Gy/dd2I= X-OriginatorOrg: Nvidia.com X-MS-Exchange-CrossTenant-Network-Message-Id: 46ee9696-2a14-49f0-2e82-08dd31d190eb X-MS-Exchange-CrossTenant-AuthSource: DS7PR12MB9473.namprd12.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 10 Jan 2025 23:50:30.7037 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 43083d15-7273-40c1-b7db-39efd9ccc17a X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: UeA6fN65/Kz+E3r8nFwQMHYcqR2tZ9hc+nDenfZG1pYwe+nn8aifS03WYyFmwBFK X-MS-Exchange-Transport-CrossTenantHeadersStamped: CY8PR12MB7753 Otherwise the number of tests does not match the reality. Fixes: 391e86971161 ("mm: selftest to verify zero-filled pages are mapped to zeropage") Signed-off-by: Zi Yan --- .../selftests/mm/split_huge_page_test.c | 34 +++++++------------ 1 file changed, 12 insertions(+), 22 deletions(-) diff --git a/tools/testing/selftests/mm/split_huge_page_test.c b/tools/testing/selftests/mm/split_huge_page_test.c index 84b1251666aa..128004308233 100644 --- a/tools/testing/selftests/mm/split_huge_page_test.c +++ b/tools/testing/selftests/mm/split_huge_page_test.c @@ -108,38 +108,28 @@ static void verify_rss_anon_split_huge_page_all_zeroes(char *one_page, size_t le unsigned long rss_anon_before, rss_anon_after; size_t i; - if (!check_huge_anon(one_page, 4, pmd_pagesize)) { - printf("No THP is allocated\n"); - exit(EXIT_FAILURE); - } + if (!check_huge_anon(one_page, 4, pmd_pagesize)) + ksft_exit_fail_msg("No THP is allocated\n"); rss_anon_before = rss_anon(); - if (!rss_anon_before) { - printf("No RssAnon is allocated before split\n"); - exit(EXIT_FAILURE); - } + if (!rss_anon_before) + ksft_exit_fail_msg("No RssAnon is allocated before split\n"); /* split all THPs */ write_debugfs(PID_FMT, getpid(), (uint64_t)one_page, (uint64_t)one_page + len, 0); for (i = 0; i < len; i++) - if (one_page[i] != (char)0) { - printf("%ld byte corrupted\n", i); - exit(EXIT_FAILURE); - } + if (one_page[i] != (char)0) + ksft_exit_fail_msg("%ld byte corrupted\n", i); - if (!check_huge_anon(one_page, 0, pmd_pagesize)) { - printf("Still AnonHugePages not split\n"); - exit(EXIT_FAILURE); - } + if (!check_huge_anon(one_page, 0, pmd_pagesize)) + ksft_exit_fail_msg("Still AnonHugePages not split\n"); rss_anon_after = rss_anon(); - if (rss_anon_after >= rss_anon_before) { - printf("Incorrect RssAnon value. Before: %ld After: %ld\n", + if (rss_anon_after >= rss_anon_before) + ksft_exit_fail_msg("Incorrect RssAnon value. Before: %ld After: %ld\n", rss_anon_before, rss_anon_after); - exit(EXIT_FAILURE); - } } void split_pmd_zero_pages(void) @@ -150,7 +140,7 @@ void split_pmd_zero_pages(void) one_page = allocate_zero_filled_hugepage(len); verify_rss_anon_split_huge_page_all_zeroes(one_page, len); - printf("Split zero filled huge pages successful\n"); + ksft_test_result_pass("Split zero filled huge pages successful\n"); free(one_page); } @@ -491,7 +481,7 @@ int main(int argc, char **argv) if (argc > 1) optional_xfs_path = argv[1]; - ksft_set_plan(3+9); + ksft_set_plan(4+9); pagesize = getpagesize(); pageshift = ffs(pagesize) - 1; From patchwork Fri Jan 10 23:50:28 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Zi Yan X-Patchwork-Id: 13935599 Received: from NAM10-MW2-obe.outbound.protection.outlook.com (mail-mw2nam10on2040.outbound.protection.outlook.com [40.107.94.40]) (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 093EE222565; Fri, 10 Jan 2025 23:50:35 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=fail smtp.client-ip=40.107.94.40 ARC-Seal: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1736553036; cv=fail; b=b3GA9qSq1MGIgKRGR8xxKoQEwCc2a6nduqlg1ytFx1Wyib+MRMtUXBiBQgX3s9TY6pITd3TDuF0wFlvCcwTzoJMxmz/N4PJLQ9M1qZYM1HZncDROr4vIGAlJ9pm5wqRwcsOsfYsQ4HGqvqdN/8vK3PKqqL2HdKxcP6RPyp6naaU= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1736553036; c=relaxed/simple; bh=esWLMzERUib3vTOMCE//NFV5elf0NJgsiaysRMBT/78=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: Content-Type:MIME-Version; b=F5K3X+yG95Sd/IFFY6K1v3Pw8UI0SLMbz+2zDIxT7YL7WYEoYFBcW4KQUkRZf4jymrIDmM/SLbyRUXEEvXSMTRAMU9/X5/KNL52gVlqUMsRZQISHThd/ilmceh+X6pPqjX5RtrZIRAT5OjIb6WFjoilecU8Xq+zPNWqzks12Q38= ARC-Authentication-Results: i=2; smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=nvidia.com; spf=fail smtp.mailfrom=nvidia.com; dkim=pass (2048-bit key) header.d=Nvidia.com header.i=@Nvidia.com header.b=hygXwz/O; arc=fail smtp.client-ip=40.107.94.40 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=nvidia.com Authentication-Results: smtp.subspace.kernel.org; spf=fail smtp.mailfrom=nvidia.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=Nvidia.com header.i=@Nvidia.com header.b="hygXwz/O" ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=nx2Q5Goik3BEWnXlqLYtOTHFVsqmpW2DSN/T6mlU0yG5b/gGvQmU+D4qMCnc2V6e8kwN7Hw1Jv5gZyd9SBLc7azPeE/d0+h2WM9CPLJE+bS9+h/WvV5UudhUoxdPRenRkiQV34mPSOs1HqxRHfKUkNEi3dKzfUoBcEHN4MZk4EAvRwf5guKXtzJ5oQ+DLgQeB0cWBTQJtqpgv/1ltrsPMJFUqg9FnTMr2p7d0S6lclZ6/ld+ldZqV5BPJtkQOVDY249YCXoc9lYcnAXjXhzUqUCDM6hWPDG4hSoA5Qia1KLHSQvUWzdNGabQZiRR1omHVo5+41IZGrbIfLLUFIbpoQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector10001; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=LfFaXkc7nFaNyA3q+5TZEaKsKDeeXOUpsxgXCw4KiV4=; b=F6O5xgnkMnIji933GqL9+cGi1rlbvK5MtMQzmxhBq4qhY8n9B8ir7lROiwTTLGLKEw/aUOcp/7KEePtXU3nwZWrCTNM4ccEx1Vhr14gDPrIlyh/LvDRPQDKTLPGo5163bBm4IcHfiQbfa5dpBIFDnjw7FV2klURyalFk0GHEUfrHrOb+SOLBtVeUANdX6RgyGZ/AApBnV70Pe+AE4TMwmMEskpIlNIyME65uyseGKTuo5dYJSlk8z/iV+DGk97h/lnt/zsBInXphDXM+wRf9dZelVGWaksJMP8sUE3oOQulAlC87KnC6j0R8skqVUiso/nwi5NX8Hbyn0TEGar+AIA== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=nvidia.com; dmarc=pass action=none header.from=nvidia.com; dkim=pass header.d=nvidia.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=Nvidia.com; s=selector2; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=LfFaXkc7nFaNyA3q+5TZEaKsKDeeXOUpsxgXCw4KiV4=; b=hygXwz/OAqsTLP44JJgFSOTYmBkkJGFzs/SjJIu56WxzIAreY73yEkqYrNmh01fxmcSdg6rqAixewxt/DZ6qvl2b2ncoz/bF95XYXWI1xrIqe1Mm1VjRaTYy44TWahyQjODXh9PCMBUHtsV9ScmwBXLiIhK1cyGu9kGuOEpZWN364WqW5C8UIXkeVjrd8dOUcZqUSl7RtH3dV3fIadwUt4svmp1RDnQtX4HoI5aHw52h422oIKZ9ZsUD9AQG86RtNpMwT/ra83A+SMR/C8ekYCbb1aYjjyMPDLwzD3OJ2qE0X0GJH9GyyECRRvQy6tZZhVvDktccNe4vO5c5gmbs0Q== Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=nvidia.com; Received: from DS7PR12MB9473.namprd12.prod.outlook.com (2603:10b6:8:252::5) by CY8PR12MB7753.namprd12.prod.outlook.com (2603:10b6:930:93::13) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8335.11; Fri, 10 Jan 2025 23:50:32 +0000 Received: from DS7PR12MB9473.namprd12.prod.outlook.com ([fe80::5189:ecec:d84a:133a]) by DS7PR12MB9473.namprd12.prod.outlook.com ([fe80::5189:ecec:d84a:133a%3]) with mapi id 15.20.8335.011; Fri, 10 Jan 2025 23:50:32 +0000 From: Zi Yan To: linux-mm@kvack.org, Andrew Morton Cc: Shuah Khan , Rik van Riel , Alexander Zhu , Usama Arif , linux-kselftest@vger.kernel.org, linux-kernel@vger.kernel.org, Zi Yan Subject: [PATCH 2/2] selftests/mm: add tests for splitting pmd THPs to all lower orders. Date: Fri, 10 Jan 2025 18:50:28 -0500 Message-ID: <20250110235028.96824-2-ziy@nvidia.com> X-Mailer: git-send-email 2.45.2 In-Reply-To: <20250110235028.96824-1-ziy@nvidia.com> References: <20250110235028.96824-1-ziy@nvidia.com> X-ClientProxiedBy: MN2PR18CA0025.namprd18.prod.outlook.com (2603:10b6:208:23c::30) To DS7PR12MB9473.namprd12.prod.outlook.com (2603:10b6:8:252::5) Precedence: bulk X-Mailing-List: linux-kselftest@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: DS7PR12MB9473:EE_|CY8PR12MB7753:EE_ X-MS-Office365-Filtering-Correlation-Id: 6db38b0e-e2ab-4b96-3aa9-08dd31d191ba X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0;ARA:13230040|376014|366016|1800799024; X-Microsoft-Antispam-Message-Info: Z7G5As/19yQQx4Jlupbqo7GvOqqa5r/XIBW/VYuP//+fYvYgLy3tvQHh0N+xRuD29SRFMgY+5Ueqc/hsa1rTJlAxjWOQ5UrPur3CIUbdlebphbcQKlebEAXBqT3iWNikf4RjZDf6NFMWr46Kv64pxUFaj4aA0gqAvgzHUz/jycJZPkWQAUwYBS4od1lyPnybd4c6Mgal6sOT4nbc77d14G1A6KsK9pYYpbeUY8+X059Kn1fU4WcWUkQ6st1SMwi+1YGi5AwKQqcY55LgvClWsW3yQ0y6xb+uQA2bl/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eGMU4xwZikAIUMSt8MSZ8jH2R8iu811qT X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:DS7PR12MB9473.namprd12.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230040)(376014)(366016)(1800799024);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: RVIoo6lzg+HEYNvtXhC/1MAgPpY01SdPpwvVpK/aByw9JHB7da37PxwaX4RTkoail5e1pBqNuyDjKe9d7UkD555WmSzYI1T70/fKOT1bOK3X3IcoNRXXhqebMQfB9Kj1xPItU6NJnor/mUO4Oygjd2eGQo6SeqGjsuOcW+eDOr4m1wYmCVPhDoU7M2XhmkHGqC9C2ebNDcDS+Tuo0bjI4zPAI9q9yKpnrCQ4Dy/rKKqeyjcLCL6YI2o2tfFox4JJTEot41B/1FawEJMGrwTvmIDLZHjukKQUecUefEheVmCMLUAeu05oegcVZNMF2vqKo8l4+OX6AOvIU+Fict8W0wZNrjVHORLeDe44q9jhPDN6fL2cJsQuPjo6P0UypX4qsfMKgFVidS+GW6DGyoi25A/IED6cSsliL6np6SR9JY0/BViv0ikihzESMg6OAXqoiJtZtttxiK+yNfxu0Nb4z15zLqrVksc+sn9syCkViVYSObyhDeHTrU3GvFbZW68vwDNmlKp+3vnafFCf2m8E4cFX5x4gcrj830UblVI+oU+CaLsoSn9G8dY59x0lfCa406ulY9bome9y9x4fTQ9wdOwrCi1ImqKq6bBngCkL6aqYaDdoBvvi1ttvgs0vyXm41WtqUUPzDtkxKIKtSfg+N2AVvmWAeDjfGw+M8ANTLuExNg2bb2cD6Pk7cYITYJCFSb7MQtcgCoArf+Y7TmPopWGsImWFjk5DT1hMQJkX9M1P58eIThqZObSDQjIIesPSqmi/hnHfASKC1ermiYVMWKlMoLneHqGf7g6Pm5Jr6rz7T9dK4KVJql6Wa30rZal68pSbkaalbS6O2/6BnG5v1H51cvJsa3cdFNW4MD87w7IpnhJy6nNvwtynlbEXxtHAnJ0R/vg0/vsd1QX8zlD40vZP+wJMs+6ux/pjN+JMPSyQQIiFG3DyYzUqHrQATQjZYDhimA/boUafQ+punscHGlBX1wM48cbFNFEbapWE++iEMOQnVLoURIsuXXKr8PE3TMd73W9B7kQ9QI3JKMZ1ftTVaZ/YEkVbTkO3kmKvJiqG7EaDBHcyrKbiOm3Zv1dUUl717fMGki4gGFgkaZIkqnpV+QcBlvQdlqGjPROMuJoDcx632V5gx6UNx5Y3x7reVl1nk1S6AMiWTD4GZXVyZiSeEQM5DZoacmXBjEsddbDWq/88S/jH5pTjUHh9gO5VV+Po1bdYd7c8nQtGltgBR0RY0Rm7REWCbSHSCS0R7DHznHVLBg93nF47AWqG8rh0sCp/zlMi5rUZoAENoKK0FGz+K+i+WifSpJPHxkKQfKyzfjTEUPhSRPk1rlQ/fzEMIlXY+SOoqLhwyNecDHzCNYA5pJmt7ePPissFYMVLd4QxQOVrdcWx5THaZ15g0TOh27ESJ9WrbXxt0TodUijo74b/JvFTm9QBmrVKJsMw0OAvfVYJ7A8qimyLCG0pU+YNen8JJ/1D7TqfGdcM6d+0zAbSKAxGg8cvmTMLkb/BQE2LRC0nVOBVE6uuyVw3UPcYofzKmWqjBHO8VW9UuOTIqljXIoNOGkgj4MeosPzR//b0gzo3jIeC5rHGdqjv1mFz X-OriginatorOrg: Nvidia.com X-MS-Exchange-CrossTenant-Network-Message-Id: 6db38b0e-e2ab-4b96-3aa9-08dd31d191ba X-MS-Exchange-CrossTenant-AuthSource: DS7PR12MB9473.namprd12.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 10 Jan 2025 23:50:32.0258 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 43083d15-7273-40c1-b7db-39efd9ccc17a X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: RIHW6+YpHhLSMBv/foLt/VMWSbZ4KqJPx6h+4FY8M2YqcWVHMzZTvpJb1R+ycFED X-MS-Exchange-Transport-CrossTenantHeadersStamped: CY8PR12MB7753 Kernel already supports splitting a folio to any lower order. Test it. Signed-off-by: Zi Yan --- tools/testing/selftests/mm/split_huge_page_test.c | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/tools/testing/selftests/mm/split_huge_page_test.c b/tools/testing/selftests/mm/split_huge_page_test.c index 128004308233..3d3bc40a268b 100644 --- a/tools/testing/selftests/mm/split_huge_page_test.c +++ b/tools/testing/selftests/mm/split_huge_page_test.c @@ -144,7 +144,7 @@ void split_pmd_zero_pages(void) free(one_page); } -void split_pmd_thp(void) +void split_pmd_thp_to_order(int order) { char *one_page; size_t len = 4 * pmd_pagesize; @@ -164,7 +164,7 @@ void split_pmd_thp(void) /* split all THPs */ write_debugfs(PID_FMT, getpid(), (uint64_t)one_page, - (uint64_t)one_page + len, 0); + (uint64_t)one_page + len, order); for (i = 0; i < len; i++) if (one_page[i] != (char)i) @@ -174,7 +174,7 @@ void split_pmd_thp(void) if (!check_huge_anon(one_page, 0, pmd_pagesize)) ksft_exit_fail_msg("Still AnonHugePages not split\n"); - ksft_test_result_pass("Split huge pages successful\n"); + ksft_test_result_pass("Split huge pages to order %d successful\n", order); free(one_page); } @@ -481,7 +481,7 @@ int main(int argc, char **argv) if (argc > 1) optional_xfs_path = argv[1]; - ksft_set_plan(4+9); + ksft_set_plan(1+9+2+9); pagesize = getpagesize(); pageshift = ffs(pagesize) - 1; @@ -492,7 +492,10 @@ int main(int argc, char **argv) fd_size = 2 * pmd_pagesize; split_pmd_zero_pages(); - split_pmd_thp(); + + for (i = 0; i < 9; i++) + split_pmd_thp_to_order(i); + split_pte_mapped_thp(); split_file_backed_thp();