From patchwork Thu Jan 16 21:10:42 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Zi Yan X-Patchwork-Id: 13942316 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 59EF1C02183 for ; Thu, 16 Jan 2025 21:14:33 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id C5B1E28000A; Thu, 16 Jan 2025 16:14:32 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id C0C2D280001; Thu, 16 Jan 2025 16:14:32 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id A851F28000A; Thu, 16 Jan 2025 16:14:32 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0013.hostedemail.com [216.40.44.13]) by kanga.kvack.org (Postfix) with ESMTP id 8A215280001 for ; Thu, 16 Jan 2025 16:14:32 -0500 (EST) Received: from smtpin25.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay08.hostedemail.com (Postfix) with ESMTP id 419B314086E for ; Thu, 16 Jan 2025 21:14:32 +0000 (UTC) X-FDA: 83014568784.25.FCE05A2 Received: from NAM12-DM6-obe.outbound.protection.outlook.com (mail-dm6nam12on2049.outbound.protection.outlook.com [40.107.243.49]) by imf30.hostedemail.com (Postfix) with ESMTP id 7AF3880014 for ; Thu, 16 Jan 2025 21:14:29 +0000 (UTC) Authentication-Results: imf30.hostedemail.com; dkim=pass header.d=Nvidia.com header.s=selector2 header.b=ZPZfRt35; spf=pass (imf30.hostedemail.com: domain of ziy@nvidia.com designates 40.107.243.49 as permitted sender) smtp.mailfrom=ziy@nvidia.com; dmarc=pass (policy=reject) header.from=nvidia.com; arc=pass ("microsoft.com:s=arcselector10001:i=1") ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1737062069; 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=sOP6cfEHCGqXZ+l3ZzVwerXuZKCP7nJJu/MyQzTkN0Q=; b=a5dLZQoZYZkNISwxrQAKGzZDIM5fAO9+SN2DQ6rMbtw2btVifzAwbBj5uL59t5v8Wls7Z+ 0AwV/T3ZjVwQ+XHxketzE7UrQh0E6HIwvc2K4tFluFK+9f9jElCPJ4DEgzDXcLhxgaNxtN iNni362CN/zoxMd2q66BM/7sdaSWGdY= ARC-Authentication-Results: i=2; imf30.hostedemail.com; dkim=pass header.d=Nvidia.com header.s=selector2 header.b=ZPZfRt35; spf=pass (imf30.hostedemail.com: domain of ziy@nvidia.com designates 40.107.243.49 as permitted sender) smtp.mailfrom=ziy@nvidia.com; dmarc=pass (policy=reject) header.from=nvidia.com; arc=pass ("microsoft.com:s=arcselector10001:i=1") ARC-Seal: i=2; s=arc-20220608; d=hostedemail.com; t=1737062069; a=rsa-sha256; cv=pass; b=M/MhWMJhn1cQFNTfnp/tRuomBjFHurOMj7VkiIJuaS8qNHx4nHbyAXKFJ+UClt+zKeXwka qKOK6L442BBeA7NBy+XQHvaVAy9HM+PIvviIVCTjbLJf8v+QxHxQYG0ISKks9mnDUDuU5x aXKuBjQawexXbVNYNJJb1Iehs4cMc8I= ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=pZMFaKvcC8CTnFSqvdG8Y9J5hJF2+gIQTMGG9FONKwn2aqNgIMdPWO93K6sDZfk3LlJe36pTWbH3ljaq75ZPyOzc39lRYc1goLMZ0V+ocZ/NH/Wt1ywOb1lszmRC2yDqS63lHk+WoLs9usVqT9A+GIARNWsKgeedYmwoMqk+OPaYcSzM2n5JpwuqkKGepKGA2gksPUvF9XI6x1Vi3YyocYbJJrIKBeCGprR34X6klFNbmuDZ3NrrJafMjYOk8BWvlFGU5lIUYM3unnVR8LyLgFk1k/a2T8c8opG8DyuKHIDJXQuYYzEgxLc/LDFGIcJRhrnm1usiS6Tb7CgrWoPHAw== 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=sOP6cfEHCGqXZ+l3ZzVwerXuZKCP7nJJu/MyQzTkN0Q=; b=uvA4uiyKU0H3weiZWZ5tE5WfCEImip/oERZgqs1uD3f2Sokgfvf9KctKgfp6OqMLYhPoOFgiWjUnM6yz+8EZ7oj/LpvdPqZsUGZjv4lAckD82fO0uXTG8FgK7MHEaw65I+mjmWG4fpTFkd7y5xAfJLPNIfubRXUfPwU7+m+9Op2+Z+OoV6xsnzFtgpQWzdj6lprNIjf5dYssCqY6+2cGm/cYphxtQWRl2wi5XfOiBZaw0GqgCyQ5NK1hKFjho+WVpUpdt86dryDfS32HGB6CUd6BIGCemdWe1qddvsXqRjTJZC8+1D8cUqa1hxRejZCorGnSreSnSHXS1VN1Q5TDkA== 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=sOP6cfEHCGqXZ+l3ZzVwerXuZKCP7nJJu/MyQzTkN0Q=; b=ZPZfRt35RKHL8v3GK1EEevLgFZIix4h7SOso0O8bHKk2lh4gKCwklHAm+Me6A8e/D+5yPAOpxRrIjJBwV58xud0fdzt6eTFYR7sYhS8y/7fbRUNJQU49FU5+u1yS/UfjjReAqhYyZcRDdnF/4lBHZU7w/2bTpCGbBMCgcJiaHs0oJrP2Fcu9Afy1FkEPr/CIcXvB0nOpxIgz49YC3GYyPeL4tDIxIPWyUtgD95rAyZJFvO6HARjpNz/fwPS4f6dX0gq33OjTpXhrcF1qW+atLQTwZfQ9W4sdMBjlM2x6KNF2lvVsbFTeze1DMektgVbbWX0XlVIunRC8ekjMWhuObA== Received: from DS7PR12MB9473.namprd12.prod.outlook.com (2603:10b6:8:252::5) by LV8PR12MB9232.namprd12.prod.outlook.com (2603:10b6:408:182::20) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8356.15; Thu, 16 Jan 2025 21:11:05 +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.8356.014; Thu, 16 Jan 2025 21:11:05 +0000 From: Zi Yan To: linux-mm@kvack.org, Andrew Morton , "Kirill A . Shutemov" , "Matthew Wilcox (Oracle)" Cc: Ryan Roberts , Hugh Dickins , David Hildenbrand , Yang Shi , Miaohe Lin , Kefeng Wang , Yu Zhao , John Hubbard , Baolin Wang , linux-kselftest@vger.kernel.org, linux-kernel@vger.kernel.org, Zi Yan Subject: [PATCH v5 10/10] selftests/mm: add tests for folio_split(), buddy allocator like split. Date: Thu, 16 Jan 2025 16:10:42 -0500 Message-ID: <20250116211042.741543-11-ziy@nvidia.com> X-Mailer: git-send-email 2.45.2 In-Reply-To: <20250116211042.741543-1-ziy@nvidia.com> References: <20250116211042.741543-1-ziy@nvidia.com> X-ClientProxiedBy: MN0P220CA0018.NAMP220.PROD.OUTLOOK.COM (2603:10b6:208:52e::16) To DS7PR12MB9473.namprd12.prod.outlook.com (2603:10b6:8:252::5) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: DS7PR12MB9473:EE_|LV8PR12MB9232:EE_ X-MS-Office365-Filtering-Correlation-Id: 50bafa8e-1846-4aec-f716-08dd36724a04 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0;ARA:13230040|376014|7416014|366016|1800799024; X-Microsoft-Antispam-Message-Info: JGZy8xx+aOcqBewk6GQrrY//XYpb8NjA56i7m5VX6th/dSgbaFg2tdiSQ2mtM5wJpEJhyID0e5C3KKlYfbvryUNwhjLW5YoCXRgqHwG+3Q7EX76U70n6dOsBGw67jxWYDRFd96Eu3IUHgF0sjLW2MS58DfbUh4wUl9UJRhZ+ABZzLWwXffzk9XPNd117HfywF5OKik+kUHKQyfQqrijVVnCUJBfFnvNN57avKVUvtuz27vxBXP3bnSKraLCslgAiSB0yCBYHAaigAWZ9T8HEe9G44u+1+diNp2QbbhoD7EYVkcoppCyPfM1pN8a05zHIkFguHhGxRm/7kxM//wCVGDKM2UjWiVKK87bwUAdWGNHDIml5InWzyQfR2t6Nr9gGfbBkgWhowCfFibjbNljbrTaDGM+ZfLe/egQYv2J7CbCBRxN1GSzTjptl7inrXdkgv+3jUBoRghFv/vrXnx8huKTpvtqs7cLhnKyFxJj9MnyuZDr9zBe8iB67G1M40MzYIOuyC2pu1Og3qFIiniUrL33R6pk/GdRbRZFirSsFMBbg2MEAF/+Sathyha3NV/ZG8zEJK8MfHqFeVsCTwIRoOuvRRQhA8L3ek3X1Vuix5ZRFI4tVF3QF53ypC89RPZSpBwXkB8fvtcF4sLEiK9XLJTqDy2SKiN+JPTJlcXmTZQ9FPAJKxsaSKkvXvJ2F5RykYWmbkXtdwVWUfSO4QDITQtASuWJX9IfKv7QuZeewvEZ63uCVHJtxBdRVRCqQQTVEMFeusHAo1GcrTEMXm7de5kAYdo9kP6PuMJWzez1WMz5kDNmso5BvA2CJzBMA/jeFM6lmUn16DSwCuRgAp3UFAoATwsVN1c5E2OMaJD+XnXVLmH+H4RzpcULjYqjD1c3VVDaMIFqcJo2qPANDUOuSsxjiHxr76XstSpzXGAQJ6Sp0bVriJhAMga4/7Bb12KwhhJpuISYJv+XRPhYedZzBAiCzUAVqfS/dy2V55jWhFm16diJcSIRF5SYMIHZovKxvgjBUTL567f0RhuY838mQeTUlLsoWvBO+JWZMvo3Z+PKrk25bPtYU53DWEIZJKDqEROFE0QSZWVY/7JBmXwDdJQNlmGRclXyMi8Q+50unqKgEglf8Y8X9yLi5ZSM75pNNkqBVPQTgJITTFIeSCHFmqkmpzux6uqimiEX+hfj80RUtQVjNbzv2m3Uwa6amhI3c3xSzSA8+REVgrKZp/x27SXSdCzYag80qIRJj4IrLIzI5wetR9xMIs22312AyIElqgzoubt/q2hZAOzIEsdFfKDMd+am4iCYwRJY+hQWFNSpaXcyLF6ml94XBqSinlf6E/ENW3Nq3+8DVORjEpAm1BPJPi79ZSAFgpoGMDD4pAOk+YAQL6Hy5pMoFwCmn89eK 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)(7416014)(366016)(1800799024);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: FrSg8o0wYhe33+ke0jSNc92xCElBEbk+/zQsL/alBmbI1x4B3r21zTQgWWU6lvQ94T69MOkK/2jvxSK3+93z2rRL9Hi7M+5o3pMlAAV4laLbAygPR2oHenWmrfFN20mEzCbE9EEqF4FhL+uUquOZ5+pqs15oVBmfmw5T/gW8WKvnRW//WP+i9ukj5ao6Mf2EyA60gIFUbJ9H1zv0bZcs0jgqeSiXkMT/bFuO1F/JmDg0tSHVgeGT0ESx18o5fQ0xkVRP7n1D7E4wOi/Tm3TOa1kIbnyqseKekafmKyPCApnLp3G+bJy30G9OjZ6wLnYs/7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BASW1zZAj/hxjvPPUIN1tmtA0qv47ivxIduqUlODDThTcKgx9OBIRdDaB0zqdb2FSq/iUafPMs4HJaTVFJ8hFkddr8CeUvc+mZ7KEP1Oik0RO4SEQ2AJapL7UXJOpKbK9SazIjaEduzbc1Vy7vSxPsEVAk9ex9Augmtrz8ebH7RsB/t9fXmQCrBwJ+mdkWf2csYkqed/Bv3YBA5daeC X-OriginatorOrg: Nvidia.com X-MS-Exchange-CrossTenant-Network-Message-Id: 50bafa8e-1846-4aec-f716-08dd36724a04 X-MS-Exchange-CrossTenant-AuthSource: DS7PR12MB9473.namprd12.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 16 Jan 2025 21:11:05.3442 (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: zN8ny5HbwPfUARtXhYNe0dXwUZJzk7CO50hSaRwtsgT2xP6ApmN7BvhKo9LBZ/Yc X-MS-Exchange-Transport-CrossTenantHeadersStamped: LV8PR12MB9232 X-Rspam-User: X-Rspamd-Server: rspam09 X-Rspamd-Queue-Id: 7AF3880014 X-Stat-Signature: opemjo6hm1ybwnxepbyidomd7et7brdp X-HE-Tag: 1737062069-677777 X-HE-Meta: U2FsdGVkX1/VtQc5GDEuoKQmnqoPT/979GgRYWkEbm2gZQuzIQpF9BQ2smqioA4obyC9OgazzQAeUZKz+eB6VG/052w9aFCfE0+lfmeLU+KbaxFUbZ6kTjil/WFychKsd6IqIh5xeXLpvw2vtfZNaR5A6DsHUZShO2zA8Q1HjZiUs94vs0Ol3/4Eb2WR3DG8RFz8s/G/84+pfyDpnQ8+QXWF27cOqdAxUCkGY+A9mmHpKZo2CkyaD3oUBRHpifp6Mrk9UGlwaqVuoxvRUO8gLMbpCRSWS+7oZhvD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JyAFFYFUWanWihXo= 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: It splits page cache folios to orders from 0 to 8 at different in-folio offset. Signed-off-by: Zi Yan --- .../selftests/mm/split_huge_page_test.c | 34 +++++++++++++++---- 1 file changed, 27 insertions(+), 7 deletions(-) diff --git a/tools/testing/selftests/mm/split_huge_page_test.c b/tools/testing/selftests/mm/split_huge_page_test.c index 766c1f3a1d78..070813b9e04a 100644 --- a/tools/testing/selftests/mm/split_huge_page_test.c +++ b/tools/testing/selftests/mm/split_huge_page_test.c @@ -14,6 +14,7 @@ #include #include #include +#include #include #include #include @@ -474,7 +475,8 @@ int create_pagecache_thp_and_fd(const char *testfile, size_t fd_size, int *fd, return -1; } -void split_thp_in_pagecache_to_order(size_t fd_size, int order, const char *fs_loc) +void split_thp_in_pagecache_to_order_at(size_t fd_size, const char *fs_loc, + int order, int offset) { int fd; char *addr; @@ -492,7 +494,12 @@ void split_thp_in_pagecache_to_order(size_t fd_size, int order, const char *fs_l return; err = 0; - write_debugfs(PID_FMT, getpid(), (uint64_t)addr, (uint64_t)addr + fd_size, order); + if (offset == -1) + write_debugfs(PID_FMT, getpid(), (uint64_t)addr, + (uint64_t)addr + fd_size, order); + else + write_debugfs(PID_FMT, getpid(), (uint64_t)addr, + (uint64_t)addr + fd_size, order, offset); for (i = 0; i < fd_size; i++) if (*(addr + i) != (char)i) { @@ -511,9 +518,15 @@ void split_thp_in_pagecache_to_order(size_t fd_size, int order, const char *fs_l munmap(addr, fd_size); close(fd); unlink(testfile); - if (err) - ksft_exit_fail_msg("Split PMD-mapped pagecache folio to order %d failed\n", order); - ksft_test_result_pass("Split PMD-mapped pagecache folio to order %d passed\n", order); + if (offset == -1) { + if (err) + ksft_exit_fail_msg("Split PMD-mapped pagecache folio to order %d failed\n", order); + ksft_test_result_pass("Split PMD-mapped pagecache folio to order %d passed\n", order); + } else { + if (err) + ksft_exit_fail_msg("Split PMD-mapped pagecache folio to order %d at in-folio offset %d failed\n", order, offset); + ksft_test_result_pass("Split PMD-mapped pagecache folio to order %d at in-folio offset %d passed\n", order, offset); + } } int main(int argc, char **argv) @@ -524,6 +537,7 @@ int main(int argc, char **argv) char fs_loc_template[] = "/tmp/thp_fs_XXXXXX"; const char *fs_loc; bool created_tmp; + int offset; ksft_print_header(); @@ -535,7 +549,7 @@ int main(int argc, char **argv) if (argc > 1) optional_xfs_path = argv[1]; - ksft_set_plan(1+8+1+9+9); + ksft_set_plan(1+8+1+9+9+8*4+2); pagesize = getpagesize(); pageshift = ffs(pagesize) - 1; @@ -558,7 +572,13 @@ int main(int argc, char **argv) created_tmp = prepare_thp_fs(optional_xfs_path, fs_loc_template, &fs_loc); for (i = 8; i >= 0; i--) - split_thp_in_pagecache_to_order(fd_size, i, fs_loc); + split_thp_in_pagecache_to_order_at(fd_size, fs_loc, i, -1); + + for (i = 0; i < 9; i++) + for (offset = 0; + offset < pmd_pagesize / pagesize; + offset += MAX(pmd_pagesize / pagesize / 4, 1 << i)) + split_thp_in_pagecache_to_order_at(fd_size, fs_loc, i, offset); cleanup_thp_fs(fs_loc, created_tmp); ksft_finished();