From patchwork Mon Oct 28 18:09:31 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Zi Yan X-Patchwork-Id: 13853817 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 859D7D339AE for ; Mon, 28 Oct 2024 18:10:16 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 069C86B009A; Mon, 28 Oct 2024 14:10:16 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 0189F6B009C; Mon, 28 Oct 2024 14:10:15 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id DDF686B009D; Mon, 28 Oct 2024 14:10:15 -0400 (EDT) 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 B693E6B009A for ; Mon, 28 Oct 2024 14:10:15 -0400 (EDT) Received: from smtpin07.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay03.hostedemail.com (Postfix) with ESMTP id 5DBC7A0FAA for ; Mon, 28 Oct 2024 18:10:15 +0000 (UTC) X-FDA: 82723799214.07.AF1E961 Received: from NAM04-DM6-obe.outbound.protection.outlook.com (mail-dm6nam04on2089.outbound.protection.outlook.com [40.107.102.89]) by imf12.hostedemail.com (Postfix) with ESMTP id AE84C4002D for ; Mon, 28 Oct 2024 18:10:01 +0000 (UTC) Authentication-Results: imf12.hostedemail.com; dkim=pass header.d=Nvidia.com header.s=selector2 header.b=BxId04BJ; dmarc=pass (policy=reject) header.from=nvidia.com; spf=pass (imf12.hostedemail.com: domain of ziy@nvidia.com designates 40.107.102.89 as permitted sender) smtp.mailfrom=ziy@nvidia.com; arc=pass ("microsoft.com:s=arcselector10001:i=1") ARC-Seal: i=2; s=arc-20220608; d=hostedemail.com; t=1730138958; a=rsa-sha256; cv=pass; b=2m/vrtabE6gWzP0WKy0DrbV2g47vKzQjqL09rx39RtEbu6Ko3/fn1xv+gCO9A9n17IDiyQ d0QYaAT55XLKSXVAg7baqOkTD5/dPQpb4Q0khUDXlp+GJCqV9dqpYnxRm0E2xdL0mThT/P dN5LHnU2Jlz6pAkSgss3HFHB0Z2fsi4= ARC-Authentication-Results: i=2; imf12.hostedemail.com; dkim=pass header.d=Nvidia.com header.s=selector2 header.b=BxId04BJ; dmarc=pass (policy=reject) header.from=nvidia.com; spf=pass (imf12.hostedemail.com: domain of ziy@nvidia.com designates 40.107.102.89 as permitted sender) smtp.mailfrom=ziy@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=1730138958; 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=0R6/pYkkl5arlhdrpyVf+Fol2LxCndeTYdRd5JsWGm4=; b=DwCe0RRXrJQQGPPPgSypvtLPD//N8MvrVaYXQGoKhTJwPDIpEEI3G32MFAH392hYtiB6k8 1GDMvyYzbRxPW2B4JlRKEnd9liPjGqKLtbWNPwJk58IX8pH7Nhw6XgJ8uJH2VuTXRsyoWk sU1U9drthYparyUbDG3xg7t735yfUmw= ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=Fp7FUmdMsEZkttOfOuuTAYpndT9T6J5kwHEJ7FR4Net3/1/Gqt28jsr3GexpcBMik/1HWaCkTfhgbZFWY9rtm1wi4HMVHkvJApWh3JPsJKrlKwc8K6XAxAB1M/FiwNwTNLDXSxL69zVWc7skcZkyqUpQm5pguxy4sUrY0wkTAS4cJGI5wVRubwLDd7J8CxNBZNhRX92LhiU2TSfwVUjSTK4HwwUub8YzkxCRI+ekvqKvZZ6Yh4LzubYcSX+GH/bxRHVpGPQCANL/iYm7eRlUcP3Fq8bprhgWz2StRukVccn+ROn48rCHLcqVR4gTAllfuCrWa7BVdRHwWvp8n/sm0Q== 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=0R6/pYkkl5arlhdrpyVf+Fol2LxCndeTYdRd5JsWGm4=; b=Eh9nVFaiJov3g36UgWH8IMmOTUfQi1sR0hkGL8DjDQuYMDBNEFTZ7YbSoKCyGaRC7SzzmB2BnQNXovPgBlbhYZjm7URi26LOUelpy3ISA1YoBQe9pLSlo+vaoiCGEl29hxQ/IE6oquHRR3qIpZ5xVhiKEJ7+YaISoP37Iwyo88DrNh/s1XUNtOntAWmuD64W9ju211zu5TI2oblYnb1FbvrsVRAZcUVppwRLALgX1eOEmakFdjenJ9c0eT3hcM1475hTgwRaxC6twYtarfweQbNUUGoyhPe4asWpM7IsnYiDjsWK4QTW9Lw8Wkdp7fjHhtnjxpvHvxX3l20Q9327Gw== 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=0R6/pYkkl5arlhdrpyVf+Fol2LxCndeTYdRd5JsWGm4=; b=BxId04BJSWbKlXB4JTANnSbO9Jnhh4jPEzb4c1y24qB31y4PWIgxGmDDLp3/ETOf5jR7kRK7H09Lqte9NBnOAX432bL8dxV8jLYXlz+B9zdu1I36w9GtOaDtsUTRscHo1q2OBqmKoSenLtrZzjSdkRiw9XtBQkmLY9TunVBdpt5S+rlxLtMQFZn0s9DT/aKIaTLndi7JMzO0yYGBHt0oz2OBlgq5jSZCCsS2yNtRNtte5gI1S9LDHAb5UGhi9sYJ7KSKsjrTqWPgj2XfYcbI1RBWYX0U2ts/NqGQ/MkGI8yVa/N5namxN9KE2X5R1sCaxe+h2JUMeQQjtW+inhDBEQ== Received: from DS7PR12MB9473.namprd12.prod.outlook.com (2603:10b6:8:252::5) by CYYPR12MB8701.namprd12.prod.outlook.com (2603:10b6:930:bf::6) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8093.27; Mon, 28 Oct 2024 18:09:58 +0000 Received: from DS7PR12MB9473.namprd12.prod.outlook.com ([fe80::5189:ecec:d84a:133a]) by DS7PR12MB9473.namprd12.prod.outlook.com ([fe80::5189:ecec:d84a:133a%7]) with mapi id 15.20.8093.021; Mon, 28 Oct 2024 18:09:58 +0000 From: Zi Yan To: linux-mm@kvack.org, "Matthew Wilcox (Oracle)" Cc: Ryan Roberts , Hugh Dickins , "Kirill A . Shutemov" , David Hildenbrand , Yang Shi , Miaohe Lin , Kefeng Wang , Yu Zhao , John Hubbard , linux-kernel@vger.kernel.org, Zi Yan Subject: [PATCH v1 2/3] mm/huge_memory: add folio_split() to debugfs testing interface. Date: Mon, 28 Oct 2024 14:09:31 -0400 Message-ID: <20241028180932.1319265-3-ziy@nvidia.com> X-Mailer: git-send-email 2.45.2 In-Reply-To: <20241028180932.1319265-1-ziy@nvidia.com> References: <20241028180932.1319265-1-ziy@nvidia.com> X-ClientProxiedBy: IA1P220CA0004.NAMP220.PROD.OUTLOOK.COM (2603:10b6:208:461::10) To DS7PR12MB9473.namprd12.prod.outlook.com (2603:10b6:8:252::5) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: DS7PR12MB9473:EE_|CYYPR12MB8701:EE_ X-MS-Office365-Filtering-Correlation-Id: 2f48d684-8b3f-4ebb-7000-08dcf77bbbbc X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0;ARA:13230040|1800799024|376014|7416014|366016; X-Microsoft-Antispam-Message-Info: bZoEaxJv0FNq/X/1OeoQP22yEYtuFX3cmwcChyukL9dOZoU0qr4eW7oSGdX4Y/P01xALVPRd20sRc3AVhu3zrMSAbfxzDLUMr0GJ5dqZi+OzFD7f8pWmpAgeQ3Xe9SQQatvw03Uh6ogEEq91uYXWperxyJxLTMZ/ivncyS6AQ3F6kth69VaZ9rHOWV0rIBNOxNsXBW47LW2MANMOVIvfeP3TfyOzo/PL1EevxYIKmsuN6lAVfdS4X69tQ3Vy0APObMcipV/N7yD6jGSmFjRjqTTt+dtOmWg/CE/6p0RQFLvmrQis1oOMxOzV4+d0cL0a9NN+EKRASSrn3kHlSrZm4BljURzDQJj1fpEq35opylfhD7XhE3i+NAq7zSYpUtJRZWDqedbMXBS0khOkd3LDeNftFhlz4C8Tizv61DGfuGynZmVvQIkvSBT7KxuAe1AGz37hXpyjdmHBtnIIuwodA4dHpRCf/BY0Rd4FVtIpsUOXZkUgHglB3xVN4G7/OUBXr6krmZqDE5C8udrdHa1fZOMbpgf024vZbI+7FbDuhcMjrIaKJE0z4Iw2ZAwlmWRbIdKNYJWK0OwOqmheKHjWyf6IfhRbLXjB7CFmAeWsIsolWztmXMKDQIoVG/vedVFaevK3LUr/ROeD2Nh2W9y6qT5HODKT+Ae1GICYksrXZK2B1bNzTyU/sufV7np0yx4mwcaBcdDGs4KY3hvorO7YPht2AV+HdUfQUZEDP3CYLv1ywQ7VXuX/35Xbh4GGAhlGMDXelBMVQxC6C+rqYPGNA8O4rYPYLmkHkMboVAZ2LbSXgWi35UN/GtNUF9tysMXcq9EtsZsEIZi0UqhydkuWqPjIAQp4WlL0+B5iXjKgmCrw3XxMMO0Rc5c5jd2ACIT3AnkrIteIRKlIfkWYKEBV4O69tTSPkimj03ygnnO26Fn8WcAZR+i+vQqGZReMGbHTkv421Uns9zu02jb8xgQ3G+SZH/UbTxNU7eaPT7UWZLUYA2G87CCgfWkdl8qkqiCMxlXkGyosX1PH9/Nako9XUcQkbEQP+ORRhwN6ulUIp3idP35O1sPN7cnEf/alMhq/gpxmJTAQz5d6+zz9KM/hJP7fakj61BJRIdLiOMJmFiwcYxeIUCCw3Gc+HYNOyq1rzfvwkA+zB4+VXbkM0Ie0e1rurEharcrbW2i0VHM1NW94p+i01ubpDsgLzv+4eo15TQbuFcZ/Gn3oa0UH6nWBj/7ZHCmagrFc8pYvJQ/hgZTODTY7RXl8Jo6GCaWWTZE52QdzsmtrqpjjmotFaQ/aslpk71pdBe6jpGy313G3ae+WgLU8M+lynw66WotOvlgr 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)(1800799024)(376014)(7416014)(366016);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: Z5Pq/7WUO6mhj8zcfq0rXf5pScZ8ZCXFC3tVCOHlwVht/Ad0LfV3pLiAkuSL4k8+1tvWtLc8rwhxxUVIid6hGBdokOYIWmOroM2+t6xkGOmOBSZ79PrrRDoEGV/hjDAxuTEm7yWYhjOFyPrfeQQ3jl91lD5QHXyDyJKrlkQy706rxQrUIx9Lxtn6L9/8u0uuVB2tGEWPQ29rr0bEDbtBmHJrXZ23zocXuvOgvz8ZvlASr6mmzEn39BhWAk3ShAn27eM1hF+dE7ut2lY7IAlXb/AO1agNy+jIaJcfEvU2ZAr/5y1i62Q+ZMAQNJKtZfm251ToTI8sAmgyl+W/cXrCz8QmmgRL9nf6dwDshxF7i666k+7IdZvciAXq9VzE/ZS+1AUqaVlc9Tug7v67H6BQtzf/E+FOC2TQFlSr4GgR8/qSjvLHubp8GwRaZeEOcL8zMSG7hSO9NfoDx/p/amNTdWPGf3lA1EBqujDVTurUP0pWV5eSGOYrbM9B+J6axUB8THFUDsawJwtIhvAPDmGiO91Wm/UIYMXcEWL6kwXRtsz5HchHb+U/jHrlhJFLrzRRvBIePsHDLJs2K4HSAkEnoApg5Qdiv/0btpV9MHKVPlCQRi4oCQl12X5d4B/ectUeGPW3S41HaP5NYNLCzw0A7wuYF2aY3+C+EohZxbBTDoMvN9sAAAr9CALlQSRLqSS0GZj4ywklRfWc0P+brB76eYm5dz6QYAovkRVJK1jbM2fgc1lUk3cLdfOoXqxvQJlOpcXsLk/zHuudDwftsRWKg3bAbwdYt9TOc/ltU6YmPFAKc6fwvpCdkWHNAN1STiKRUiErmsubtJl2sgXfg+zzMSGvLcOQ+zA9fN5sh7KuLGQU26OUy05beEXHdqRyXGtk9snMkTTeh+hRF3XLcTD+blBidHjigXhF189UkGX0AsY0mFzAUZhOJ6+newpO7pEoTTxqHIspuxHqDCPZ7DKAZXNAlRPFoJq92psPYFshgwXKKlN3oIoTXquej8AbP3ELVuu4MxuFJpPN2DetyZYjqJoLjTPS4Y5Dd7QOziRieobsWCo+ceYN0FQwkrdHc9Y4Iq+IwMYQypQocBCiHDfccIXPQutx0oii1dzF/UZl8kiSPTlNE+tHQeop2AMQacw6xZfw4xZbWJE/MdU/Ushw9L/7lC6EwAXeVd2Q2ZVVNgYpBL8ZfTCoa3x7gxy4wEgouQ4h1HgmILxnPJLmWBeFPNk/dDkEWYewEB6No2A8SfBQmEESyIoOxoA9rgTDd53tbZzk7dW5P1iT7VlxAprqpo4TYkXloeWgHYVztvst1PcTGDAeDSPQEPgjOp1wkV2uL0kmOeevTzE0a2p6lgVKfOXtsQTPpk7OIYmKS5sdHKcv2N1T09qM0fG6hox2udMqwaBKk6W72TJj05TJuXtPG7ojM6BOMnTJzJStqM/Wdt1RFVULv7i2/qVr79uoOd+b923wUtT+ebUnJLb62vtpMn038pdpcE1ckkB2G4rnj23NWp1T8Z9l0JmjjoZXDVGYHNONA38zQ4GYaGqGfYBw+/biqowLK79FTMN+ppNDgYvcUJ3otbgndYwVNDJwhGWE X-OriginatorOrg: Nvidia.com X-MS-Exchange-CrossTenant-Network-Message-Id: 2f48d684-8b3f-4ebb-7000-08dcf77bbbbc X-MS-Exchange-CrossTenant-AuthSource: DS7PR12MB9473.namprd12.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 28 Oct 2024 18:09:58.3401 (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: 1Cmq1RcvaZLYlQIjz6XfL1lkQmNUw6CKQIQuFKNzuEDCJwryMJedH4oOBFSfvXTf X-MS-Exchange-Transport-CrossTenantHeadersStamped: CYYPR12MB8701 X-Rspam-User: X-Rspamd-Queue-Id: AE84C4002D X-Rspamd-Server: rspam01 X-Stat-Signature: r4affbo7j81pq43kz5q4yjpq6s7bysd8 X-HE-Tag: 1730139001-633588 X-HE-Meta: U2FsdGVkX19eBv1sP8ziIEiXHEreWK2I2ot3oQXx8u2YqBWgboOoMSHvZT5vN/mEpcVndj9w5gQY65gWqj2Spl+oCWgvpNlDXDlhcmoK16ASqR2WFV/K7LyHlT2ZVR/232v9unoWWNvA2W8d5xa3aa1JfD2Kd6XDU5UuBiN9CU6y6P65R8btQF5sfPT17WHURCOUKdyud3n/PX1/fOeoPHgMffwxAoscmutztauCY2Dwylh3WSrM0Dp5yPVlvChO2PBjUM3s9kcA1zxrSWb3kxYb0UOaZOUVyx7vH71dK48rgSSERWH5a9nOFjmFxenaWOWzLCIOAbXIRxX8joKuB7GXndTf+49HM4s/QUk/cvJFNYem8GAkGbUDCvVfRKmDqdA+aci8rIY7ra9VpaoAzkI6kxXJyIbheiz0qCeXT6GoWVRuACWGFm78tEFrnQhHm6LIIWkNOnNIdFXxkLAC0IJwpFPmMC29aapdkCKubzKs/OTIoPR1pV/OWZ3UNQtgAfT2H06WHlBSM6zcFvorOp1gxjs2OaafJmKrJZjaChmx05DtX2z5/w0v0l15/fgRNcg7Sm9D8IQ4UXCkNs3SV+UmYyXmOhpYERjRS3OKb3OMhr0XYys4R70S1uxVHh4/N8iXgHHvJjbBVkXpEhMmd74AIngCfqt+E9IhzwpJfCo4j5E+uEw80K62+iqryNvW1Na3euBW2tfMgYYaYhbriveC3BSIXdFv45n3qkPrDJZx2Oa5TslcgLPIblR1E/wiS6hxtfL44AbWsL/RgFK9vuNn7mJ87usoDCLiLGM8jJb8H2SU1+JYL1lcDc/bEUhDE+JIc1Oz2OPTMNdJXZ3QxFz9zv2Kc2VkMjqFGFQPoS4Uag2fxuqZeGDIEYcGw6hF2OzP3miI+AySjhbs3VNTMQ6aovn9jK43L/S4vgshGFapqnLmHoxSVMQxYZ8rzuySc06vDk7YkHnavwcJkZe MgU8RqE8 aAhzxzvVARffQIQm41tgaNvDbkEtTg+DRK+3Dpce300P8wgRW3gTNa2rJJg+jJ/PHFRo0VrIFrOIjiCIm3uGdH7lo4A81BDlJcaSBTvVijLw27/8MHKZs2LhMibu6Bf+xFyFYfRJtPoLg4UgIXPR6rVZWjuCj841Rm0U7d//dXlD+X+gMkRvVp3AiQTQe+z1hMpS86vjInlgkVBdAsANWNj7Z/ARxsmM9RpjiJTLJrF95Mwx47UG4W3KZ7/Hh/x59HqB3dWtzvlWZxAeMnpFFHGCKHOTiutwY09JpArMjsaPJ0AbbNVaydfspjKuUgcwpKy6Vm2H5qeV9ixQ6NbOn6FyjdA== 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 0224925e4c3c..4ccd23473e2b 100644 --- a/mm/huge_memory.c +++ b/mm/huge_memory.c @@ -4072,7 +4072,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; @@ -4156,8 +4157,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: @@ -4180,7 +4189,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; @@ -4229,8 +4239,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); @@ -4263,6 +4280,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) @@ -4291,29 +4309,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: