From patchwork Thu Nov 21 18:52:19 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Zi Yan X-Patchwork-Id: 13882252 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 01C03E64002 for ; Thu, 21 Nov 2024 18:53:10 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 88FA26B0092; Thu, 21 Nov 2024 13:53:10 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id 818636B0093; Thu, 21 Nov 2024 13:53:10 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 669CA6B0095; Thu, 21 Nov 2024 13:53:10 -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 466E26B0092 for ; Thu, 21 Nov 2024 13:53:10 -0500 (EST) Received: from smtpin11.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay03.hostedemail.com (Postfix) with ESMTP id D760EA14BF for ; Thu, 21 Nov 2024 18:53:09 +0000 (UTC) X-FDA: 82810998774.11.E42C32D Received: from NAM11-BN8-obe.outbound.protection.outlook.com (mail-bn8nam11on2049.outbound.protection.outlook.com [40.107.236.49]) by imf30.hostedemail.com (Postfix) with ESMTP id C744980021 for ; Thu, 21 Nov 2024 18:51:26 +0000 (UTC) Authentication-Results: imf30.hostedemail.com; dkim=pass header.d=Nvidia.com header.s=selector2 header.b=VvLW3z6D; dmarc=pass (policy=reject) header.from=nvidia.com; arc=pass ("microsoft.com:s=arcselector10001:i=1"); spf=pass (imf30.hostedemail.com: domain of ziy@nvidia.com designates 40.107.236.49 as permitted sender) smtp.mailfrom=ziy@nvidia.com ARC-Seal: i=2; s=arc-20220608; d=hostedemail.com; t=1732215119; a=rsa-sha256; cv=pass; b=CWBj6feC/Fzkjvg2NDg1jhXzXzSm914QzvM2N4ajYQ5GjC2a1Nfpe1HcMBAO6rwtSb4QAD FTcdgNklFdIhEoDhp8b5XYbxWV0miv/sDSyCrjxQtlu8uLJEb7ezS3311b0O+QtC80/UpB sS00RqNAVpIuoNKm2RWdkm7hVMTaB7s= ARC-Authentication-Results: i=2; imf30.hostedemail.com; dkim=pass header.d=Nvidia.com header.s=selector2 header.b=VvLW3z6D; dmarc=pass (policy=reject) header.from=nvidia.com; arc=pass ("microsoft.com:s=arcselector10001:i=1"); spf=pass (imf30.hostedemail.com: domain of ziy@nvidia.com designates 40.107.236.49 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=1732215119; 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=FZxMul1WU308N00KYNlcxD/DyDEr6jnTyKBgAiwblKE=; b=4eic+zmSX2aqHTW6+hpN2FwN6PrFH1V9gTQRxWDz9SesP0EkdueRw6ZOHrp2/Y9HJT2Q8y sh+LORNkTL/bJ1VD5HPmCQTdnUeTn0P+fR6vXl9mmalMnf1QLJN4eI8XJidTUwUY8bwO4Z AYG1c9K63TWA5V/LQxX0/OTy8revexk= ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=f6YGtIf913s95DqRdQ4qpMenjI7RaZEGcjzFL0BDpoHpXU5Us9fmNIAXVFlCOXkTE9jXao0w+oUNHuoFe+DMfxtl31yA2IxBPQQQDihaAbvAoLkV/5eXIkZ7lkCGUMxnSY88uhtJlqMo68Tp3pWEGc5JriVpe9W623SZycaTX6endfZM82zf+j+zC6Feyo27b5wJmrwroCSxarJp+xprZqAyPqV9Yl/Xy/yf2BeBOSg9/4ZX8jZ5rhBnbxxj9yau4j63LjqWsxfiYdlgRjZVRrashY9sh6lNPX5arocBQcgyt/wWlSir48vn5Jk4ufh7raOmojwCqFvqMG4XakxTpQ== 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=FZxMul1WU308N00KYNlcxD/DyDEr6jnTyKBgAiwblKE=; b=IW12Km/Jev2dPiSdRCrrj1sQmX0RbqbaOPyXeD160FD/7SuSU+z3gk6SjRUfBP8QJTG1l8rASLSk6cYax2+GOBj/qhgIqsHAeiMU2Siv9tbEopF30NcChThM3GsUNIuIO+N+G3NGFcaO6NdmiCJQHpo02ve0cku+HSS58P/Ov3O1e+Sns62dvnNHE+d5qmHNEAjdTH3G56PwVPVRb2TQ2PEU+2JXmpVmzpKetOGM/pU/6bL6geKu4vxI/097/pp2J24oMAguyBoRjyy6P2f/LFrJKH+1Bh0UAy0iIgLPGxikzOJEoDbp1qZOHLwo6fIxqzJ9ns8RdgUa4GyS1w8LLg== 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=FZxMul1WU308N00KYNlcxD/DyDEr6jnTyKBgAiwblKE=; b=VvLW3z6D3np/o5BsQn9FpOQw8X7W1MDC+7R/1N/ClAtmpQBIrO2sz2lSYRVUIensqnfYIDRMcS8lW0xtlh/2lMvci2WVolq6vR1GxW2Vp+8bj/5syOHRqPkCqr6pK6kqnQ8laqVgaSKEsa7o9ccyFDH4aAuOvNnx3vwz23eQgUkF2I/t4jCkZaEiX2NIZKdc0xpsaqAjRwzzQe+KZTWaPLfIkmNI43p4m0GxiyYUgrtROrktkJCyE40vBz/+8Xx4Le+IGUkHQ8BzO95HdZhNnUZWnRjlJfh+pDUzeJI/hdvw1RHK0Hvq8fGAR+B53Q3Q1mF+bdzSIc9pAKwuAGblZw== Received: from BL4PR12MB9478.namprd12.prod.outlook.com (2603:10b6:208:58e::9) by MW6PR12MB8834.namprd12.prod.outlook.com (2603:10b6:303:23c::21) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8182.17; Thu, 21 Nov 2024 18:52:44 +0000 Received: from BL4PR12MB9478.namprd12.prod.outlook.com ([fe80::b90:212f:996:6eb9]) by BL4PR12MB9478.namprd12.prod.outlook.com ([fe80::b90:212f:996:6eb9%5]) with mapi id 15.20.8158.024; Thu, 21 Nov 2024 18:52:44 +0000 From: Zi Yan To: linux-mm@kvack.org, "Kirill A . Shutemov" , "Matthew Wilcox (Oracle)" Cc: Ryan Roberts , Hugh Dickins , David Hildenbrand , Yang Shi , Miaohe Lin , Kefeng Wang , Yu Zhao , John Hubbard , linux-kernel@vger.kernel.org, Zi Yan Subject: [PATCH v3 8/9] selftests/mm: add tests for splitting pmd THPs to all lower orders. Date: Thu, 21 Nov 2024 13:52:19 -0500 Message-ID: <20241121185220.2271520-9-ziy@nvidia.com> X-Mailer: git-send-email 2.45.2 In-Reply-To: <20241121185220.2271520-1-ziy@nvidia.com> References: <20241121185220.2271520-1-ziy@nvidia.com> X-ClientProxiedBy: BL1PR13CA0219.namprd13.prod.outlook.com (2603:10b6:208:2bf::14) To BL4PR12MB9478.namprd12.prod.outlook.com (2603:10b6:208:58e::9) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: BL4PR12MB9478:EE_|MW6PR12MB8834:EE_ X-MS-Office365-Filtering-Correlation-Id: 55cd1dcd-20bf-4a0d-9a8d-08dd0a5dacb6 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0;ARA:13230040|7416014|376014|1800799024|366016; X-Microsoft-Antispam-Message-Info: 4UsN91yzlTcAIIPUjS+LxIcR1At9NZqa+nPI6BGO023zIam/2FCmeeSyFm7YsTaj/K6NCGWYEldkUxCmkxd2q02by1OMBCUYMlXYsoItQGGay+hgSXpZ4FRe9XOq88qYTyhWHavtdf22wBAec8zIq0fRPvMqjw6mDdtLscwm0oaZZ/K2rwNNg5cQuDixMwdCz21+w0v2kADM2414awntH2X9xbWE9xAYR/hV3upxF6Gg500hNPKqVAFI8XAEAWCLC9yMsWrFzGdIkasw/tLhFQyBL6iYKQuPqd71DdqxSyQRR+k9TQ7CiQ7jsBnjoAl/Xjff7UhyM0s7t02PjikgpbLZDUrgZT5V7vTC3XtxI8c6K+fRoG6Pe5ak575ZGuH8z8im/DCTino7fy1mUCVy+7zWVROcVlKVOul7jCD1uVwa1rW8a+f/8I4VPHcoQk6OTQ3I+YCUG53rofD5zIHSj+/ZT5rCcnJJ62QVz4/DCp7UebyiqJHbRTb5K/eVmvE3BXxv5mAcACMsboDwSi9HoOJXm5TxhDjzoBnmgshw0JTfdFQPKW9iyUTKA6I/WlOKiUh/Jm7BzF63j/dnL/iXSbELkZFJUfBBUbMVDkjCuDxepBG2nKDPBojl0C0VoyWgGXADBf6CRc7L4CK0myQ0QNvQrIAG3Yxuwawyqz8M5cocThUA9bEK6iOfILiDc8TQs8vUMP/X1Mdq7qOZJ8ZiSo60l06lDFT+udjg2Rf4aJzNX2MuKPPgYLHSrAjq8t7ShmWqRuRmdNWEpUZcmm9W6c3PDbGaadneLIomRru4N4utXbKvMf5Mv+d+QjJCSsjXYcmYcF39MItOLB0OSmjOb0rAVdiCPQ6WjrAPirN1W4qtQgJL7hVIBz/ddS/UPgN2XL8uOANfsPds+Ex1eBeTQBvDhlFR8a2Lcd4TKwYgBLollOk52WDp5C6FLlR7jZodqj1q6oY28MgdXlYe41bYuZ4+uuLjh1dZ75aZELSk34Hh0oQig0vYPMEHvEjxG1YIgDZRpMg9xRWFNsR03NsN+/qCGxJfOkUKARa3ofb7LIxjx+DevT5y4GHtT64tqXuHQnphID1z+VWLTsT2JkeXZ+De2vRrankqpbw/qMn2EzqUchkkgs3axwdPJYD+YPutHLie0rRz/KQb4KVtUJNwVkDAdvWzE+oq/BKBs3B4S2tEtK+lvxrGeBrHIr4VLmwm3OcFsKE/u96LpBg6yg+coQrEs9SEpGmvS3aO0ygmLs2B85Yzw6iAB4xNApim5lmQunZFxVsda0zk1SQ4stSO56Sd5tTZxuoEb9ZtHlDeJ1nakaYWMC12A4JTadwjvgLg X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:BL4PR12MB9478.namprd12.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230040)(7416014)(376014)(1800799024)(366016);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: alo0wEYHA4zfFcKYJaglvrWFwITA8oMBdAJna8Co3ZHko+l9TPOPS4yu4T4ymM9jg/jlx2bATKMOm4gW4rvRgFEWuR7Q8D44c4JUdJJjIEkhwC2hLaTbdjWNVAF11upmQFc+Ma7+25BcEArIenjAFuF/l4ZmQ+mheVcq7fLQhnaIu5GNXLsc2lA64JuUH1iLguMzAaw0MHiEXMjMqD8MIZ33Xh6JsclpLBI0LpWFRaeI1JayLA+Lx+ITAgiVjkZPoVOpDNJ31DOhsbjagNU51884MGw13IrrJSg1ytylLBW4bt0lK5u1vK9vCS37Et98Gu5r3ToaWQlw1SmIITQqJjPWsuxK8DYx4NvIy1YfSBEWdO5PhA0Q1ZGRdd2dzqakVvNn2ZuKib51QVtNQL422ZNWm/MSAm9N9pC9cdJnVoTo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blzKgBVn6coz79EjU+nsFKsx3wjwLXNjZvh7MteBoMoTR8NFRJpyVyXA9ZCa/hZzLKg37vfCXrS0IaNOX+U6/XE4cUfEWPhxdcAx5 X-OriginatorOrg: Nvidia.com X-MS-Exchange-CrossTenant-Network-Message-Id: 55cd1dcd-20bf-4a0d-9a8d-08dd0a5dacb6 X-MS-Exchange-CrossTenant-AuthSource: BL4PR12MB9478.namprd12.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 21 Nov 2024 18:52:40.3428 (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: VgdbY/S8zC9OIzXqtfBWCkGPO+SA/r8o7Wmabz5lEKYImm/C5/Z1aHSjHfFk78cJ X-MS-Exchange-Transport-CrossTenantHeadersStamped: MW6PR12MB8834 X-Rspam-User: X-Rspamd-Queue-Id: C744980021 X-Rspamd-Server: rspam01 X-Stat-Signature: 9yj4q9pg9ube17ht3dj6g1gbee4iukcm X-HE-Tag: 1732215086-244069 X-HE-Meta: U2FsdGVkX1+5c7ed19SMt78Nv4V6slnOCvZPR3nsijFFY40loVO1ysTck9ZQTa5hDS5hoExPoOH7fi+KWKAaZTVaCUvS5j/HcDaWilil8FaxCODDD6R7P3HaFnyHJopRpMoVMBeexx73tnr/WbMlVXsvLeI3JcWvGdKWKdbsseivuB5FW/0yBnSf0mogXxPOEpP7oQa9tmMbJbh9eklxhALbBIwsfbywTLHB2fYi77fo/upniEZs/Jz+ZS8mlmJK74VO5w6p+lIDqn8/A5edUTU+VABT2H1dVP0YBsJYZnwoQLngJD6hT0hHX2P3rb7SVy8iFpgK80f3eOpSoayyASIs72RCeABYAX1g+VjWaWW3FVpbCSxjjQBy7nGOjfpRMTefPTG8Jl1hE79Cf6NBGk2ULE+dyrvA9Jz/YNdnkQHeSAtCE6cy1GLeWnvaskgWlOBEM1MJ0Des3AHSTsUqaWh2QnO85UuQHv1bNs1pUkUPQQko0+tsEUFrl8BojJQ/2U7lHHE60OGcn6uKBvs9Z0PCUClqponnpebLdNULlQvpHS1bOmujywocqVCyVnd5WegAHz/QQhuQT6O7EYWWmSHk70HXqjGbQL3DEKGlO9rv3TDbFX3qtuXDDKwW5mNydTagW5KPZetp17GCxe5HS892uGu60h+PS9A3zU7PNo70KaUDvwXT6eaCvtEOraXoKaETBTlBOBqA0GCf9MZ81KPEIECrPKD9lLfGlopf8iXEgX6MNCDgBbEVF5HWCyGS+Ge72WmaQ5tygsqoROoZW6Wfl7FI/JyWfomvLXAuT0eE6XiRwCTGY9dBTobWQDp0OZ+fwpzoqDZdgOCzX66kKu88WROLFLPqktmFO/iw1DbIxJwGLWva1y37q1/Uz3YSKR7TS0gwAeMAdLLETdH/hqowGTzflgfzMz9Q4q0G6eCFx2/jQwBrng/8sPhHf/b6n01yIXUP38LtrMfBTzR KYZ+sTQ0 1UlSQarLq6tBBvC9jEA6ICp469vwWBn3aZ3ZSZEjEnveKPxLjT8xovoLBNwHgxikiUjxegrGIHArm9AjzmWykh+NhA9KDRhha55xNhtSib8g/XwZ7aLaooYkLjnZCuEXLKh3sJ4O0v1uflYghWcsN6ZIAmzI7ml6AQ7Mcs3l7ZThQWLEs3SpvQ5MdPkLkBQ9SuUsZ8qG+rHFa8oLVR6yoWlUtIvW3lbDXnYAkV5lDcLsDSSWg24U2H27z99fJra3m6Ex/WRneu4k1rOZ0IM7uKdXkPx3t7WGlqUIYDV53keYKjfm73kQIdsBbY9RpJlXhY7uHSFMR1Cy5HDmZEWWQ/TJMJA== 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: 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 cd74ea9b1295..5bb159ebc83d 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();