From patchwork Wed Jan 22 12:40:46 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Zi Yan X-Patchwork-Id: 13947243 Received: from NAM11-BN8-obe.outbound.protection.outlook.com (mail-bn8nam11on2082.outbound.protection.outlook.com [40.107.236.82]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id D5073212D7A; Wed, 22 Jan 2025 12:40:57 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=fail smtp.client-ip=40.107.236.82 ARC-Seal: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1737549659; cv=fail; b=khCHoaY8oeNF8NG2+YRYR1JExvlx+sO/JyS4NwxWD272Yz0onZRa4T4zhHNrlKFJoWqPR1Seb+m7zz0eorL1ITSFW+2WJWyKs4FMeIhhfjhI1MCwAtk0xrmSB4MIRf2U0Sdw4FZPg22TYT57h94aALiA2Q1PlLmG0+6aC/gTZ1w= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1737549659; c=relaxed/simple; bh=uMqI+2tqCXQabaHOMMNEdO0SRwfWh7bxHJBeeh1700Q=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: Content-Type:MIME-Version; b=o+Z0Dkbn6v0z5+KD1W8yH2vWw/XW+iiDLXgBh1WzVy+3bqeQbUMkeN0RJyAIoYta71h9dldlZwLgpLbUiQrMtMnTWcz0+7xt9g2O6gWSrNMbAr7LN0HFuQA2yfWFpHdjHJXDGhH2ARPOi4WPDZXIwOkhB7l4d6w64wuGMChVUWU= ARC-Authentication-Results: i=2; smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=nvidia.com; spf=fail smtp.mailfrom=nvidia.com; dkim=pass (2048-bit key) header.d=Nvidia.com header.i=@Nvidia.com header.b=caM5M2rO; arc=fail smtp.client-ip=40.107.236.82 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=nvidia.com Authentication-Results: smtp.subspace.kernel.org; spf=fail smtp.mailfrom=nvidia.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=Nvidia.com header.i=@Nvidia.com header.b="caM5M2rO" ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=Ywzzy9mW3yp3/nFWmmEHVBlo94fsivfiROuso4Xu7Wu4gHf7DmUtboo/x3AYsNjwSlHbwvT4SD+VoRrmgwt3PzrPJKmtWFl2AlBoEj2TaxGUAt+a/R1SaFsgh2bpLezRmmcT7WvOTNddqdOLGnriaxfTPbRr2qxx1KNVDgUUM09x9mYvahLfhUC20aDWiEfsm1kV8/Eagmyz8m3BMVWvwj5+Ax/VVYPaH/kNHqu8tuN2PvZ4nRkMeaJ5pyedf0YsDA0BDWUOhDmmVgFY2gmeAtwVDUn0RlcCmOo/K27Cxb1pnTkm/tSu6Kh+0gxad8MH1o5vt5a3MZHWVsmJuOiKWg== 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=vFxpVfR5Qx7GeZmbXyOgbRhQRR+ZWDRqgRZBSjlARCApFkwI/jKDlZGrBvMCB3KOLMq6zOrYhuyfO8oCnr5s24ZWpQWPgk8Dvax/v+RqagZYylOg2jSwnUcCrMax0V3dpF2w4PQhAc6JlrYpziT6aCzWBxFbxq4tHzVH4bmlDBtKr4EUol5lpkhXE1JMDepFTeV95o9prCenbvORC6ICfAa0r9DOuYZL4zjEnt+IvsG40+yM9M6NwWNtRn1UknSkegK0xQlGrBtvh3NRhtKOzGp6M3vXJhnbebjBJqUvJrCw3S4OvbHxohidlsVID8Il204KB63NY71sX9fWRtU9MQ== 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=caM5M2rOSh4vH7qTnba99IagSCqTCc/NgJvPV1zXDfJ8AZ+5kMYY6wowI6zsaKdZWraVFqGoaYTUh2BvhRy6yYYp5PLxtrND9LMlRu5vcKTOLHl1w1PSlSTo+4Tlo7ttQkO5ULD9idcLV88ERTqc3lKLIXf6FRr5QFpFC/XF8bIdENYNemN5OCgh9fThNeJkJMzjR7zTlBxX4IYc0/p/JYvcguo+xGgthP4YHtQCsCMBN5ZFYoS+IWFY0wVzqIyskDh3ZAv2EuaxtTej9gnoSsQsiljFUtasLzm8zEQ9mqrdJdAOF/FTm/0XTVe7J5SMTtmhKq48FuIY7+zf3mdtDA== Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=nvidia.com; Received: from DS7PR12MB9473.namprd12.prod.outlook.com (2603:10b6:8:252::5) by CH3PR12MB7619.namprd12.prod.outlook.com (2603:10b6:610:14b::13) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8377.17; Wed, 22 Jan 2025 12:40:54 +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 12:40:54 +0000 From: Zi Yan To: linux-mm@kvack.org, Andrew Morton , Baolin Wang Cc: "Kirill A . Shutemov" , "Matthew Wilcox (Oracle)" , Ryan Roberts , Hugh Dickins , David Hildenbrand , Yang Shi , Miaohe Lin , Kefeng Wang , Yu Zhao , John Hubbard , linux-kselftest@vger.kernel.org, linux-kernel@vger.kernel.org, Zi Yan Subject: [PATCH 2/3] mm/huge_memory: allow split shmem large folio to any lower order Date: Wed, 22 Jan 2025 07:40:46 -0500 Message-ID: <20250122124047.1216024-2-ziy@nvidia.com> X-Mailer: git-send-email 2.45.2 In-Reply-To: <20250122124047.1216024-1-ziy@nvidia.com> References: <20250122124047.1216024-1-ziy@nvidia.com> X-ClientProxiedBy: BN9PR03CA0501.namprd03.prod.outlook.com (2603:10b6:408:130::26) To DS7PR12MB9473.namprd12.prod.outlook.com (2603:10b6:8:252::5) Precedence: bulk X-Mailing-List: linux-kselftest@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: DS7PR12MB9473:EE_|CH3PR12MB7619:EE_ X-MS-Office365-Filtering-Correlation-Id: 2bb2722f-ff9e-40b7-e83c-08dd3ae202bf X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0;ARA:13230040|1800799024|366016|7416014|376014; X-Microsoft-Antispam-Message-Info: GmM8jSgGpBY9dqfpfWB0alb1EP48V17wok85A72z5NvKakx+xXcU9a2uluMr838izS20mUjxU+DnDVNkt3KdjkQwRAJMla1kBKJhWM0SzAO5Z73LClv2xsVjGAhw4IfRfoLVVSnmK+tpWabS6nuMB3xUsOKMO8a9OI+08RYolkfllDH/doZAEAgErUw5UIn8XBdeGcS6IzIbeuMSdae6aK26rHiGp8JlveRO4HIC+XCD0kRl4djWaCGbHMqFrvFB7RnuxSxB006NnMBYlbWswoy7TJiPbvotd+iGhMl18V7Y5h1WWiiBgefw2BJAA401zXGqdMIy4vUkwKxocNeH8fMAVgk+nsrEItUTe1RyY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;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:DS7PR12MB9473.namprd12.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230040)(1800799024)(366016)(7416014)(376014);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: kxVih0iVeFDRdlBSB1m/STBAbIkiovNt22WHhQzU+9bkWdb8cscYji/M8A7+smdChSXAFhma3Lmt1YmWqbdwnzdsscDwY3BZhH6vwj/shNYpUkFkL/kmar0g2OyBB3DpumcrqIDbZSW3NHNRIa5a2f0DDrMC3Oa7UM86hW0DtxsZOhox7iGnjR4Ig5jmyDwFfiOO5hzk3KR+0tLQmD+DJog/CGVas68Glc9mNDHw8PcPkjqtxYTROUBuir6ZrXJKtQK5xnnkcOvlstF1gcn649mGHSBHfHj1PLXJ1ve9WfnLoSRvpqbvQAQv2eErmPWqoNeRfZjQeRZR4vkkhFQP0lg1nBG8VOsgtf8r9f+aLR4TeWnCRGlcyLDBxE44iQFe7A9ms0MWJJAIYQFyxVGypnSA2Q0yNV8FEt7PRLoxwWy1Y6NtC30DqYIAARNtwxrAkjoyabu9QPlc+rY7eEqiCcnufkO+0vUhPfqxXX978iH7Ja4KVdTh9/TiKQ6qSPgPWxQIKoHKP2kk5r4wOVzPlFjQn5zVi5bIz8uvsdvguv/Np4HG0oMlJNQipgYrGbh3hh7tWfPHi2l0FOX8DErfAu4adEwO+s/w6AdEkd+IBxozP9KeI8dajcAmrT2cAcEW5JHNuC7Md2tlaUDE1fQZqPt49kqUhKNHmI5j+MQMcjVz7HluCgdTAen/Tr7ATJIuYVCOblKxbb6+8IIQgdXohFvPLFPSKOE5e5nGolUjCj5tS2Rq38k53koAuRemP67ot0pVpZIBdHRUcqTeuJi2BBOeE0YaNQQFbqZ7Xgr/rr/zvGq8hx1jibMY0fdToRVpbYutjofxpVyB09gRof8cEqsK8MeV8AY3j4ePzKW2tYrPawpBQObLxkca1hZBD5o6rEkISM/TdYQuXtJLb7urfJ0kydaWEJIGN4x8p1vjcrHhs01dNBZaughD4vy/mJSehoFLWryRyAeY8iLCFg8f13bIJwi5/T06c9aUTjQ5O6Bq59w0T+YUR1ylndWt8ogQDt7onotNWYAXcGYtZPQL321HZrr0V2+hotVX5KCDxVfsm3XU/WLoo2ghiwh+kBlQuntQIuMfsYOsHJPMId9e/yzx6LUjh2MzW5ntBBUfR6BjnjMDsRvKbu11hJcXSIJE3tGdxudCxt27vtCDsbhugHiMTricnlNyyhxaxbHKzkLwv92NHdC8ibDjOio9FziqGACzXz0McmVtCq4B9hkQQ6nmS5kQ+nUr8oaeVPbNb/U0p7HfYeNIRz0vgcmvxdV9L84iss1daILeC3aEJlwPhgbmBEMV16HI7VEgZSSjKP8fNtbWzgmYKu1nR8MUB8B/8NV5+dUG8JseLlmjds2nkhi8AyrdOZjCUdb+HYhB4+A5ykXsuX5WgO8o70c6t2XrbKFtxDMuRkp9K6F7vTIdwjTYiW9rKnijGWAIthMgLQeLmH21NFs7oGl+Q9uX5VCbTnp3qK34Ao3hu53xJ7jGqbHIWER1azsUPMbEDdo/GnBfeykMBM6Ehp1AQWqyXIrLpFVSg/NTSZJ7gUibhHloSyCVZysUdPeVQ/RXlMnffo2a9/jtrOX7yCOujLz8y4W5 X-OriginatorOrg: Nvidia.com X-MS-Exchange-CrossTenant-Network-Message-Id: 2bb2722f-ff9e-40b7-e83c-08dd3ae202bf X-MS-Exchange-CrossTenant-AuthSource: DS7PR12MB9473.namprd12.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 22 Jan 2025 12:40:54.0741 (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: qSZoVvTDqyOm/1lXJ7VDPGG5xzuVE1n5C/grwYft5An4NqsSx85MbUqmZt16L1sd X-MS-Exchange-Transport-CrossTenantHeadersStamped: CH3PR12MB7619 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 Acked-by: David Hildenbrand --- 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