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: 13935600 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 EF4EBE77188 for ; Fri, 10 Jan 2025 23:50:37 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 18D726B0095; Fri, 10 Jan 2025 18:50:37 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id 13EAB6B0096; Fri, 10 Jan 2025 18:50:37 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id EF9626B00AC; Fri, 10 Jan 2025 18:50:36 -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 CE16B6B0095 for ; Fri, 10 Jan 2025 18:50:36 -0500 (EST) Received: from smtpin19.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay08.hostedemail.com (Postfix) with ESMTP id 3A33D140F5D for ; Fri, 10 Jan 2025 23:50:36 +0000 (UTC) X-FDA: 82993189272.19.CE24617 Received: from NAM11-DM6-obe.outbound.protection.outlook.com (mail-dm6nam11on2057.outbound.protection.outlook.com [40.107.223.57]) by imf12.hostedemail.com (Postfix) with ESMTP id 71FF240006 for ; Fri, 10 Jan 2025 23:50:33 +0000 (UTC) Authentication-Results: imf12.hostedemail.com; dkim=pass header.d=Nvidia.com header.s=selector2 header.b=rikZQAlQ; dmarc=pass (policy=reject) header.from=nvidia.com; arc=pass ("microsoft.com:s=arcselector10001:i=1"); spf=pass (imf12.hostedemail.com: domain of ziy@nvidia.com designates 40.107.223.57 as permitted sender) smtp.mailfrom=ziy@nvidia.com ARC-Seal: i=2; s=arc-20220608; d=hostedemail.com; t=1736553033; a=rsa-sha256; cv=pass; b=Z+B0culmyeOQsFmNp8yFQvQGwkFka4E1YbIGAPNx8l9hvXcArrcka9RChjC4pkACE7QVZA wwjaw1dq/K967SlNiV/IUQ0EEfDMAh9qpC3BIt4GnEoMPiASh2TAbGeVWRBLpgGlfQXaqv xjjGyy5z5cfrHkRdOnrs3B4SdyZvyt4= ARC-Authentication-Results: i=2; imf12.hostedemail.com; dkim=pass header.d=Nvidia.com header.s=selector2 header.b=rikZQAlQ; dmarc=pass (policy=reject) header.from=nvidia.com; arc=pass ("microsoft.com:s=arcselector10001:i=1"); spf=pass (imf12.hostedemail.com: domain of ziy@nvidia.com designates 40.107.223.57 as permitted sender) smtp.mailfrom=ziy@nvidia.com ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1736553033; 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-type: content-transfer-encoding:content-transfer-encoding:in-reply-to: references:dkim-signature; bh=pvuo0DQWBpDZQjd2+y9sIIdbZUUKkDzGaFuMGZpzt3k=; b=Y8wkHtdJbgQY0pclQw7BzjRXcZhsanerhMIBiQvtS1CoSQ+JZRoUqZDYHQYR1JBpikpt9p Y+bbgzYDEP6f6+KFY6zSJ+dj3nfOpC4MrFUrMKfU5shnWmrGrv1/jT2N5GlAK6xinl7Y8s s7z+H4NE+mOQy8mRV52zztCIuBtNitg= 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== 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) 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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aTGnd4fBuTKvTHqBES5mLSTUxHqBPq2sLImobdFBkBHRdI9wPNQqCm2glo+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-MS-Exchange-AntiSpam-MessageData-0: pC4q3dHGSIXZjCaQuRnye32XPNzXlz9Zll+X7pVnVgPocgYM3qHZI5L2v4cG0Ru5bq5HNoNTGmyPVAcqPzryF3/3FcYMJ1eiMTw1OQX4jNRcR23eoZxKU7GCPMmX+i6mWldN+OFz1SffOqY/lv1SHcLAV4ojh6aFosT25eTc5rQO9pQrObJLudGeKfXo4imk4DHWzYxX2gTR2VJUZ3CqzVQdxrLb/y6NUiQVQnYJHc6nsI1xOorQzHnOw2gRoVqIwwkQzqn1LVtPNCws+/TH/7MXRGhSyphd4YDCaEkb3MwmyH1qw5OAkMnsIPrAUDzXfdm/UVWhwZ4IVycTQTV+C4LfGbWmBPQP6jK4MaHPT/NFPP5CzT6ANACavdF1slupe3S0VJpF6C8HVifsfK1VXcUPoiMK4qvASahVCUsBxIJVgOgw6plrLAg5ur2v/jOEV4q49KFo/dXbDH9tZsetFFyYg8wSuOl9+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h1Gy/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 X-Rspam-User: X-Rspamd-Server: rspam03 X-Rspamd-Queue-Id: 71FF240006 X-Stat-Signature: szkgbnzrcj9d65nedje1ikuex9zyeaso X-HE-Tag: 1736553033-156764 X-HE-Meta: U2FsdGVkX18jkvnFaiSFyq3ZxT6TbO3mD7UpByMoP8xQzslIxH65dSL0QrFaU+KR5j3/+HwgPAK/b/LxrqpkOSXpJThlDG/P5lrwyXRJ+CP849ebNFXEcLEftsFqNZ6oiyNqH0UvsEMri9hczdCx8hgAWZ1OuUBR13Oitn3o0P01I004LF2Vr6IX+QW2Wdkmm9AWFhO6QJ6n6NntM6rOHh7bjJV2ctObzG+Z7zwBBUwbyEmal7PAO28P4j2ZjPil3oaajqPOVLWAT2C9wTQ6gsD9FTqBOM4H67fIrc1F1BlpdNlSrS6SrwJj1ivf3npeQ6ryI6U0FiMFn1V7I4gfjzLBE47c80PjcT+8rvq5RL/WB9ulrnblifXTROq1QMrPEvCGgV6FoXHWF3WBxh7rGVE8FYxF7ocaSRvVSwj+HKbpNrWBG6u5wa+lUUDBefwvlVUsB1OzrZcWW1GjutllwRPTYTtHqmCgy35+m50MCGSHSdE1SdEK+mmrMYf2pAjm2/yiMiQITd5LOvSWsQrmYmk88ZWCsTI0GfHYX0pJRucLHW5N3+uoi9cFy+MvVG5eYrRgV4MvWIzrjv4O6RkbtYXXkVIbUQx3A1taRT7+eAYvae9Ls9qC3aGFu15UX6iJzrhyrv69S0O4VLt3qtwYJCGL+3me2D3wsIRsISx3n03ZwfNUKATb/IbXlriMtBSA/J1FLH8apS0WqwBmwzqeMA00935vXXLD95eLKsdlSNtXOGsPvGmxhkkTDr5T1HcYyQhehnHaATbgRh3NodZQsjU4m+w/bUF3SFUIn69WICBPoXfhnwo+c9y+YD5q5hdN03L4hD14Hy/snrgBCYAoUWxQRm/wE2EGLoWTVOntPsV4H/T+Q0yfJnNudfEQa+JNXHFS+rA2NNM50+7eyNrDCXN4ekDHo1ZwQfk428/jKKWaLumdWpsX2iSgr2+CpYXvXCmOI/Uo+hZ3WLFwEVf jEvon7Im VyOpsdy5ximXY5BtsEkls5vfym+5Y04QGc2VtovtdkcoRjcYbNVB4vAVAoLx1Jv3BYbuXtfcHiLeIZyDfP5jVB3Wsf6rTnBDzIqCPB+Ke6MIbT7leT4vmlsUTjueoQ/lApXnvC0r9rOVAWYjQWNMV89eaPllrfX/613G8G4WI+v5M5a50Lph8VK/2pr5soLIxKi4pVLRky1BuiA4dSSir5fihTtIVA9QXn78Xz9GdERBZov+CG9dq5eRr6sbEvsl4iaU79K+pdAZ3awXPoTnlj76XahzivTgl4QFO/H5UbkdR1YGUudDneWlzITASFDAzMi4fYXc6wd1VKMs9Un5u+Mj1uw== 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: 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: 13935601 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 189A6E7719C for ; Fri, 10 Jan 2025 23:50:51 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 9A7396B009C; Fri, 10 Jan 2025 18:50:50 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id 9306C8D0002; Fri, 10 Jan 2025 18:50:50 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 75BFB8D0001; Fri, 10 Jan 2025 18:50:50 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0015.hostedemail.com [216.40.44.15]) by kanga.kvack.org (Postfix) with ESMTP id 5372D6B009C for ; Fri, 10 Jan 2025 18:50:50 -0500 (EST) Received: from smtpin02.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay10.hostedemail.com (Postfix) with ESMTP id C502BC0F65 for ; Fri, 10 Jan 2025 23:50:49 +0000 (UTC) X-FDA: 82993189818.02.B23B9A2 Received: from NAM10-BN7-obe.outbound.protection.outlook.com (mail-bn7nam10on2082.outbound.protection.outlook.com [40.107.92.82]) by imf06.hostedemail.com (Postfix) with ESMTP id DACEC18000B for ; Fri, 10 Jan 2025 23:50:46 +0000 (UTC) Authentication-Results: imf06.hostedemail.com; dkim=pass header.d=Nvidia.com header.s=selector2 header.b="hygXwz/O"; spf=pass (imf06.hostedemail.com: domain of ziy@nvidia.com designates 40.107.92.82 as permitted sender) smtp.mailfrom=ziy@nvidia.com; arc=pass ("microsoft.com:s=arcselector10001:i=1"); dmarc=pass (policy=reject) header.from=nvidia.com ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1736553047; 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-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references:dkim-signature; bh=LfFaXkc7nFaNyA3q+5TZEaKsKDeeXOUpsxgXCw4KiV4=; b=TDcwgj1M10gGc+ozRf4LhhTLJefI1bpUZCIkfhoHOF8f0EtNwbBCVHRlZjThCJI6dpQ2yx 79ZtaneKaeCC+uiUJLhVejS5oG0/2Pz/ZmB1yOT4EwJaIONOAzy3GDj622HAAiK8GUayK8 ygZF4BQMhpNu8BJ9ny9JuXsC7U9jwdo= ARC-Authentication-Results: i=2; imf06.hostedemail.com; dkim=pass header.d=Nvidia.com header.s=selector2 header.b="hygXwz/O"; spf=pass (imf06.hostedemail.com: domain of ziy@nvidia.com designates 40.107.92.82 as permitted sender) smtp.mailfrom=ziy@nvidia.com; arc=pass ("microsoft.com:s=arcselector10001:i=1"); dmarc=pass (policy=reject) header.from=nvidia.com ARC-Seal: i=2; s=arc-20220608; d=hostedemail.com; t=1736553047; a=rsa-sha256; cv=pass; b=CMyRMVRO8q/ltrHZyr8MNBU3fYbU84SL5I/oVmFOQaXmOZPuhIFDTOLEN5/6GXUEPX0HXR aqbLKcW7JL5H8+qvGBS7FbcvJT/PLFLc9yUQwSOTj6PkmS2tE7VCvF6F+Vo2z6CNwafPcX d80nutVnW+yKCRUqLhSb6vbfQLTo/s8= 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== 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) 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/KrZ/GzmFfYep0x3XCkgOErHZwYJF1V40kLMFOS0VC5awXu4tRgyAFfRQ7CxULaWipA19jlEX2cl5wZEKRchyAawszRuNML2Dsnb1hBWUIA/v7b1PG551TVSA9AcbjlzGnrHKQqCH/9FqoOLtgJm36TnCZ72w0srLijkfWqICif38Lm/05HNgp33BjGF16NKGOtutXMUc8xvrR28M1yB8h3A7LqYvfTUhAOE2lDmHJc1BTsSJia2TPd4LbbBOBG6Qn1R77bwFfD0WHuUrVIr76jlg57dgjZJYvEtMsFUpDiOJkuLPj121gq62f/pw2q4bFnchBJCH1LfUZsbgATxahkPz43tjRbcB6z/QRtAGL5g5QG26ADgJgQ5RCa/E5ZYsG9zoalvxabSf3OfYVXcWJq1wx7nzvD+xDYXvsyCiwwLeIJ3BIUEIVTTNchVgwRuUKiJ2mIPiYxcTxj9+0Fhq4HXfdMhk3n/LVZp3zfd9mZfkRcKmEadt8K677vqqX7JtEIXlMOyxKhjZahC+8xN5S4J/r8ZlbzedVpnK/gZEF4tKuPEthxwXWqyffBSplNe5gPQnvDJleRFjEBXm3TGeLEPCiE40xCz+nCsR0YOPZP1vGtJVZ8xEtXnKPFVMD5mXeB2cCBtFpSOkY3wC06VNZYw0JPygYVXh6qOuhbgxssb/X8xT5mzyOZTwV0t2cC4buvXGFyV3sCtYBgNyk8kwElmeN66aNb9Hgj/vgvRtVJscOx59qqiVsJOQV3ow87AGlgMP2Xlc10r1lSx0rwC1r7sdNCUZ9ZRMeGA8096u1DYQ0nRRQ5twwZ3AUBNbNQE521DlkmYLWZ6c0MNFl1vCam9jwc1ZrKi4tTFt894IREQOPDLl8ik3KrA2MeQ1ysYsTdtFoRkFeVPzDTmUArOT03spLzjgF1rQc0aAWHW7rvjIlcyn2mdaqmawY5bG4r14OSvHKXy7TTSUVB+xnlVOW9/F6Na8EmD5p4dHbZDVmKOZnewn/a8jMrP6Na6+C0sMheuJlqlNKvT7dfLQTf468frS9GqBELxNrmr+NxLH6fHmLrwEnFxbCWOrIeGMU4xwZikAIUMSt8MSZ8jH2R8iu811qT 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/1FawEJMGrwTvmID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ePPissFYMVLd4QxQOVrdcWx5THaZ15g0TOh27ESJ9WrbXxt0TodUijo74b/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 X-Rspamd-Queue-Id: DACEC18000B X-Stat-Signature: ued718q4fdxpk8ry5go8gpyh15j4ox1i X-Rspam-User: X-Rspamd-Server: rspam11 X-HE-Tag: 1736553046-558869 X-HE-Meta: U2FsdGVkX18k8E1ASfEeo9gUEUT7iIn7vnNRYWC6iRy+DdTk4fdNqlPrUMBKrIMVtrOu2EPitViZR553Ljbov6i2GUl3WvOTbHrvmAH2zwkNslI9Rrf/vKxeBbf+AYJe4t0nXYYej73bKLkb1SDnjgS4Fr/CKFkooAETJhegz+xfVtWzugOrjSJBSvJKX0q9gcWUHRVwvf0v+coJ2VeLbV//j7HeERAkFcfEqFsXoqwH4WLFHUkWAPOBdAnNxloxz56dw/4AaVsdiSfHkV3V8YVs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ham, tests=bogofilter, spamicity=0.000021, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: List-Subscribe: List-Unsubscribe: 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();