From patchwork Mon Oct 28 18:09:32 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Zi Yan X-Patchwork-Id: 13853818 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 1A5DFD339AF for ; Mon, 28 Oct 2024 18:11:31 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 96AF76B009D; Mon, 28 Oct 2024 14:11:30 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 91AC96B009E; Mon, 28 Oct 2024 14:11:30 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 795016B009F; Mon, 28 Oct 2024 14:11:30 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0016.hostedemail.com [216.40.44.16]) by kanga.kvack.org (Postfix) with ESMTP id 58E5E6B009D for ; Mon, 28 Oct 2024 14:11:30 -0400 (EDT) Received: from smtpin26.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay01.hostedemail.com (Postfix) with ESMTP id F3C441C63AF for ; Mon, 28 Oct 2024 18:11:29 +0000 (UTC) X-FDA: 82723802784.26.679FA76 Received: from NAM04-MW2-obe.outbound.protection.outlook.com (mail-mw2nam04on2054.outbound.protection.outlook.com [40.107.101.54]) by imf03.hostedemail.com (Postfix) with ESMTP id 30B8A20024 for ; Mon, 28 Oct 2024 18:11:16 +0000 (UTC) Authentication-Results: imf03.hostedemail.com; dkim=pass header.d=Nvidia.com header.s=selector2 header.b=UrKjU3ig; spf=pass (imf03.hostedemail.com: domain of ziy@nvidia.com designates 40.107.101.54 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=1730139007; a=rsa-sha256; cv=pass; b=T2p7JydLb7kmZCGuAuLHJoqwRKWZsKCSQDCM1ZNNqeIE4wLqfMlfubemCseuRPMUrqoxZo tUCT4kuP2QEPlxV2hJ5R3P+N+Wmf6S19QxzNVC6Xuc2t0HRwugsaHegjdnSuulC3XZ2ziO uECAWL/xyg2bu6i6hTjbtCXsLmaogh4= ARC-Authentication-Results: i=2; imf03.hostedemail.com; dkim=pass header.d=Nvidia.com header.s=selector2 header.b=UrKjU3ig; spf=pass (imf03.hostedemail.com: domain of ziy@nvidia.com designates 40.107.101.54 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=1730139007; 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=44WV/xweiC8aLwwZu1JatIBrE2jU2L2imh5jXosdR0E=; b=DYAHnbo+v0XRLR1z7HecGTSo1xsuXQleHAhZ7yikPY9qtez0djwmpw40LDwpH7EVbamx+X 8GXzcslSy0YjOwJRAYWkYLk27rAEdr+q7FrUCrL5FAHiMsxItacsfBi1lW/OSOh1xAAptX s3VDU3a8qG+d5fOp18L+2FKpPmM1Nqk= ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=DraQyIbp4VfaQChjd6a3QhCVl19RqCSf9DiOTtJ8R5vJNIhiKUZjtzZaveFfD6mvNnmfbUdMc4ei4rUqwJit4vfpVDIUptUyKi6nSNZG+cynacR3ipT1LLLp767ORv/8dEaGI0zv9S5Au0v4hXsYslE0yfKznALncq5F98A9B6KR3TUEOK9mWkBfQ1FylkiWU6sOGKeN+0FtaGVH7RAfJWeRKIotJSk/8agBZWawIhRWHid5W/D97JPD1mO5gRO9SyZi7+4iWOSNSjPn8OL0rcFO+dXVwtJxYJcvYVkcTXuNodqYWHcHO3KMBixLjhVy0v8XTsJRMv4O6VGvgsqGmA== 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=44WV/xweiC8aLwwZu1JatIBrE2jU2L2imh5jXosdR0E=; b=QAZXnYJEhs/uhP8zC/Dab4WcMrxS35Ex/W/omgcaqOTHZeLgbTcyV+1o7sjRIiXZsaB4q0lA3I+MXvNRJpu7LMdrBgxd+cPEr2o8u1EGzhaoyocyeoRZuhMO4ee3YHzK0PpyTGgifjQYJpBqYNPt2OvP6i6K0o4Xf1B6zdcbXvcB//uKWE+8bqU5fgh7d2LG+E7xiG4g/tNB3UXbKqTjGp7b0C2NY+gycGraCOwMGqgEkz4uMfnyz74E9GFafL5vNurVStcQCejbfTs2EWZXxJUNYnSOSQsIywoyhQRKYgzIFNc0dLUdFPdBTRXEM3ygc3bkLwosQIOKLpxYgRdHLw== 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=44WV/xweiC8aLwwZu1JatIBrE2jU2L2imh5jXosdR0E=; b=UrKjU3igim7wVVopbHW8+etym0z5/G++iW6TDh98Ktl6RW2fIgYY2HkB3oOIhQgFy80ujNM9CAXGb+MxNXGo5ImX1onyy2p17vJDfoveXyDHd8qlAp1wEav/ac7VJWWpBSD9NWbi6fLDkgVc27SRgBHWCGjRXKlmAr8oej9NSPzpF/76rGEV8b6zVdW22T3275aUb/uIGuGow0niG/k4uRvzKR8B5ps4iG6MN70rp6ev6OznqEwzlWH8OgTZJ2NVflMHeg4zYle9Pd1kNxPbp8kBZklugEUiylBfsgrSP8IbZJA6eB3ihDLis4guyHf+wiVyMnSWZuUbWeyNkMITKA== 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:10:03 +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:10:03 +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 3/3] mm/truncate: use folio_split() for truncate operation. Date: Mon, 28 Oct 2024 14:09:32 -0400 Message-ID: <20241028180932.1319265-4-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: IA1P220CA0006.NAMP220.PROD.OUTLOOK.COM (2603:10b6:208:461::11) 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: bccd475a-7f0b-465e-ea6b-08dcf77bbcc0 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: XtvgvwKZPv0BafahMUjbFYxPL+Z4mMGSZvrc3kq7zKHRBS9sXyLfpZV8vhn7+cwsA5ExdmrTwsJ+NV+k8EpWd2lG0mBJap6BuNqsUuk/HRtvste+VC9LBR3fPGwSPE6HwszZxBmhcgjL7z7Lpju4c+EgavqauT7yAM553Fgn21M8zaJCyYQ+51vKNXN6jGiWQn1CL8VVaBNLNJOjPnbywDtm138GPdiRe/elYcCP30ZT8/S1RWf8h4/4BaWOCaISvXBjS5dXNkICTdPLM42ml8BMBo1xvyzqiAaFAayVu54Lt7/eSweCYxs8w0n04i0WVkypxsXsEYD46AE81SeLa3ZnlyvySyEe+vUWwHos7OpTmRS0eGvjzV7LxV277g+H6mxYCmnK4NbNF2aZy+Y3t+4VZomja6jFCVnmSJ/TyDM5UqlzrjeQ2uHWtZWBhaHyX/2YuFzexVTAbeDtEEQ2TZoSJF7tB43qZku2MVhoRJbZUdG2qJIv8pa52F/lgtM36YWyuvnfqPsSGmyisJNIyRnLOmUftUGJmZ6iLS48+iapEtjhFLvqScFW/1J67PYM/9gXzbdAPqiU0Ks2to7bzSD3GtF7ON4Xq4gsZAG6md3t+w/REESJE/DP5+KxlT/+UpW68qXh7izMB5Z19gJ2Tp4zxdaVNVbph+L7Mscs07V9SbojMQ28D2Srr8DtXpJKZZnRgF8YlagTjA54+63SWjiz/owXzkKQYwJZq/HHPo4b1Midxpz7nDSV5UBzojNd0fJrgWfMeumOfI8s6oQG6zDPpmla5apOMaYPYPepkLyOJ16D3F1VNZy+ZxYzwEkSQ0nOZzazDWHBc33fz+OBg7wDvjXv+dPLssSQo2t5O8utcMoYvU1MMUnchuNIbnXmj2ZVXHUQy9YXuauDVR4UxcoJxz6gXB4zGYs0QIQp842u+DDDxyQC/rrhCvCJwUiEkXFXc9URjsMTV4kocPb6HSOulv8hm/a4kRE0C/sT+3d1qKI4QBcskHq+tLMzsTlc3Igz3ch1gDhshnLKioie2YvPlLtTNrsw745SeQj3BbRJ715DGFKtfMsCTdspLNGVLXPdtcbTVaGvZZS8C6Wt/9Kc4DAXLgH/Oo8hFhHNfT6lVsJUo3I5qWFRyZ+X2yZhG7dyx5I1vXiyFz/sHkWlKb7CS7+f9L8DYQaSGmXTuv69OvDSlgnIEYtcUqsHH3MJu6suCohxHOCiVAp8mglvyQPHj8N2+FD3MjRKd0lgMRF8TRaB3VN/roqs9IveFTrqcJFAZzt9YXciXFcSSy69cyuRAQZdB1vHCuFgT1TfH5A= 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: x6apZXhoITnycejoxt+iJvX45Oe3jwAxmGvHYEzXLzxWNwIVkIZMdIb09zJAv+DbNPFvPDQ3/VsIOQPElog6Xebkk7uPK/8+6bZOFMvahYgQLZZBwmGhQuZP4HAKHsG3rcb31Bgk7TrEDxy+V16x1eXWlyBTXs6xsG7mvdNwMoGHi2pKmjDVOc2EzXKFfZd1jmFCA+lg1Ri5CbD84bCSX04hr57GUUv9JGSSCwS6clhcn9M8dBvs//fjhigxYSwGyBcmaAOEmrTUULpUw9t8ykruuFB82EqmBcqOnmVAemSbrKUbWBi/E1IB2Qnfuz0Eo8QnAqCE7GIRsT8a2aJzx7YG/jAXR5ZiIEbBkOgUtnMa3BXLRs3TAmpY1Yn1jv2YsrCQEcDei2XaREnEJYf/VSUme5ZaqCOHjqYfnhlLBVKUNomx8or874aXcJxgHTu+rBiqVOgfpxP8nF7VSukJJtgCXHdDYXdZqyPVPg43jjDaesm1TeG8Hu0TZgPRPSuDaJfEa/6C+lU6ohPof4M5uSFH/1xZPGbyfae5cXFI/kDQfiUu+pFEkRMF1ifvr8pxk3cdVG72WVoefb+S3fFImD77ZcKlxSo8+NgulMpGp2kiCzus4+UXxMAH+uJrBq5UP14OgkrcByH8taOhL9cDbhZvqPNrMq+AE1HgNeUT+qPp1F6YIewtfJX55IcNIHqZJksO6R14f0TcX/g/KxoaXr/gdeTGVzFeBNsYI7qUyERP/DuFP2LfYCvukFnWAcRdgB7HOapnMI5eOQnFLOIreE+KPwqud0PmbFC0fe+KWy0lJ/nf2WhdRrp9Da2nwv3EXGaEQYRa99gOWgT0tbvdaUejzT1o4YBTGULKIWfQrnVqduXeD921K69JBK9t1jHwZgZ3Vl4PZP2223xN/kCRS2uvMD0FwP9oThV3KNEnNIwzC3KBwb4Rl/bFhr8ebKfnkEEItNbVajGvuKtRKzyeaCCJHL2D/aeq6JEwVNJXKssxcMVTXHbVOqubXUyeIvHogOpXaK0VmppL2VwtZ3Q3IZzRifTwz3A852e5nx2npKF7S37PhiC9c2q9jCMu1NNQcj37SSlZUIPfzS88yjxnLoAvYw28W17sCzxijCb9AGwYhzS6tnNWTK00IwQJ+SoPSJhMsl0vuV1wpZgT+6dcE3j3A6my02dZrbK8Wn+TMGk5lvtPUFFg0dejEDkCqOQzv7IRp7R0JlUMuhBDilRt5GA1ZUFVHCSdIk0PYJhXCsv4sY4boBn4Hz3rGDEFgsewuA8hiQq7r4vmN3fPsbVhP8owM6u+i2EqYfsATEQx2Y2ZGfU8Evz1d9Vmk+CAxnpKghF9L3dEJCJnXq+KW5EExTfD6WBP4zv59R7uX9v3ci49iik28b4opuIRjKtpDFtD0ar0sjzdrTwBsdqK7EeImJb4itj672smtXWRf2RTDDq+3kizna+CmQnlRUJI9hqMPkG0m6RQcRPKSv7otUuPjA6P+ua5Kv4rIZ7Y5hXePwbKFP6AKbhaU0lH5kP4paKrLmQNWc6jPDcAfHXFlK9pBhINVQrTCbfsok6XiCreWU4lyBDpCls+kWtBqjDudY0m X-OriginatorOrg: Nvidia.com X-MS-Exchange-CrossTenant-Network-Message-Id: bccd475a-7f0b-465e-ea6b-08dcf77bbcc0 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:10:00.1139 (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: AYhXKAw8KyN+2vJFw7IPWUMBDhun2nM009PBW7V4WIOKa0wBXPDzSd82RzLt7lgE X-MS-Exchange-Transport-CrossTenantHeadersStamped: CYYPR12MB8701 X-Stat-Signature: 8jk6xuftki6mccrwms583myd7rt98w9s X-Rspamd-Queue-Id: 30B8A20024 X-Rspam-User: X-Rspamd-Server: rspam10 X-HE-Tag: 1730139076-453773 X-HE-Meta: U2FsdGVkX19pYkHHV8mlcQPrJVgX+my1u+qPOL5CAzr0Iob2WHEruXctyP7YOpiLVwVkQQq9TFCiinWxyn2D7IxN/umYmwVJ7cUE9LLpqVtV3qy6yEcl4tWLd4EDWubAV742v9BzFN6hYD8c1UN6A+bFVJaQX7UnHqlTpt81hNlzm58OroquFRC5XulZLX1FB64gt46RXfk0X4cLEPDJwEpQk5dh4H4+NIwu7GuAsLfVdSLWfCGuvm35rIhuMDo8nXjGSlH133On38HLLZwCcspXo4GU1nT7ZH8pYeJeEQvH29P7QNncUe2PrpRCw7KW8BAyrnhhypVQW4oEJjIlRuLtvjPPV5r5GUlCma7zaGPQBXuCkyDkyb/HlDvLu61LuR6at1eINxxiDb6WhiSID0FXW3meE5fhZD5DRfjLgId4UyKwJvx1gDkjwYAvWTsPVrVUN2J7onVJJmA63rjWII4+bJelttxU3NH7bHT8UPa540WOa/OJHTbZ0EgYfS+CvPNyPISInxbN5pNCg7mklqqBt2q+21MOrUalQXUVEXCDEoCnlw390DkMPetXTbVs8DaycS32GnM3a/NGDIcj+99KvdX6TvlSnW1MQZGADeWuJ3WXgPRQNVWALhtYEY8M5LyzVy4/u0JSvb3s4mPlwrS65KAw7fjLbzRdmT+n9qDu25xHyBg96ftzojpC7mTqO+efRShs686LA5AJqgdtZTa1uda8PFghZtqV4VQiOFy4sdG75T0sTsrm18xUaSYLTzRPymXl/pHi6e52iGht+6RKjugjfWtX+4T8mMYHYYtYcqXZxX9qcJkE/4saHuji3qk0MPuzD4E6d98uxLyS444ymX0nFu9O/CbGlodf2RcqMorm0kQftutaaSZfJwx2hTiakrEtuQT0MTPIVGTwUR3BmsxSLdUgpj7IPsbwIgNMiNTgJvH914uT/kQPn3ZzEdTuc5CxXphVlya3FBz yqDCKQJD URxwfmaV4frcKLGX6/39cBHMxRVC+uoBvfR9DREJGzm8RFigMHSXZME5BTlFUIb0NndM7XlYrL6Us2WEzyRCDQNXYHUjkgRlpHjsTbOv+fQe3jHYtdlrnYILhCOJY5MlpWUcRyL83Wx3TQFjJwPA82C7sjBnWnYS2y31XGJJSn2W13pM8mWlibHKej4guJcr304DJs9q/VaWirayt4lN4vUHVcDJ6eZbmIgJmhWTGnvtHlKqEbCCMskHYwpVRkeke2KIwAvCD+szufqJtbF32Z06tZfIPkGejRBfDVVmMwSgR3a1M2YwQewf23Ie1o2IaX1ZtMx1S1GyDt/C+nJ+w0X3+ZA== 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: Instead of splitting the large folio uniformly during truncation, use buddy allocator like split at the start of truncation range to minimize the number of resulting folios. For example, to truncate a order-4 folio [0, 1, 2, 3, 4, 5, ..., 15] between [3, 10] (inclusive), folio_split() splits the folio to [0,1], [2], [3], [4..7], [8..15] and [3], [4..7] can be dropped and [8..15] is kept with zeros in [8..10]. It is possible to further do a folio_split() at 10, so more resulting folios can be dropped. But it is left as future possible optimization if needed. Another possible optimization is to make folio_split() to split a folio based on a given range, like [3..10] above. But that complicates folio_split(), so it will investigated when necessary. Signed-off-by: Zi Yan --- include/linux/huge_mm.h | 12 ++++++++++++ mm/huge_memory.c | 2 +- mm/truncate.c | 5 ++++- 3 files changed, 17 insertions(+), 2 deletions(-) diff --git a/include/linux/huge_mm.h b/include/linux/huge_mm.h index b94c2e8ee918..8048500e7bc2 100644 --- a/include/linux/huge_mm.h +++ b/include/linux/huge_mm.h @@ -339,6 +339,18 @@ int split_huge_page_to_list_to_order(struct page *page, struct list_head *list, unsigned int new_order); int min_order_for_split(struct folio *folio); int split_folio_to_list(struct folio *folio, struct list_head *list); +int folio_split(struct folio *folio, unsigned int new_order, struct page *page, + struct list_head *list); +static inline int split_folio_at(struct folio *folio, struct page *page, + struct list_head *list) +{ + int ret = min_order_for_split(folio); + + if (ret < 0) + return ret; + + return folio_split(folio, ret, page, list); +} static inline int split_huge_page(struct page *page) { struct folio *folio = page_folio(page); diff --git a/mm/huge_memory.c b/mm/huge_memory.c index 4ccd23473e2b..a688b73fa793 100644 --- a/mm/huge_memory.c +++ b/mm/huge_memory.c @@ -3803,7 +3803,7 @@ int split_folio_to_list(struct folio *folio, struct list_head *list) * * After split, folio is left locked for caller. */ -static int folio_split(struct folio *folio, unsigned int new_order, +int folio_split(struct folio *folio, unsigned int new_order, struct page *page, struct list_head *list) { return __folio_split(folio, new_order, page, list, false); diff --git a/mm/truncate.c b/mm/truncate.c index e5151703ba04..dbd81c21b460 100644 --- a/mm/truncate.c +++ b/mm/truncate.c @@ -179,6 +179,7 @@ bool truncate_inode_partial_folio(struct folio *folio, loff_t start, loff_t end) { loff_t pos = folio_pos(folio); unsigned int offset, length; + long in_folio_offset; if (pos < start) offset = start - pos; @@ -208,7 +209,9 @@ bool truncate_inode_partial_folio(struct folio *folio, loff_t start, loff_t end) folio_invalidate(folio, offset, length); if (!folio_test_large(folio)) return true; - if (split_folio(folio) == 0) + + in_folio_offset = PAGE_ALIGN_DOWN(offset) / PAGE_SIZE; + if (split_folio_at(folio, folio_page(folio, in_folio_offset), NULL) == 0) return true; if (folio_test_dirty(folio)) return false;