From patchwork Thu Nov 21 18:52:16 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Zi Yan X-Patchwork-Id: 13882301 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 140CAE64002 for ; Thu, 21 Nov 2024 18:54:54 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 9A0EC6B0093; Thu, 21 Nov 2024 13:54:53 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id 95A306B0095; Thu, 21 Nov 2024 13:54:53 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 77C416B0099; Thu, 21 Nov 2024 13:54:53 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0011.hostedemail.com [216.40.44.11]) by kanga.kvack.org (Postfix) with ESMTP id 59A1E6B0093 for ; Thu, 21 Nov 2024 13:54:53 -0500 (EST) Received: from smtpin26.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay10.hostedemail.com (Postfix) with ESMTP id 02661C14DF for ; Thu, 21 Nov 2024 18:54:51 +0000 (UTC) X-FDA: 82811002386.26.1820543 Received: from NAM11-CO1-obe.outbound.protection.outlook.com (mail-co1nam11on2085.outbound.protection.outlook.com [40.107.220.85]) by imf05.hostedemail.com (Postfix) with ESMTP id 91AC1100005 for ; Thu, 21 Nov 2024 18:53:08 +0000 (UTC) Authentication-Results: imf05.hostedemail.com; dkim=pass header.d=Nvidia.com header.s=selector2 header.b=RujNHeDS; arc=pass ("microsoft.com:s=arcselector10001:i=1"); spf=pass (imf05.hostedemail.com: domain of ziy@nvidia.com designates 40.107.220.85 as permitted sender) smtp.mailfrom=ziy@nvidia.com; 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=1732215137; 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=0HGXumwoHzdRg37AsHGRuosvSDyN0mCdwuWzz5mHCIU=; b=xbyoBXjb3kPH5VPDUPifBwJ4yKEf+zNj8sS15HHiSSgBBH+nopVm6vKq5iRQv+jgnyhX73 TE7HdMTpYN/CKQCp4uNdA876gsU6ugYXx2LQpLmeMzMMqBhjcva9wMyE2/6kdhGg7ehBdD NWGE0OFyUHEGAvfaRSKMi6uh15vSmX8= ARC-Seal: i=2; s=arc-20220608; d=hostedemail.com; t=1732215137; a=rsa-sha256; cv=pass; b=4E8MZB/Jb31nnTxBjgsrrz3Qy3y5wQ0Znd5PWajvy00WVDt1Ew14cVPCjXC891fB5+tXAF lfgl6O0+HMyJN8W4LM7ytLkmfme1w/TIXVmw0g1D/kRYSbDbp0JXxYAZFNJR3gUd9WIOph EYX8OGQLsV3h2g/jLc4nxEW5n2LT4Zs= ARC-Authentication-Results: i=2; imf05.hostedemail.com; dkim=pass header.d=Nvidia.com header.s=selector2 header.b=RujNHeDS; arc=pass ("microsoft.com:s=arcselector10001:i=1"); spf=pass (imf05.hostedemail.com: domain of ziy@nvidia.com designates 40.107.220.85 as permitted sender) smtp.mailfrom=ziy@nvidia.com; dmarc=pass (policy=reject) header.from=nvidia.com ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=PSPv+fs9iJ2unUBNZipOgTdN4vfGnXEKz6RKMmQTP9x5SZ0ff/R8OnuTQ6SLqRTP/qQAZQrynSQ4pQicumnyKGiNTP8E6+piyttsKLQhK0SY/ENbSM2oBGfEcIA0t+Z3inZj5nnEuh1ISS3uBg5AdbuwFTlfkwBXhwvTUvTGNP+gsFT7iPdKbER4DMA1Joozd6cP5zu3uM01QFJPBJ5+mwqDwv7sbl4GJeyZTI6RRM3u2s6ndtgxLRnhVBTuu3pEMbDqbqBLLhc/d0buKYMgm7zu2jR2etplT0Nya8/x+IQnsTEnKAFji8xMUzvZ1iFNcLErYrf/w1JPE55BX2KPCA== 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=0HGXumwoHzdRg37AsHGRuosvSDyN0mCdwuWzz5mHCIU=; b=iR6XT8D/0/YK6PwhWF62hFU/08T0oN9NeHLLMPNP1kXE7MDxFRDoQCdINtmmFajzfaDaa5Fuj8RkzW0pNbHIvwh2fedZXBaIdj1QFHiTxiVhFHkViKc0m4RpootfTzsBLabxBokD8dD4nWSP6Q7AcPA1rDYLleLTSP05QqZkOZtl/WCcfK8Na5p/4fMnTb5tYrbGLzlgXkOVRADn+f8NHgysAsQwj8omGV1w+regJkvKIidsPo+s2t8v1eo9KUHNcoqfQ/xCx1VLDdIb2QNvl+FTEYbFTDa23l3L+y/xspHOOxrVcbhOYy4EDbzz/VlvnKa3pPB0oyxCgct/8Jct8A== 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=0HGXumwoHzdRg37AsHGRuosvSDyN0mCdwuWzz5mHCIU=; b=RujNHeDSdEzoxgjtTvnBnE04SwFeh15hhhyZBKLYsMsqInU3UYEaTp3eIaDqYCHP1G8TsFdRUVXOcUBQziGOljICzEXPshqyRimt3Oc7pRwMJE6d32tT0jyIKm8FOgihsLSNXt9PSmcUsxtouV8J+mVjsQ9sU9rH9EIPdn3hMVTfckcSPOQSjjC6pA8eMFtDxMVpojkanYpjTp1NUolE3O6/Cbta0rKox5bxJpu4DohqY2V5cAqH3UQJrE0C+dtJKP3sOkmfMWvML399ykXD06+93shWZHgQ7sP3Iahm4v7slRThEmGZOJfirDbHZzhWDvGHPt5ONia60FyZddKeiQ== 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:37 +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:37 +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 5/9] mm/huge_memory: add folio_split() to debugfs testing interface. Date: Thu, 21 Nov 2024 13:52:16 -0500 Message-ID: <20241121185220.2271520-6-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: BL1PR13CA0234.namprd13.prod.outlook.com (2603:10b6:208:2bf::29) 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: c79adceb-998a-49b0-a5a1-08dd0a5dab0f 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: vXnuoGP1qawLOa608c40GaFw2jPpUhH4xvp/3WjxceXrk2vidFz8bX8IUJTnGggqrZAbeU5S0cpflC6ybnElUGzoeHFzG4KOPjRkAGyKIuwToLBvOBvh7Hd+t97Kj3vh/EAHh2kjzLQEHuz+W0TqZAMStYUgvIFG9J9x8N+gCHaBXy/RbeWLiZGiDAuHc6ayvaOcnFducgixf5GTipvdr2LHfL0zuy9+mdZBR5BO1IiVVepLI/BHHspcdoDBOeeWfSLS7q8BFPpH0w0zQA7xgGAl3Bbk1f+wwKpnBsOc+HnA2uh8hP4HZm163OTe/bXnNhbFXivH0MYc45tM2HehsKwappIUIEYzUxiTozIoxn/Xi1NJItg1sE5MivdQe1y+lGPWBPv6HHKeyOO+7MqYmvtafDqEzu/zEO3DUFXsLMWbK7JuhDGLxq4jSYqaLuGQBjIYDiYKtZy7t9uYfkLPmzGwOcugouUHW7Y8BsOonw9wSdsbcLVihC8sMuSiBb31AvKf4MpEj4xVj/ZI2sOgatIBbCKrLTWOkbEK9I+Y8z4nA0/CYWR59zqmb/B2m+8b/NmckcGocNNnlWQg8G2UJywSrvXkB3w2rqj9Urloptp9mXRCTZegBoCWyHQQjUQxP2RZTn2h/KSjOUQ2NxkmYrZJXE79a07OzNU9d1JZqC7asR5rJ6CovTDM/xdBl84nMZ6ZfJzxbQgOVsht42exE9bCPp4AprljRbJXEclTQDo6nlgF3K6Fykp2wWoKavX5FruAfadHhHxiunkB3Dbmx0hay0tcdbND1JGY1RO69hWWwWf3n98lN3GQ2au+AF6klMqxXBY1lOcGmStOH6tItyXB6RcJyVs54UrjZpeP5OhovrjFZk2OOoml/Jy0LBPclKmu4k2SMrSIAak1xV1YBMdPFv7QY9SMyqYBh+4rps5ExtAGxQYBa14X+nriuzysvhiRtREEBzlOTm9TNGOXLi+QRE6YxI8ZRTzd8/fZDZxXdwZd3JYLMAVQn8TayCct5hjItpFa/tlwAnUBfVaGcXFPFENttVN9ujI3t4Blgqa8y1EqtmmX0HkMlpxnYioXSJhn/kSthC2hILG0602svfW8uoPm+CK5FYGrQpgU4XsmzjH8JQlzmnPXkDzZv86wloUlHkkiu6uN73RMkt03fIc7wFVkg23dhljb1F7HWmAC4rEFYB0qfcIMehvWd+m1itsXqjcM14Lf7iNiwvCkde9Zlgf3coFWp0MFjD/3sO9h1VW1vVPCKS4XJwKECmpsRfaJy3KYEPnq5VYjqptt2gdFvRwSklikGedXhxiPsuGPfj9ZQo569ROXzQ3ja3rO 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: gHTBYSsW0QqfK5I4Nse5wRvUlbX500dPo/0Ua7K8ySIszewKNJl4Y76UUoR0M96anZ1vQ7aF5N/ajw6oUN2RoeCkqob0gyiV7xvWYZ+UfOL5P8wbpf4Q/vcEfEmhT8lvo2zzctHe23ZgBl20DJ125cDCe5l4XOf9Cr/NlPdXhPXiDL/DrGEg4L1KmUqx65Z9T2CLrxVPy+GygSH6AAs0ySfApkKecEjOFKxsA92cDPsD5IqZGo77K7WHcbqP9Lr63JOOsVIgctSBLwzlYkILYfB9adPdrd93G9V2/mTbip4Ljdboz0p6HWl70JAA1H9QpLfaZOKbceF7ai8JQd4eOMRlEH8kkoG/7EFhW+wLR3QE6k6QLICiDg+jixSmYqGBLW3qOc1f5YUQ2cOq+wPvKzW1/tkEYLtEC67Ii1XjJ8Uhcodn7CJpT+qgYMRsxWjqYUTLyUGmiudtCb94PGEiHIwQZLxFewUg2VbCRnBQMUHpxvtVYdQ6z9WEDUIqldqc2pNtimyaBhRCqOp/Vcp4W0iLf/ayTtH4slQgSTPCAfzzh7PkPa6caRhlgDE/e+1I8zE8nKS/K3xiVd3DilKTSen1oDfN6mV6Ngj6VbePp7EScD61YQd2eTVctaCIvaK5tCJoBmqloPaYUDVNjVV6CI+downl0hkkgB8V07vP2NmsqLbQnrZ+mRFXuqjpvfyohFArfqVXH0yL892qrnSNuNSAu8wYts11U7i6NXx+M1c8VxqUWK171NJR1uUdhxhM/6GuGV5+KqcrhRZ0ctBWzZ/mB1sYvKNvHu94zPqG1eENtvNOHWziE0iJOP5BSD8KNAsEmmxuN1Pb6L3oz8xmpvZUNITp3klKVTXgg0ZSkbnCR+ICho+e2y7PfhcnkjuQzXgaan7AJ/R1VpF6NduM42V7O2V0ZG68ZVHh2VNQ7+7LfxKJRh6Y9hptd9hyzLsplYXZbFQD73/L/7caiOULdIZzLUMdJfYwSivnYJ+qi17smrddXf41uc45lOKtSU7LcmC974Y5fJX01VEpVbikBTjkCPgKE00sjgMMZrlzCyUQkQ6vqq+X7fJ+TKvvXyTWKDMMUW2SlTZdxqUdV3XRq1UgVuc2KX7kEPWegK3fSdjbebo2qzsClbUlENKqyeO56JelnaDMpuML/oJDvYapVgkC9/4S4s0kGIsa1gVDevMHA7w3N2KethlHPwDpeB/cWtYYL5DhzDqJjdqi2MbacylA5HEJJBjN7zGCinjORgUwbar/71zQGMNVbJsCtGX4BlKkNwnxdOK65clN2K0J6zB5DztPtZBqJQxqWjLMytr5+5nNkIOckkR9t8d680rBHlj8cB/WvN6g9su5KQE163nTsCSF4+FypCXa6q85Whv6L/MbFU9xySud0N3Nqo+pIiDKA0/xuAWIcrJD/i8A74ivYrIeyAY++a85p9IjsfDEfGr8Dei11ZOqf0ZPe2fue9e4/o2AeJk+t31gpGv/hMlWMe22RSQ1XVUqQ/wldvlAysq1/vDDQ9vOmOypWzHxzmQsgNiPocCrJ/ImTHMV4lcEzbUERZSuYsrbK0KMDGs= X-OriginatorOrg: Nvidia.com X-MS-Exchange-CrossTenant-Network-Message-Id: c79adceb-998a-49b0-a5a1-08dd0a5dab0f 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:37.5676 (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: kOKdW++/Oivdqv9sxCtzhrb5sD1Z6Ax21qBrLEQhyb53LHoDT0sjAd0Yn6Ufksm6 X-MS-Exchange-Transport-CrossTenantHeadersStamped: MW6PR12MB8834 X-Rspam-User: X-Rspamd-Server: rspam12 X-Rspamd-Queue-Id: 91AC1100005 X-Stat-Signature: ope8wkbqpk9hdh8ah3ic57rceat3xozf X-HE-Tag: 1732215188-651385 X-HE-Meta: U2FsdGVkX1/RAsj6sHPyKH2t/j05BLM9DJ2ufOf7CTcx7CFwgGjOGFUS84Qj+JlrMViDxV7G9DCsfyUzmpRh/T34Zlcm0tzuxVernyhAxf0SLRQRYanaXNDEIuCTLX39tNTVXo9w+lihEckm7S43MY3QwWaTKm2B1SHDrDi12hOxjrVAxOg3qkroi4vfHaEChCA/54P8PftpgYlcdiCqEJ3ZOjxzsFhn5Iacf9/7m1hwlAvzVayKBx/1BzeDzIHEsvQOWGzkwv2BgUwyPie0bzn38ykYZEOTYOledhzKZ3AQtzF72RkBA9yMLXR+gqHeqzHFqXGJvf4b3ciKZ6yX2ri1lybUEAitUNA81Bd5oeK+LJUYhaNglxj17bZG5cp053RwH9SQFT/PEMFmQv4sVf8AhBTg+7jm23ut7YENO+WQ+peff8sWNfFZ+dKtN8Hcpg+RzT9eAgh66QjWz15c8Jd1Xrtd54HGZQp7N+5xSgg9pMuOC9WVh2Lh671b8ZGD8TPzMdudnnTW60kRMcrZv7ub17pYfUAs+r/PTb8QHqRiOTzZI6zdpVb+QLSlA4mKs2q4JAiRh9jzth8S7CmWpeWSb8F4pDBWsM1aVZuPhsy1HNkQXHNK76kLXC85lWHXP7TIltgJvfKI+r3zFOTMPrXc6aw6BAjJ+DoIhdw9QBvKyd7cwF/LDYh92LK7n+6msDEJ7UojjUJ6Vi7pu+UlQNWKtiQPPxhzDpaWekVgSeaG0Ja0ldPqWV2wcbJZtL4sBThRsLtFAaH9p9eDjY+ArPujcplDP9h089SntBElhyaR3bNVylhapEJBktrvmZzFtZSPnntkheUDC93h8yMI2RfENJqQERzZlAvZFDCsVLBLH8Twmy6EGJFogpM7guWbgYF3GYobeI/Mi68q1ZvDXFaPGTr14405yc4lLdDpW8vlt33/FrQEIObhd+UrQFPYjbKGCUUZWPiCGWsrmjS cQe96rno zV/RqZWjxn9K8qpkwS5jYPkaggwshDQsBHeYmu5ksC3szEZtO7i3360PC3S6LKN6LRnJD5A0RzNT5MNlc+MXRJWzFLmmLGElglqvfjEg2RVXTJeei+aHUpzk0gjvuTHIkXsX1ggTXeH8Uct1IWK5/EZzZQJAHaDPAVoiG1iLaJO5BLNfdPYCEwktaFbvP4xZc9IT2x2XgXD+Kyh65AKjb9RadAEsNYcQP6cXSD845n9U9oJjZaDw4dsvMEB6nT3/SFRfT9EGc4eX3BqfEZhkdCJ/4qcSLAFDQu6/YuyrEvhp0l7zIewok3+v+osmqa6iYG9MTRGko70AbQqzNPyQsC4DwkHM6pgC0l6KYAhxP0T/eK/OQhPB3c9qvJhKjCNK+2m7tRuDySrzoRSA= 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: This allows to test folio_split() by specifying an additional in folio page offset parameter to split_huge_page debugfs interface. Signed-off-by: Zi Yan --- mm/huge_memory.c | 46 ++++++++++++++++++++++++++++++++++------------ 1 file changed, 34 insertions(+), 12 deletions(-) diff --git a/mm/huge_memory.c b/mm/huge_memory.c index 9b3688870a16..9133a69c9245 100644 --- a/mm/huge_memory.c +++ b/mm/huge_memory.c @@ -4141,7 +4141,8 @@ static inline bool vma_not_suitable_for_thp_split(struct vm_area_struct *vma) } static int split_huge_pages_pid(int pid, unsigned long vaddr_start, - unsigned long vaddr_end, unsigned int new_order) + unsigned long vaddr_end, unsigned int new_order, + long in_folio_offset) { int ret = 0; struct task_struct *task; @@ -4225,8 +4226,16 @@ static int split_huge_pages_pid(int pid, unsigned long vaddr_start, if (!folio_test_anon(folio) && folio->mapping != mapping) goto unlock; - if (!split_folio_to_order(folio, target_order)) - split++; + if (in_folio_offset < 0 || + in_folio_offset >= folio_nr_pages(folio)) { + if (!split_folio_to_order(folio, target_order)) + split++; + } else { + struct page *split_at = folio_page(folio, + in_folio_offset); + if (!folio_split(folio, target_order, split_at, NULL)) + split++; + } unlock: @@ -4249,7 +4258,8 @@ static int split_huge_pages_pid(int pid, unsigned long vaddr_start, } static int split_huge_pages_in_file(const char *file_path, pgoff_t off_start, - pgoff_t off_end, unsigned int new_order) + pgoff_t off_end, unsigned int new_order, + long in_folio_offset) { struct filename *file; struct file *candidate; @@ -4298,8 +4308,15 @@ static int split_huge_pages_in_file(const char *file_path, pgoff_t off_start, if (folio->mapping != mapping) goto unlock; - if (!split_folio_to_order(folio, target_order)) - split++; + if (in_folio_offset < 0 || in_folio_offset >= nr_pages) { + if (!split_folio_to_order(folio, target_order)) + split++; + } else { + struct page *split_at = folio_page(folio, + in_folio_offset); + if (!folio_split(folio, target_order, split_at, NULL)) + split++; + } unlock: folio_unlock(folio); @@ -4332,6 +4349,7 @@ static ssize_t split_huge_pages_write(struct file *file, const char __user *buf, int pid; unsigned long vaddr_start, vaddr_end; unsigned int new_order = 0; + long in_folio_offset = -1; ret = mutex_lock_interruptible(&split_debug_mutex); if (ret) @@ -4360,29 +4378,33 @@ static ssize_t split_huge_pages_write(struct file *file, const char __user *buf, goto out; } - ret = sscanf(buf, "0x%lx,0x%lx,%d", &off_start, &off_end, &new_order); - if (ret != 2 && ret != 3) { + ret = sscanf(buf, "0x%lx,0x%lx,%d,%ld", &off_start, &off_end, + &new_order, &in_folio_offset); + if (ret != 2 && ret != 3 && ret != 4) { ret = -EINVAL; goto out; } - ret = split_huge_pages_in_file(file_path, off_start, off_end, new_order); + ret = split_huge_pages_in_file(file_path, off_start, off_end, + new_order, in_folio_offset); if (!ret) ret = input_len; goto out; } - ret = sscanf(input_buf, "%d,0x%lx,0x%lx,%d", &pid, &vaddr_start, &vaddr_end, &new_order); + ret = sscanf(input_buf, "%d,0x%lx,0x%lx,%d,%ld", &pid, &vaddr_start, + &vaddr_end, &new_order, &in_folio_offset); if (ret == 1 && pid == 1) { split_huge_pages_all(); ret = strlen(input_buf); goto out; - } else if (ret != 3 && ret != 4) { + } else if (ret != 3 && ret != 4 && ret != 5) { ret = -EINVAL; goto out; } - ret = split_huge_pages_pid(pid, vaddr_start, vaddr_end, new_order); + ret = split_huge_pages_pid(pid, vaddr_start, vaddr_end, new_order, + in_folio_offset); if (!ret) ret = strlen(input_buf); out: