From patchwork Mon Jan 6 16:55:06 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Zi Yan X-Patchwork-Id: 13927680 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 B9EB1E77198 for ; Mon, 6 Jan 2025 16:55:47 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 47B1C6B0092; Mon, 6 Jan 2025 11:55:47 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id 42AA46B0095; Mon, 6 Jan 2025 11:55:47 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 27DBD6B0096; Mon, 6 Jan 2025 11:55:47 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0012.hostedemail.com [216.40.44.12]) by kanga.kvack.org (Postfix) with ESMTP id 03F346B0092 for ; Mon, 6 Jan 2025 11:55:46 -0500 (EST) Received: from smtpin01.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay08.hostedemail.com (Postfix) with ESMTP id 6B9E2140109 for ; Mon, 6 Jan 2025 16:55:46 +0000 (UTC) X-FDA: 82977628692.01.0D810D6 Received: from NAM02-BN1-obe.outbound.protection.outlook.com (mail-bn1nam02on2058.outbound.protection.outlook.com [40.107.212.58]) by imf16.hostedemail.com (Postfix) with ESMTP id 4E1DF180009 for ; Mon, 6 Jan 2025 16:55:43 +0000 (UTC) Authentication-Results: imf16.hostedemail.com; dkim=pass header.d=Nvidia.com header.s=selector2 header.b=LkzpCvPV; arc=pass ("microsoft.com:s=arcselector10001:i=1"); spf=pass (imf16.hostedemail.com: domain of ziy@nvidia.com designates 40.107.212.58 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=1736182543; 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=PXV4rWuZUVCz/nbn6ZSb49FvvwPgwyCkQ5fEHV4GAiU=; b=u8cHsoHE/1QidK1hraiQkmM1GwqzckbfeIgt1RUKKHBd6b0CwzbSiJBBicNCh1E33KTgtQ oqCJU5WeKSOttr6FhuPg4mFi7+au3VLsywrUGiyOzhy1n5fmSrZkr/lgu5hg3nLf+KgTlv eIp0/Hfbx42lLJGj36SJMq5oKyiEZoQ= ARC-Seal: i=2; s=arc-20220608; d=hostedemail.com; t=1736182543; a=rsa-sha256; cv=pass; b=WK4/cb+39ikREHlLPhYqRck3VvMzmUu+cqDvyLBS5Fs1vxCIOcF5zvVIoA07YgbQF3dYSe kwS9v3DXgms0OfnijDIebR5T737+L3xt4wK8/5KiCyY7mCfPr8unjO7ENVyYtTF9AWYSgH /VcO32370OZhWTwwRxOunWA011NHHyk= ARC-Authentication-Results: i=2; imf16.hostedemail.com; dkim=pass header.d=Nvidia.com header.s=selector2 header.b=LkzpCvPV; arc=pass ("microsoft.com:s=arcselector10001:i=1"); spf=pass (imf16.hostedemail.com: domain of ziy@nvidia.com designates 40.107.212.58 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=qlr+8MkFy8EWSusaXJu7VAe/MRicP4ZZaAW42N6kM9MX9MNIeOg97dzBL0mGRUBLc7Z62J5RQZ/dxmQH1bqIawrD9oJ/3C3YdwL3jsUOLAM6jqOHrcLnHg1//nXoJglb85LotvZBpmLCtxFYD6ObHJpBDM/NF55NbAbRNAe38mA0Ktrr7c6EG23tuTzFBmbrq8Mf+4k+VSKmUf33rbAbdaldKF3cId/umpxkmWUI73F/LvrTCIZo4H5uBF2aNX+NbfvudBrLrORp3E7ILRcLtb32hJT5o411DMqLTvYu9xJ1SIaF/j1kUbQLDIRO2AAGGsNaUpw94x+zhH1WCZU6BQ== 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=PXV4rWuZUVCz/nbn6ZSb49FvvwPgwyCkQ5fEHV4GAiU=; b=fLM4+aRTVJrs/TZNDoXCQlzSNLPDdOs3O0KXxbS0UZ8ihRIslG83gBvBInMZO8IjMM7+7LCSK7QohLZyOXYsvO8sZSe4N9IcVGhma8K428hnXrVobAYU5ZfAYzGbojX9oMN9SXDk97V4IPQNczO6FSOFIRZNxz7u/4fG9i8EmdvW1nTanD8NO0I85ehZzWf8mLL55S61NFW2/sbU2GbbycmVf4IuxF+Kl94UJTh/CiaMbv7DmYcFajQ9PPXEtsyOGD3P7xduWUNKYnoXtlGp3amMcibTHMOYZJ7NSDCYvr/KaybCTxKGpdMV5OP2eUIOHGdEpNBddqT7f8MC4t4gtw== 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=PXV4rWuZUVCz/nbn6ZSb49FvvwPgwyCkQ5fEHV4GAiU=; b=LkzpCvPVraKAaqDMcmKySDu5RaRykJe6W48wFnpOxkrIMsowTeID6+diV/VhjTEIr1iKfBeSN/bQcuecWsu7ouePi8Bxi8xMOlBKtvdJgg3RPoJR78sXN3Cej+lhtny5yoG/C+D9ahQjR2foaqesfzgn65lOFB+NCpaS7M35CLi6NjE7MpZ2O8dus7Xe8gkXxDlZi+91qUaU4NiwRfjP6lowXDkpVjLlPN8DGxFcMtg74upRTk0kHe+H2+wopQxEAv07SgoE1V9/8PaOdzyzpKKXuDrSZkYAfMbvcZByjBycTo1Pr2DAsQWcvhjPLaHRpTYTPQi85mizLWz6pW713A== Received: from DS7PR12MB9473.namprd12.prod.outlook.com (2603:10b6:8:252::5) by PH7PR12MB6634.namprd12.prod.outlook.com (2603:10b6:510:211::22) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8314.17; Mon, 6 Jan 2025 16:55:25 +0000 Received: from DS7PR12MB9473.namprd12.prod.outlook.com ([fe80::5189:ecec:d84a:133a]) by DS7PR12MB9473.namprd12.prod.outlook.com ([fe80::5189:ecec:d84a:133a%3]) with mapi id 15.20.8314.018; Mon, 6 Jan 2025 16:55:25 +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 v4 03/10] mm/huge_memory: allow split shmem large folio to any order Date: Mon, 6 Jan 2025 11:55:06 -0500 Message-ID: <20250106165513.104899-4-ziy@nvidia.com> X-Mailer: git-send-email 2.45.2 In-Reply-To: <20250106165513.104899-1-ziy@nvidia.com> References: <20250106165513.104899-1-ziy@nvidia.com> X-ClientProxiedBy: BL1PR13CA0242.namprd13.prod.outlook.com (2603:10b6:208:2ba::7) To DS7PR12MB9473.namprd12.prod.outlook.com (2603:10b6:8:252::5) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: DS7PR12MB9473:EE_|PH7PR12MB6634:EE_ X-MS-Office365-Filtering-Correlation-Id: f19af93e-e4d3-4460-4c29-08dd2e72ea4e X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0;ARA:13230040|366016|7416014|376014|1800799024; X-Microsoft-Antispam-Message-Info: Aqawqay0sgFbTtFX+apoyzuGD+JMa6IRtKpuFwY9hXlG6IvVkLp8LHBKwiAkBCyjcoEfUfzLZ5rAtvRNEKvI8E4+pxW4PIe12hrh8YS+5FKWUD/5s3Ltf6V5Z+I0U82YrFzKXNsZL8StEY3IXas29Zj1fhs1efEjQRHfGRh3LeKvty/lhq3uUZEYm/sThtjVIjZce2dx/JECOt2fT0S1SquRmUZVvnaVN0XjJ11YXJOI9G/O4DhTR5AgCLxVUPsEF51mOFUh4DPKv+i8RLaf4capM+W5PGgkXQUVAXnB/8bbwL3A63W6F8hNQmjlx5OR9LBB+zZoWb6c5Q9kB3RWQTQT7TDmsK9jGMwkTfAKDiA9yJBRJ/D/z8DDKSKKzugj9wcCbosmK2ZoU1FlkCwjoLYan970xgTtLd0ErkaP6FKp31fp5yzKp+W5cAWjKFfQFCBlf3KbiDUikwpYOkQhJOMKbe4KMEaE7OYwseFbnVSMbo6bwlBfBGFedHo1CglhiecR56tzzHF14kdvFjLwAP3sy+PveqOLiKoGiQ5Y8P2k8aW2/W19dz5e4JRnTgvyb7DuBwdaYv47rex8S6gt2EOyelZMDE/NO8v1FrizDZwZ36T3sA+emNo5dA/t45BVq1m+/e7Ksn7FVK+Ff9Xfk4gAzV++nPWafs0Fjbu9T+C2elkuaE7PBg49tGJUMKAyA3xabfRkSm8dyxVPaAlaQddER4A9e3EGiewI4OODKt3U105/1I7IM47LurFcIP6itjbmE4pkCNwSqG0QxuitPHW4uOKQ4NGQtz2RfuqfqRn9+F6C2FPUvIyH8Q7IdI6dNeHoRSc9M8a76eBzuQuMJinALVXPCRVSP8GEzPtSAHitC9O5zdlmtXfCuO6kE+Ac5pTPin/V94dyCJvkc3dbqaWWLOUl3N9cvvdSmK9MGDFYl1J88UIqq4KGsRYxAFbQu7XGVu+DvcBOsQIcWOCM+Q+sPevRHlx5sbQS9LLoM+uIChC7rri1eBbZjhB0XL67OkcDQzSAH7XzL0eD8D3wReohEN24wMEqU+sqaN69EL0Iv1DROQsf89uDI0RlsJiixWgMQnDnx6UDxzxuMdwjNfFL5w1G4+r2Yp4xyVYU743Ydk6OpxF6wsj+b3jGrg5fzL1OnCkgvWIQjhXcXX8Kp6tXrZgo7ibQRkAgJvTD2xpM3yDgx+KDPFxAAkaUwahUfhcR9JNrkcIciH8av6DPsn8juhsJXciz58iFOIi78e5pFFCf8RzPQnkUDvxnVIzE+my6/XMDBcPgjp65pOuAIqAUQhjprO7QeG08vM+j2tG5Aljgdq2UCaIMah39vnqA9IfDZZqbqW/pDCs3PM23i8pRPDhYNJ8/50wxTCt3WenEsRt0SO2MT4n/2hgTI/Ho 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)(366016)(7416014)(376014)(1800799024);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: lixZ93JToOT4jaSiAogbpgOMqq01c1LD7ex1v+Hs5MaSftpm8Jh8lsdom9OUGbP5ZedjPiKLnCSOHINMRl1cDeN7OpME8jYm5r17Kf6VdNgWsYKfHGx2gE4T+ht6vHoc6a/Bps/r8iHgCi8FQBoZGNyniNh/xA6/WB8+6Gqn0ySGevjuW68ydVsfXN6uTk7KI2E/CvsR2GDJ3DsQVtgG05ZD/t3Io4QRWszeL3BDWikv0wX0XF28uU4bn5w1VKmig8wRnm79Mg0gsRPp3VKJ6P/4PuJIMFMbG3DOKKjyBfQl7KakLnwaP58pDDJUGg6nIwp5H5Fwlpvaa7JH8LWaC+nNot/aHqG1Ge4LG+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UHsd3TX6yj/a+ppBSNLHUvTF8KJk18APUNzyOy/4W83w62OCEhSWFD8N8SLxUSCVljUOYTXJduF5UO31u9EAETp60PNTPvsDZhyufKHhCcEqvMop11OKJ03zQczNN79PI4EvknoGWUBBnTViT4KgrzBSk/P9+i+2H+XJCw7eauMSgtjKeLBJK X-OriginatorOrg: Nvidia.com X-MS-Exchange-CrossTenant-Network-Message-Id: f19af93e-e4d3-4460-4c29-08dd2e72ea4e X-MS-Exchange-CrossTenant-AuthSource: DS7PR12MB9473.namprd12.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 06 Jan 2025 16:55:24.9780 (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: E3Jm0Ns44Y+xBWvp1Bt1W1a8KIfwWEWVi6cjKBmEJTm3+f5bVLOPtTkqFobwjk1v X-MS-Exchange-Transport-CrossTenantHeadersStamped: PH7PR12MB6634 X-Rspamd-Queue-Id: 4E1DF180009 X-Rspam-User: X-Rspamd-Server: rspam07 X-Stat-Signature: qs7cx6myp6iy1bn6fz3r7utuq5ykngjo X-HE-Tag: 1736182543-104065 X-HE-Meta: U2FsdGVkX1+kOw1oF+GbZ5MkDWqx+1XDiU+L2jezdaUwCVr9+eRjUKVlMIIpjMdDwxoTDylTpryUTtZ6zd7ZY1MDV3BYZJk0adY6iYp1hpUTeEa62al67F8GK9yGgpOnrpWQj73Q8iQMiPDYLhhNtT4D0dI5GNASbHqc3w+PlU8iwESXVNY4QlVkh+TtxDLDni9HotvDDPmUPFK3cYtVB1XPmP4Ns7pQp7TGxhpICummVN3vZWrBvta6N2WnpE/ojbIQ7/rY4QIprlIPX1zuBlL6iBb9mxKCCCCYexrd2JX8GzR4cEYjY1bb95vny1G+u7uyQ9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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: 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 --- 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 c89aed1510f1..511b5b23894b 100644 --- a/mm/huge_memory.c +++ b/mm/huge_memory.c @@ -3287,7 +3287,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)); @@ -3453,12 +3453,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