From patchwork Fri Nov 1 15:03:56 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Zi Yan X-Patchwork-Id: 13859516 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 76270E6F069 for ; Fri, 1 Nov 2024 15:05:51 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 0D5436B009C; Fri, 1 Nov 2024 11:05:51 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 085CB6B009D; Fri, 1 Nov 2024 11:05:51 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id E19FF6B009E; Fri, 1 Nov 2024 11:05:50 -0400 (EDT) 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 C23246B009C for ; Fri, 1 Nov 2024 11:05:50 -0400 (EDT) Received: from smtpin12.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay08.hostedemail.com (Postfix) with ESMTP id 5EFEF14092E for ; Fri, 1 Nov 2024 15:05:50 +0000 (UTC) X-FDA: 82737850062.12.8FCA42C Received: from NAM10-DM6-obe.outbound.protection.outlook.com (mail-dm6nam10on2054.outbound.protection.outlook.com [40.107.93.54]) by imf13.hostedemail.com (Postfix) with ESMTP id 38E5C2003E for ; Fri, 1 Nov 2024 15:05:18 +0000 (UTC) Authentication-Results: imf13.hostedemail.com; dkim=pass header.d=Nvidia.com header.s=selector2 header.b=Dz1dhLtT; arc=pass ("microsoft.com:s=arcselector10001:i=1"); spf=pass (imf13.hostedemail.com: domain of ziy@nvidia.com designates 40.107.93.54 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=1730473415; 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=gBVeuolEa+O1KRTMeV6OyPyYPynOukZYFHHM5jLMtFU=; b=TG0a2BOHSZU9wzEvXffsBVkABKotoPwtPJQqZXGlOXG8k6lhKoE6hreh451hLTQcVIGKP6 Hv3sXjioPd9a766pMvNPXOFGW1xRr7LUE4xD12XUhmsJNaE5G85nbMKVociMo9GTTwHnWH Wf3/rt9j2YbqzvPvRcayDd5YuVA4vEw= ARC-Seal: i=2; s=arc-20220608; d=hostedemail.com; t=1730473415; a=rsa-sha256; cv=pass; b=KyArtYPuu4d95Midj8bisZ/ODmpRh9ImXsdz/SXVxpMyDJyRtQAgn9TlZHdkEQVFj9OYOt EmyyNSEmtz54Kryk3hxjOlSDgUtHVpe1pX5KQoCE6WUc1wDKFlI73IWmBXgzV4Udwlg+7W ZSWXxjMv996RX0HgPkrue9L6XU1EE3k= ARC-Authentication-Results: i=2; imf13.hostedemail.com; dkim=pass header.d=Nvidia.com header.s=selector2 header.b=Dz1dhLtT; arc=pass ("microsoft.com:s=arcselector10001:i=1"); spf=pass (imf13.hostedemail.com: domain of ziy@nvidia.com designates 40.107.93.54 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=tQnj7ZDygmp8h/mj30v6Qy/0m6tlq8r6v/4BZ8XjbbtAYKiAfGpKajX+wXRRqvnnKse4xdlZGnmyoYgHC9Wb8m2zsKKEqlU5HXq9Uy2E7uyntXpZwq0WLluuW22X55xImD5K6kb8Pr7RcQwq0cyFS8uxTCeaYB4CB5KcjGSwxWoOPpMCIg6cAMBAcbcyfsBGyGrUm2hhkDMQfa691KAUfO1FeuRhxU2526OD1HOmBk6H2oTM6QAXCO4exS6x3EhqunlsBDD2aJ9lo/0/UB4sMFr1/tPA7ab/h8nBA1bBYHwmuuX2Q/KKxtwVSS919Qcz18E93Fel5RlIKY+CJLiwdw== 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=gBVeuolEa+O1KRTMeV6OyPyYPynOukZYFHHM5jLMtFU=; b=StTe88+Mr2y/W0vPEVCmqgleHduGRs66ry10bcatjFC4leLamxrSforYxZlJ97Z7OS/G0picClmlhNHfHimibNI0nEJvJQyPTM0tv9S3GkJPI63Yl3ilpLIebsvbtDjxe9JVS6T2v7OFWyq96bvi+ycz+lkiLqV0CMX+oNFYqadT8zxk54pqjrF1PI8031eMnQKgJnq5BapdT8JgXgvRhPXNl7FkGxgqZOz1tTxsQEePrrtLuboC6t5OhJYoimlMP3KVmrsS82W8m2XUvCGujwRyt1FfH5obw2P+N/Kd04s4W9hhakDiv0Y9zq8dxu7qZTL/iJ+y4qhhx2SQ/Mg/nA== 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=gBVeuolEa+O1KRTMeV6OyPyYPynOukZYFHHM5jLMtFU=; b=Dz1dhLtTXAQTk/dmWI7mA5nFyXAxjI4Q1aouSFwJH4mjE8RjGdzyAPbYEbm91+6yPy7ag3rWpG+U1xegZY8VsKEB8PxXEUixV9IhtGVtDfPsbu/UAfLiIoFI17aMGawHORCURscXNlbW0gIM+j+EIr/Nh5P28f8W39a4827bcdmXJjS/FgjIfkaCghjecGnfs5fTtpa1S7ZNu3dXyemDxz7gadSQOVSUWQ3VSIx/qDz56btcO8VXrJckk6evXaKcPv8yAHBfsqXa42SG9H+eQLIDN6kN3i81Pbe3YlelIGRE/X9Q7xXpAGElMvAoDtXBN+xLYy4d7XH91cOYCeAvGQ== Received: from DS7PR12MB9473.namprd12.prod.outlook.com (2603:10b6:8:252::5) by CY5PR12MB6621.namprd12.prod.outlook.com (2603:10b6:930:43::15) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8114.20; Fri, 1 Nov 2024 15:04:15 +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.8114.015; Fri, 1 Nov 2024 15:04:15 +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 v2 5/6] mm/huge_memory: add folio_split() to debugfs testing interface. Date: Fri, 1 Nov 2024 11:03:56 -0400 Message-ID: <20241101150357.1752726-6-ziy@nvidia.com> X-Mailer: git-send-email 2.45.2 In-Reply-To: <20241101150357.1752726-1-ziy@nvidia.com> References: <20241101150357.1752726-1-ziy@nvidia.com> X-ClientProxiedBy: BN0PR04CA0135.namprd04.prod.outlook.com (2603:10b6:408:ed::20) To DS7PR12MB9473.namprd12.prod.outlook.com (2603:10b6:8:252::5) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: DS7PR12MB9473:EE_|CY5PR12MB6621:EE_ X-MS-Office365-Filtering-Correlation-Id: ce708f5e-7615-4d8c-a958-08dcfa86734f X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0;ARA:13230040|7416014|376014|366016|1800799024; X-Microsoft-Antispam-Message-Info: FoyIBZDO7BdEpcDp0twe0uAbBbGRkp874e0tWn9d93XX+qmURgiB9DNT6W60qduPSGb3lrhR+e8U9Cndr3tvpXwee1csazRWSYLhBQy8IUlAXCDYhbK9ohYOHeLim/m772OQ1GSQ3atN3gAQ/FvfC4SkL/FALoSMJ35fNH1OCgQXafpiPgL/0ZRcWLKrNwx9emfW2NWZ+L0I0cme/sf2mRlyOclHgXLfV2ZYWQ+B/dD8aARNDfL11ckK9WRoEH37UVvZAaQ0YJotK+d1O0jVPblYoXxHaPMcM/RGVv2N+pu7uiZ/0gO8PwzYqOC7PhZg2CNzZ1csfsVHDAH91BUxxizymnJ4f7ththtWEd3cHbs2u0rQ2b5lNI0qjXWCre9a4VoIbuxKtUGnBH/pwh8ksmNCmfITGHz+Y3MkEMFz7s3ALL1oMj5rL2nRnWayqJIwqFiDOzNXzh6JK9ZYG8WPNSKRp1r2mZoJ2hD/9Kl2G6fkPADqFdbpNsi9JqCDIFAaLOxAx/3UTPKBx/jwDooeJPKhns+CrExXXCnswXGnTHwfylYSO17ai5o1us5fRQD2F2qXmlTAWJXjWWQoPS0RL6GCeEgR2QSI7uj013Pb6n9IYHHKaRcW6tEtC5AT83ks/YX+s7gjRp8+Oen7+59U9Glt8744zuDtT527unnbm2KkIosjUgeOklPZrv64v4dhCaK1/VFYhek+8+GWz5MWi5jJ39z9iQLjjiwpaLeFoECWP0A1NwCRyu0rwAIBQYqoPendOJl/0prHS09AB4AslKhsyZA3l1fJ7wlIVi/+Gc9t1SlmEhWfSHAxTkCoBO6/JEAHPgLJKd72v7gPzvYSJnA7elGOBGuat5fMr2tptNDWfoukKA1tOkN6hUo56Gz4yocLFjwqTnDk8UEmZYNIlI+Tt/mwPQhR7Pv54XwC5rXfhWOXgTQx8Bgryg4Cg7LxsALmVUOmcbL7baBldKm18K511W3Rl2IQhU2NIGO8QosM7yncK1vMyeyhvTD1WErIHmak27Yc1GUZMtY1dut5QPMveoJ9N46rWH4idxqe1UjqvCIVNhCp1PAmzaauN5Rl3DUF6yiJ1r9rFMP1Nnpqyg+BIB9IxkLJIOr2svmXIaX5BaIwB3WjoUB0aSAxO4CovYvNPDG4VBURphCY0B/4P+nw0irhAGmsFFrfg/GEqHVCZQXf5JwzM2ShQz1zLNmVoHp8LwAHk6U0q96mtgT9wLiAZKgW1ji/nKkmSqAZfHJxgKpm+lz1nUFNXRKac/bH4RsuKcgNdkewPIqPMDxJWYPze9hRb5x8z6blvmJ4xZs2wjpZCMMZjywj9Oe6Dgc9 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)(7416014)(376014)(366016)(1800799024);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: e+vAXa4ZygGn6rI7M5GWRwVTi+CpxKcUInyzqpuWNy84isFGxmK1W7JYW3u5mEU46+Nd+JXRglpSyQzQz6ZN9Kgb/pkkwB7EZdRSrBJ2jiDsaWueSwAOuEJFLjLyYNGg/Kb7qMs/6AWxpGMRyIq7tMYxXMLLzPuCwA67zVnLbjfSEVnJtFDrlGj5Q1Oo0NmHeBXgZQOVOtUN/MJ86ww+Ue7VjYXFJEbSsnGHTFgvBw5VOVQfKkLdSMCd0ze2BfDGGQPU2vqKlCg3cR7dDSLa+sU6djvG9lxYVyeRlqw3NP6UOseXCndiv5Q37enkLL1wtMAG4x1Me30kqfq49xONjpOgKZj6LkCHY+alEkA6Yy8cbq3rGQb2sP6TpHHZdmChoF1mr2+UQHxMh5owEHMaxOj3k666BS0AAf3VNkI+0n4Pz8EFM0LRypnOSDY+0w3RIqJojwN34ySww4cl7ZCghK+pXlrvPHARLcfOdwa//5MiCG05+C8dKk39QHFu5grgT+pxE10BZq3ugVbr8v44Qv/wYO6iCuEnD0bEY9WJfvdEqf/gRQExxs/wcNlbFKetFpkx/+FiUpJzsn+zinh7wItJ6P9mYHIwLzHd/Dp8LBo2NU/yyW3OSkr4dD2e+JQE36jemQfpFV4etWrLbkEB/wjlJvvoSsj2MWQzu1w/f8nxtpNrNHSvXH3ilcJb+X9UWv+g17AuAGDVINiJyI6F2c3okRF/2uo3QASZ8Bo2DEZBc+KSyy4MWhJMLL99LqkCbuwZNYlJw8sXHEKb8+7rLcq/I7ycaExIMS/c+Xu45z228rF7rqMFkw9f9eXV4BexwKNCszUdaWcWZ6cSq4+uOOMxi/Y1O+oQ7qXczI5Y4GXHoB8bDyBBSPwBvyLrnqrt8EJNVv+Z8TcC4Bdrueo7XasM4/Wq+uG+DpQ2qYUp3zh/wjpPTs7YhtjcZNBEcUb6/NXVP760hoS/jlChUIby69vl+r0WuzVNJ8Uezul67duCQZvG1d35fVtoCxylES5R+zXjDETC+/Ketn4W692kWq1iPVu8E/4lFM8riZaGsruziw698Iar34Fl4P7KYoLjsbKk2xawR1WOuyCCDfZwq2f5lUW46fp66ezzdn9teH7nwRELccDz4I9LJhQFc7YFMcSuzuqBOBBO2fUy40huSD/Jr6ZYy9Wl2QURjFrpJtZp0aYYhYSQggvIh+Vz9W5VikBXdlsdB088JF5bZLGViAzcY7bRwOtDAw1mqoXOt9hGEmvsuKIEOQsJMdnjjAdBf7s1A498UhIiT1TnxW5mqtjwO8OYT62Ub6FNPw2LhQOW2MpwXlKHFazF35I1Jfm7nPMtJlginA7tEb0Rxs+36T+dbX23bSyH6Wewbyl5AnHC9EevgUKEf+IJLCVJXmPwAzkJ9orntRMUyK3Vv6vfUdmBg2OeT/b2LqwkUqIjP5ks6nixHW6KqdielAihtnaOUzOq+m3kZAHHitquvL8uDiSXGpudH9GG2cJnVCUcOsrnOjwjvJ6z/DluxssHOBlHt/Mc2JbODyATTgZFPB7909nwsjK7SqvUQQQc6wtvqKyXq85lZC/rMwXnyYCTwS3s X-OriginatorOrg: Nvidia.com X-MS-Exchange-CrossTenant-Network-Message-Id: ce708f5e-7615-4d8c-a958-08dcfa86734f X-MS-Exchange-CrossTenant-AuthSource: DS7PR12MB9473.namprd12.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 01 Nov 2024 15:04:14.8298 (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: ugqISsVnHsr9ItUxg7u1BX/sPEzvHbo3DjH/+B5fhpjUvLTCTY+C8XkOioM3pCQe X-MS-Exchange-Transport-CrossTenantHeadersStamped: CY5PR12MB6621 X-Rspam-User: X-Rspamd-Server: rspam12 X-Rspamd-Queue-Id: 38E5C2003E X-Stat-Signature: dd8qq9gekmaqh816qwbrtx7393d8uyy8 X-HE-Tag: 1730473518-99678 X-HE-Meta: U2FsdGVkX1/EZoJ6URwugP+v1u6b/NgHFADUW0EKTOD9TSxP74Wkpw4ISRWKNYTSse5bAxAMqUmS0zXynyN7bwbVCMAbzpQFth2Cdht089MjAmTtRyp18I8tRe8agQxE7v86L+wqRGKYByUYHnQPjUKWmmybnFD1krftlWbT799aAJ408WjM4oiOAt92IZ94fBDPe5AknJH7zOkufLu3hnfpHUCBCCnJgbxayJtXR91la5OHrfkPb9eXN+m9O9hwBFGGLNH+cSmOrgiZZZoDmbFf5cS86cwXo0lEFaz5w4psAWwRy8S8npFgrE/E9J7KGmPXL8UM+edBM2wfO2uehoR9kEEo4AZeXGU1MF1bCpOeGe1G7UQH5eKv8xMsDBB0QCAUrtE1MNidgL5z5Uhib4ejicADRuUoasaNx7xjm27BZYBuNYQXIeSe3zlgJVAX7LxOjgsFmePo2p6zuG1Lp5i2THsvPsq+/UCmgi8EMA4cXnlwJZuXYyPTRqUhuuXgnmP88s8i84/PNk6hcxecFR20pMSz++gQlM1qkT/xO7dIh1KLZduzVmcGfpopOcUZ1wgun+cbmfdhrBgwbCzq8zJYZil/ltrKhNf/xFcFkrU6qQgv3HXFsYg416djp8KidgwXjbCBXddml9oAH6tWWKzDIXUu+MWMHQBYFe4MGP/asAJ14NIy/cWdir4WX2lS6g8rxY7FTgU/MVo0DjhYlqg0y9yY43qZQv829jKg3HJFTjrYaYR/z7DZwsmRA70y9j3L29cK9BGqBx+hHI0Dw7XbOnOKPeTQBHatE7EEN/Oo3KmCeAJQ1U7UUQz4DFUbnHr2fJj6LtU0e63PQawKRIuwVH1UbOgeMQazRCWgMNdg471Z85/FF/Fmwx9m3yLO4bEMD9/+6pgF/20Dr4fvsKAmx0d9kowmOm0ce/C8CVaXxn21rF70WrVqvy5oP1wuKsg2bfj9zK4e9qRqrnp B0hYSLeu QRV5+e7lo4mXL9MtnT/EaN3/pLu/qX1mNmnOMMssHdQCLMTNreXWSFv9fS6VnsbpvsEexJ5uuuUlXq8yhxz1ptsXU56s9+sk6ciAX5z8juHGlJW3V5UR96thjjvefb8El0K8ZCkqCKH2+QGGD4W7az9ah8sLdYytL7S/lsy64HRgybO9ym0uqO7/bqZs9eSXs5KnBVoED0WJ/U4HGNr/4KxN8yK6seTcyANNwGzOOvv2FLl9wPk0pXk/nhrBnRHRmeyez7kU7Xjoce8Cd5jjmIcGrEVPzw4ZAlXB3Q7ul/bhl8mRtRs9ollJdEsTJyQTeh2FmFzATxrSFHyiGRqYeLonVYw== 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 f5094b677bb8..1a2619324736 100644 --- a/mm/huge_memory.c +++ b/mm/huge_memory.c @@ -4114,7 +4114,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; @@ -4198,8 +4199,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: @@ -4222,7 +4231,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; @@ -4271,8 +4281,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); @@ -4305,6 +4322,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) @@ -4333,29 +4351,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: