From patchwork Wed Jan 22 16:19:27 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Zi Yan X-Patchwork-Id: 13947492 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 58A36C02182 for ; Wed, 22 Jan 2025 16:21:08 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id EAE296B0085; Wed, 22 Jan 2025 11:21:07 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id E5D33280001; Wed, 22 Jan 2025 11:21:07 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id CD7A76B008A; Wed, 22 Jan 2025 11:21:07 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0014.hostedemail.com [216.40.44.14]) by kanga.kvack.org (Postfix) with ESMTP id AFE4D6B0085 for ; Wed, 22 Jan 2025 11:21:07 -0500 (EST) Received: from smtpin15.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay05.hostedemail.com (Postfix) with ESMTP id 2F975456C2 for ; Wed, 22 Jan 2025 16:21:07 +0000 (UTC) X-FDA: 83035602174.15.228A8CB Received: from NAM11-DM6-obe.outbound.protection.outlook.com (mail-dm6nam11on2071.outbound.protection.outlook.com [40.107.223.71]) by imf23.hostedemail.com (Postfix) with ESMTP id 7D10D14000A for ; Wed, 22 Jan 2025 16:21:03 +0000 (UTC) Authentication-Results: imf23.hostedemail.com; dkim=pass header.d=Nvidia.com header.s=selector2 header.b=guwStwzC; dmarc=pass (policy=reject) header.from=nvidia.com; spf=pass (imf23.hostedemail.com: domain of ziy@nvidia.com designates 40.107.223.71 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=1737562863; a=rsa-sha256; cv=pass; b=DmsxudMc0uI7LT02nDxO7r/ZVbkmpt0tmI9k7pZA4yWvtCBTscEGCKZtgseIqbs77u7ukx XpT+Jbe4KcL3MkNmuTjkTbi+kLkjP3UuDg/ot2DF5HDXLYqs8XC3G8rXN1ZzG0c/sQJmQI kzdcxO2XMKHSRBRwierUFubqx9AaGZg= ARC-Authentication-Results: i=2; imf23.hostedemail.com; dkim=pass header.d=Nvidia.com header.s=selector2 header.b=guwStwzC; dmarc=pass (policy=reject) header.from=nvidia.com; spf=pass (imf23.hostedemail.com: domain of ziy@nvidia.com designates 40.107.223.71 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=1737562863; 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=WmKa+b07ci/+SigIR8tnvRx0W0zt+6m9eZpwmObzkqI=; b=KTQyQ5tGlFZbdMCZwyE+SkTipxM8ehJ12K0LVXSFKjt3IEDH5JKhcFjiAgyIvPXjcT+N0t 6NqscaYLDHLr2ZOsnIuF4YZZcb0kwhUQr95sgJc9WtbeJIE6qS9tawW1dqP1gK32MKgJEt NkwJb108/R5u4Yfc+mM+jzy03iR/Sjs= ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=onJKG0xX9DvCLeM8697EEecPq9TfdPmh+TzvPRVHVu/tsqj9MnXxhd1gogPmNfab1U2qPmQD3iB+qjeockMdvEgx61vrm/I/XHsEJtXWz/dixcChdsStlQyAjFMMAe2AUqNJ223/WoJB71iWIZqJd+X/pIleE+ZozSELh6G7ZLrJ50a/sr0noza6CQQl4zhNDAoluZhiSO/AUV2jHz6TwVJB2Bu/kerqGHXcY3eM95DCBdlUe8tP7t+33lSpIhEAJWkrb3BUa/JfrunwsNBb1MmOZgpmCSD68ImUGJSuuFxErrXIvOkUOZdvk0bfloyI/y7+hDuXy9qFG7azJnoIOA== 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=WmKa+b07ci/+SigIR8tnvRx0W0zt+6m9eZpwmObzkqI=; b=mgD3pCKtQTscV4wVLJdop/TvjB2ZsraTuZd0uEsnXhqkrRO90GXx2T9c7xhwbtJiMZ9swQ7fdseNf/TiyrpDlLaGSIUPkfn5NJDohRVxkQIQuOAGLQCTyT0DrymNFai5E35F3G6iN0nlHSrhAqrL95OUxlJrow6V32wHoI8TPDYuvJ/ux1cn8XEzoaCW7EVo52Jua0GRHljgjbdAMK2NCL/EaboCV9nNqVzArsBuaomhRhaoONDvjridCqcxSR1kTglFfjGjv9ThmKLiePqPgqIWYWCGNtM8LEFH4KCENbF59j+jl8dC6sEiuWnX9aqksKbMWbyAJ+X4A6gYeLQXdw== 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=WmKa+b07ci/+SigIR8tnvRx0W0zt+6m9eZpwmObzkqI=; b=guwStwzC9q95C/j+/KgS7aCntgmCd/xDvaWI2PlYRdL2hbsxmIaPpGGJuSFIXH6jjCnk9YZUCSe67bw3RPe6Scb8qbpzPF0gFs6hWT+p2w+tBNwBwtcIm8aL4NnvQY4cOBPpzDQ6zUENdCLbd3QU5mpczFF8dp18slcY4w5j6rlrlBthKKqYVREzmBj0uU9YX7vyPYKD92DdK0JVis88d52pyKMCeXyVK6zVioHq4syWsuieuteWTKeMZ42MSpTonDfneQluKLxmXRasWhAwtj/PCS5GFL8SuvTeS0N49d29dZhN1P2ObjgRYdBTFqmrNuuOCwAAmzgkX8bDTkg5Aw== Received: from DS7PR12MB9473.namprd12.prod.outlook.com (2603:10b6:8:252::5) by DM3PR12MB9326.namprd12.prod.outlook.com (2603:10b6:0:3d::14) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8356.21; Wed, 22 Jan 2025 16:19:33 +0000 Received: from DS7PR12MB9473.namprd12.prod.outlook.com ([fe80::5189:ecec:d84a:133a]) by DS7PR12MB9473.namprd12.prod.outlook.com ([fe80::5189:ecec:d84a:133a%5]) with mapi id 15.20.8377.009; Wed, 22 Jan 2025 16:19:33 +0000 From: Zi Yan To: linux-mm@kvack.org, Andrew Morton , Baolin Wang , David Hildenbrand Cc: "Kirill A . Shutemov" , "Matthew Wilcox (Oracle)" , Ryan Roberts , Hugh Dickins , Yang Shi , Miaohe Lin , Kefeng Wang , Yu Zhao , John Hubbard , linux-kselftest@vger.kernel.org, linux-kernel@vger.kernel.org, Zi Yan Subject: [PATCH v2 2/3] mm/huge_memory: allow split shmem large folio to any lower order Date: Wed, 22 Jan 2025 11:19:27 -0500 Message-ID: <20250122161928.1240637-2-ziy@nvidia.com> X-Mailer: git-send-email 2.45.2 In-Reply-To: <20250122161928.1240637-1-ziy@nvidia.com> References: <20250122161928.1240637-1-ziy@nvidia.com> X-ClientProxiedBy: BN9PR03CA0156.namprd03.prod.outlook.com (2603:10b6:408:f4::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_|DM3PR12MB9326:EE_ X-MS-Office365-Filtering-Correlation-Id: 124543df-84af-4eb7-6a58-08dd3b008e55 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0;ARA:13230040|1800799024|366016|376014|7416014; X-Microsoft-Antispam-Message-Info: MRfyAof0fFKmukAnGp3jS7Wlt1n5pQ4Dk1ssQA7wDKLw6bV/hOedUT+Md2p3FfR4a3AbQHG0vsoHuGmRG+uREn8YKN2CVtiRdHfuskVhXHucoxnI0EDIe2jYLm3zQ+kO3NHluzKRfbtnkH8GErOqKJcI9MfnR9Opg17Vc60dKjsL/eMuGxR1vrsa/oxQuxhgahh8wYyllhzY65+Zbg1pqyRDvcOhNt+lZEM66DVnl3pbxk7nvrWYsQMgvcKBRkCKCr/9uVWk1CouowzPRI7Xms4iE8oFXka7lI4H0AzBjoRnJPDVij3PcpWdr6+q5n6XjTF7nzvQKyPY71uHyvgbyvZJwHJAXisFXVh0vA9Bx0Pr/47KLU/80tlGBxN62b9vUmVfh9vReeN8i+299AXdjjNWNlfp/Sn479ol+szm5AjbTjIRXcdCYIzGSl/R4elNyCp/40ZE9PinemZlB0QbHdUz64JsAiO6GL/tgdQ/urR+gYl/GtgvKrglKQtDzrrdXSBwL7AYCfyNeQSVFJP73dhifqTLrqBsuZJHFkSojZMoh/5hXR192a3V89EQ68djOmUEpcKHjrKlv1hcSfNek4aa3PACZg2Q99cq6rJkOwUKBchTRGEAe418JtLc1Pd/6n9enIKVPZl06CJcfr9xFqj6NjGw4Zuh1C/1bzrbamhufnOju0ycXgpruC95ctl3HfbWGRrxvNrFZLot2e99W99VN4UzAAKecL2Mwbb9hs1qJdKsYiFqMfsIaQ96cmuLH4inC5zB5b+zX5Vl1FguthHNaP2ckNYxZ0y9zuHuJD3WxT2ZoF97ph683UTbOjmFSptJE37IDU0yWPM82TDWJmM7kCSlkGbG+m174yPSkr6qQulSTK+3+SJI02axqRz/QfK+T8ylGNXZKF9twGsuflaQMFXws4c7MNv8CEhGkaOluf+cLBD6Me1Ul9imZhYA28ZSdfDtW579AW+HIo/WUxBcizpv1uiS1jcO52loppH7sVC5iI3vtIY8H9X8Y3DyZvDXUMm9Zv2TKMOnYWbRgtHD2CPJCUE0ycl8OnYOZdBHbDWfVNVNT4ikkp1s9XGNk9RNRCDPr44EjZxD11f8WAlu7LeZ3i/w+2FNAUSSpdTg2LnADFLvzQH/cIwMlpjCCot8cK+kZccQtA2DsWQsvktXAUTk3CmCJIkzkRcgOiF+clgpqzNbr4A5+8HgQywqhZmv06/W0+SUf3bMpQwqp7tqKLeqX4fryIThhfwlzyB9yfrznGkxich9DaXY9y6PWVIR39qyqGAxN+YmZnDHg8SCMxTJMuly6u37GdAB8dYmQK5kxtK/9Up2pigiPT4TZXEQ9jsG0plMk5esnQUz4nPlFVTs5YfywP2CYHqbXFJE+OoLJn9Iwt6XiIUaI8+9 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)(366016)(376014)(7416014);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: yGwt8P3SPagBa+X9Yn8jlRqnMs3fh0MY2YTRvF6eymJwHpplhWdu4wmbdNaWCO6gILsP6tc5lxzWFFOkasu8om3CQHad+dBBmh1Jeo5IU4dLqk/s1RTOD1nGZ0A2w4Bm+4rEFdDbUA5q3MfwMp0ADag9kW7pGEEMhKffZYI/XNhAQl8PQzz8cvOqYEa+3s2U69nrGLctlpBHYkBZU5YxD9bkqMFkjqgCnhZ6q3UEaplw1Yg/EesHQIZeI37+5YKmIlmDv2hZUaPMxCoX77UpXuQKz3Dw7SVWlNtBr6P2vj+ZEwXkY0y3mTbr4nV7V3HJzCpbw2hhWZSP+Upa7UXoMZwe+88mtzGbaj7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FglKfPh3Aw2NsB9FFFWMM0q7Ts/pA0HBMV6b/cHuKSC5eC2LRR/CVLKOCi6Sf9LBvNdVrfoB+3mB7p4ZjMJ25eZXoR8wfZH8V29uZCNVWO779UOA3LtCrq46BobVscLS5tjkUCmNgoMnoIpnShbarEXvLlBkILauqrYJ4kh X-OriginatorOrg: Nvidia.com X-MS-Exchange-CrossTenant-Network-Message-Id: 124543df-84af-4eb7-6a58-08dd3b008e55 X-MS-Exchange-CrossTenant-AuthSource: DS7PR12MB9473.namprd12.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 22 Jan 2025 16:19:33.1648 (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: Eo+2RBiz3nKOSHV35t1E8NP6hbbkHBi8+7pp+vbt9Eazc+b5fWupkg8P+EcoQ2Xh X-MS-Exchange-Transport-CrossTenantHeadersStamped: DM3PR12MB9326 X-Rspam-User: X-Rspamd-Queue-Id: 7D10D14000A X-Rspamd-Server: rspam10 X-Stat-Signature: 7zz5ydqfibmbudxrstz3om4mo54111mm X-HE-Tag: 1737562863-25786 X-HE-Meta: U2FsdGVkX19eRj+2VUSY0kddtYrJVOF8l13p1wBcNk/9bk7IgPjZD85KlbfJ6C/64z+AuISZYRAydhtPAqIk0vT/R5yoxIG3ZH68aoy+ie9jIeAqr0aQEINvFUrZr1SIAZk/y1c5muLlP6D9Q3uRTwUTmGTki8WeeGTVgEOwLz9xk4njiDFj9p0vMWbrydzIgt8r9oJ2P+/KUyO+TtUR2D6UAoppaPUfAFl9Iisi4UgXMYVvBA0gP6p+cgDoyjlDH6cSf2RATrMRlOHY7H4U8WigGzrljAM16T+T+GsZ41UeqmDcnAvyGwdz0IGXirII16+LJ9G2VtXxfKV+r2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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: Commit 4d684b5f92ba ("mm: shmem: add large folio support for tmpfs") has added large folio support to shmem. Remove the restriction in split_huge_page*(). Signed-off-by: Zi Yan Reviewed-by: Baolin Wang Reviewed-by: Yang Shi --- mm/huge_memory.c | 8 +------- 1 file changed, 1 insertion(+), 7 deletions(-) diff --git a/mm/huge_memory.c b/mm/huge_memory.c index 3d3ebdc002d5..deb4e72daeb9 100644 --- a/mm/huge_memory.c +++ b/mm/huge_memory.c @@ -3299,7 +3299,7 @@ static void __split_huge_page(struct page *page, struct list_head *list, /* Some pages can be beyond EOF: drop them from page cache */ if (tail->index >= end) { if (shmem_mapping(folio->mapping)) - nr_dropped++; + nr_dropped += new_nr; else if (folio_test_clear_dirty(tail)) folio_account_cleaned(tail, inode_to_wb(folio->mapping->host)); @@ -3465,12 +3465,6 @@ int split_huge_page_to_list_to_order(struct page *page, struct list_head *list, return -EINVAL; } } else if (new_order) { - /* Split shmem folio to non-zero order not supported */ - if (shmem_mapping(folio->mapping)) { - VM_WARN_ONCE(1, - "Cannot split shmem folio to non-0 order"); - return -EINVAL; - } /* * No split if the file system does not support large folio. * Note that we might still have THPs in such mappings due to