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: 13947247 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 8D22CC02181 for ; Wed, 22 Jan 2025 12:41:18 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 1AC1F280004; Wed, 22 Jan 2025 07:41:18 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id 10DC9280001; Wed, 22 Jan 2025 07:41:18 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id E2E7A280004; Wed, 22 Jan 2025 07:41:17 -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 C05E3280001 for ; Wed, 22 Jan 2025 07:41:17 -0500 (EST) Received: from smtpin08.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay09.hostedemail.com (Postfix) with ESMTP id 467C381634 for ; Wed, 22 Jan 2025 12:41:17 +0000 (UTC) X-FDA: 83035048194.08.1DEAC80 Received: from NAM11-BN8-obe.outbound.protection.outlook.com (mail-bn8nam11on2060.outbound.protection.outlook.com [40.107.236.60]) by imf10.hostedemail.com (Postfix) with ESMTP id 761D2C000F for ; Wed, 22 Jan 2025 12:41:14 +0000 (UTC) Authentication-Results: imf10.hostedemail.com; dkim=pass header.d=Nvidia.com header.s=selector2 header.b=caM5M2rO; dmarc=pass (policy=reject) header.from=nvidia.com; spf=pass (imf10.hostedemail.com: domain of ziy@nvidia.com designates 40.107.236.60 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=1737549674; a=rsa-sha256; cv=pass; b=pBIakkzX+yrJ5sqIZnLZRnji95we1AvzFYXw6Ai2ZsAppXDErVIDnJ9MALNIUX7zJbVgEJ z5PVWgiTjBpgFKlDNzppzuqyd8bs3q8lxxvRIn8bZSzKm3ZtG6ZX8TeHQdBM7dXNDhSUgO bZuHJ+2zbfR5aqyiylX9VpLczhlOuiU= ARC-Authentication-Results: i=2; imf10.hostedemail.com; dkim=pass header.d=Nvidia.com header.s=selector2 header.b=caM5M2rO; dmarc=pass (policy=reject) header.from=nvidia.com; spf=pass (imf10.hostedemail.com: domain of ziy@nvidia.com designates 40.107.236.60 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=1737549674; 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=BoXTFCR3X4o4oRqD512WHmhxkGfakzR/K6nVqVaCl1kcreWKNdvcjtPXB1Vhy9OxTDHT36 +Od92LwR5fDYgIJqXDI8ZPzCfUt6FmDGn1S8ZnqitpufArzhdBVBVQiEQ5ELijtrB8TkSR UKi2oYNoscNIDK2OJRxZPchwDzdqOXA= 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== 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) 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+nsrEItUTe1RyYJo5SeU972nR4nSqRgCxeV4I413Dmf1jP0+2b3kOHs7MxyZqxfzMwsxOZWFUTY7aF4+6yrJe9rtwTzP5Cx/oicvyQ5p8l4yWFvKo9vS8a0YTDyHegEpI5ZfVGNbokb7U/SiUajH0iX3sBpm8pCSl1xa8alEszmx5oHeOgtgc6havjMMS6MRUo1fAAjD1zBilnXNzGLWnOb/LH7EWW3CX5jHnhyLl+zTzRGBQL2GcKnDwKJy/Cn7TObBjf+UzCJnX7qHN/+MFpXIekbLCPoFsLatS/5h5UwW3frkDrDmbRxklTaP2fCCR99DAfzkQ9CDI6eC0ewKCwP6bljRNZTsWDJhMzn3xEDXxw7bomfAadHnYMcf8j4HXZCVAfZjky5dx43ZfiXyDvORnY0u2D/KMskTM/HhJY/CMc/K3FSicbDtghu1v4L9rcXDHMTpy3RdopxUoHhF6UglqjHxyKvMeRcu1VScv0w9puplao5r/dEi5AhmwZvBHtKoyO5C7HYdylwyyfT7D882d+RQBG+NxXNIUxMx+UR+/IIzsdcCg8tI/cOKCkgxpJusY+7rj+XtLgDRDK5YcIUge29OsVx0QCkfD0bepOO2ct6sYHJPPEDJpGn3oRruI8OWXB3D0jHCs6vySsEKn3dgebqXL/Tk1w2rNSWL9pGeiX3Jr7u4FcegKph7fp4d+2OgRcOauIoSZIWEPMEi4KscTlkLq5EXrWZy7Cu4ci/gBbJvsje2V5DDyhMY8EcSOElSqGzaLG/DZ5Vfeg+IuFJDyQ4E0HzvvtTPyWNB8epEnKjIMZg75Yv8HfDPITk84qEc+nUXwnnFmUFNR1DRt3wzklRj1IgmP6csX5zFTlxqOvFvJHun1YkV0PHM9e1bAdvZkhOzbA/r4bX6Y15J72HgVen8vDmOxYv+VcI680wZZoss41pjglj7Y5WRhUKHNUQDOGbiWKxwFrQXVxMTIzXIqINs68HSdpgDnIMlRSnyGpGJ27QVuobjM5lO51VWZjb1U3b+vOaBSLXgVumrizBKdY6XN7wynwK+Q 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)(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/CGVas68Glc9mNDHw8PcPkjqtxYTROUBuir6ZrXJKtQK5xnnkcOvlstF1gcn649mGHSBHfHj1PLXJ1ve9WfnLoSRvpqbvQAQv2eErmPWqoNeRfZjQeRZR4vkkhFQP0lg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IdwjTYiW9rKnijGWAIthMgLQeLmH21NFs7oGl+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 X-Rspam-User: X-Rspamd-Queue-Id: 761D2C000F X-Rspamd-Server: rspam10 X-Stat-Signature: 6ntwkozfwdqqxjow9wcit96pk4s97wb5 X-HE-Tag: 1737549674-238303 X-HE-Meta: U2FsdGVkX19tHA9IWoha7uUwKueGMKRMc1StciNWQGrP9FZupbEOM0StxRxZzG6JJ9yPP80QVNBGxFJhy9LtZrMVshILslzu8pRbQZcg+T/4aKG5yqSqaiFXsBC2Dm5jmLxCkvDv08wW0HI/md1llOBgW863r828Heoyri8Rx7j1OfV2oJzazVzph1CnxByEcs2sbdeUBfRARiumCDxeMSEWGE0itxduS1rJpZ1II6O19j1Ga2D3fN0Tr9Soq8J6h5M/3U4fejEu9J/txE8x1PNWKjKbcf/+hw7+IcNTtrXjejtJVVhgVUVS7EiAHuMw6p7ICj0zRQHz10dFQ/4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: 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: 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