Received: by 2002:a05:6500:1b41:b0:1fb:d597:ff75 with SMTP id cz1csp119919lqb; Tue, 4 Jun 2024 06:54:48 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCVdmEMjBhCc3Hy2N4OQeqfuHtxrktfg/PgdqHfLXZt5z0pV3FHxv7ZM1ui9TMvxxoCf4PXsHaO57ZHBE0RMvFr9YVV8Yqppd8mhG2A8Gw== X-Google-Smtp-Source: AGHT+IHvLJNhLpVXPr3KIMmtFVhzi1ot8hwoOzA7EBTr1CQfsKW4v/qSiHptBVlqb1wsJviIi6bS X-Received: by 2002:a05:6512:20c6:b0:521:92f6:3d34 with SMTP id 2adb3069b0e04-52b8954e8f1mr8906512e87.22.1717509288144; Tue, 04 Jun 2024 06:54:48 -0700 (PDT) Return-Path: Received: from am.mirrors.kernel.org (am.mirrors.kernel.org. [147.75.80.249]) by mx.google.com with ESMTPS id a640c23a62f3a-a68b80e31e9si375711366b.759.2024.06.04.06.54.48 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 04 Jun 2024 06:54:48 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-200752-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) client-ip=147.75.80.249; Authentication-Results: mx.google.com; dkim=pass header.i=@Nvidia.com header.s=selector2 header.b=dBylSPMr; arc=fail (signature failed); spf=pass (google.com: domain of linux-kernel+bounces-200752-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) smtp.mailfrom="linux-kernel+bounces-200752-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=nvidia.com Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by am.mirrors.kernel.org (Postfix) with ESMTPS id 05AE61F23061 for ; Tue, 4 Jun 2024 13:53:26 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id ABE40BE6F; Tue, 4 Jun 2024 13:53:12 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=Nvidia.com header.i=@Nvidia.com header.b="dBylSPMr" Received: from NAM10-DM6-obe.outbound.protection.outlook.com (mail-dm6nam10on2078.outbound.protection.outlook.com [40.107.93.78]) (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 D1F1D171CC for ; Tue, 4 Jun 2024 13:53:09 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=fail smtp.client-ip=40.107.93.78 ARC-Seal:i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1717509191; cv=fail; b=GvEuhW4CZS4oXc7QYO24t1pGk23RI78t4Pvpj/gpYqPikPigfPjFqdZ4JqzR1tmv3yByzuNAa413WKljQpo18JuyZjS6yigsNaYen6J+hNytuwEGz4buxo40bSJRk6soscYb0Y8U3H0T4m9oIJ4tLmFjC7h5FdMQzOml82amgdk= ARC-Message-Signature:i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1717509191; c=relaxed/simple; bh=qYulyM9jpayklSm0Na3gY85F3cyGzPV8zfTVyi6tN5M=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: Content-Type:MIME-Version; b=jWix+2Al5hH29hIcQ8uF7buVOzhBQGg4oAi/UTo7LGU/b8WRVqqouWamV0P7BeipiIpNMgXlWD5W4YYnOuxzRWdjRmRF6sPQrt+JXXeYoPOM19EqAi/QFst7sS5wVBLacld2JzYst4zzf7+X/KOYNkExbMaM6ceBxkiKcadxoDM= 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=dBylSPMr; arc=fail smtp.client-ip=40.107.93.78 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 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=Q0+Jd2YxxHlsFn5qqBVKx0J/Tdf70bRL/iG1y94Wy8Ng7sqSBs4XY4aPDVtH8l8HRmXaQDyDJ079OEn+T830r4mLQDw1SrfEU89OixMUT80Rtqs2icAYoQxr1taJ8JjzdTbpMd2sLtcy2dAiJdNFbWVjlpVrsoK8FLuToJATv+u3+TaFdjLWwsNxv6WPFeOqxvbU5OEY+b5GYl+AArlUeN0+0PtTYqmBPHwrkoD5BJMjnZfFj3cXwl5vbs2uQRSskSl5PBW9PBjwhm0pU18JhMGOgnMEtDWSKBjxQH48RYK4P4zczVu7sK57yWSCoirCuhRLhaNC7SCvoNEyxOfObw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; 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=lVX0ePiqq+MvkGM8hpxE1QczRujHP4WCQFIJ1UHmHPU=; b=VdTjIdS+kzL6H7mphDJW/hOO2rnfOmUNumDlv8WPc/HNuf4SLqZP+O9pnqJoH8cmrL0bB0iBxuYBRH6DzQPQERDYgscjLEAiq5tC9qz0VD2g5wBINL8qzeiKtwHGHocFzPbNXtJy0oETsD1H3tpCI2GBERKpky2CUfmFvzftjv0bNYz4GGa9SEDP0SerS2atpbdr4zhqNah+ZHh+6ZLZSMhCVwxdzl3DB0+64OUg7BqhqfIEV7uJShTZN3zeucYUbwxbTdk0wIqzkhGkr/ItBLMSzkVR5h5qvgmB5hyXQKMnghUpLsxN5Tbt/oNc+rAruk3eGkiCPM12Bju5UMvkUg== 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=lVX0ePiqq+MvkGM8hpxE1QczRujHP4WCQFIJ1UHmHPU=; b=dBylSPMrEfGPnKnn0v4UNobi82wPTeDSDPKTmdl2tUT9bjA5+y3ysvR4XRDP603jmowV8Jp3dvpZ4IYeiztWXK33T6aD3fmwymNQmMRFXgNNjgca6PQZAKBK5iP19yZW7wauPi5gCg/Mag+F9sDGCR161YrGmLO//aAKP+t53SKSt02ZbXnUtIbyMcCOWonTmaYQuTgdW0zGg1OQSVFcTBBXvRtP+tSyqNVauEyUmMcrPc3q3EMOmcEe3//VuRFYiSZQGaIsRIqDAd+T+e+zk2nbcvDZlpQXmYezHc6phZSn0ft9iolFMq8lOn6HWZXoOOgarT6xScLQ6LlRbXVy0Q== Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=nvidia.com; Received: from DS7PR12MB5744.namprd12.prod.outlook.com (2603:10b6:8:73::18) by DS0PR12MB7876.namprd12.prod.outlook.com (2603:10b6:8:148::9) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7633.24; Tue, 4 Jun 2024 13:52:58 +0000 Received: from DS7PR12MB5744.namprd12.prod.outlook.com ([fe80::f018:13a9:e165:6b7e]) by DS7PR12MB5744.namprd12.prod.outlook.com ([fe80::f018:13a9:e165:6b7e%4]) with mapi id 15.20.7633.021; Tue, 4 Jun 2024 13:52:58 +0000 From: Zi Yan To: David Hildenbrand Cc: xu.xin16@zte.com.cn, akpm@linux-foundation.org, v-songbaohua@oppo.com, mhocko@kernel.org, linux-mm@kvack.org, linux-kernel@vger.kernel.org, yang.yang29@zte.com.cn Subject: Re: [PATCH linux-next] mm: huge_memory: fix misused mapping_large_folio_support() for anon folios Date: Tue, 04 Jun 2024 06:52:54 -0700 X-Mailer: MailMate (1.14r6030) Message-ID: In-Reply-To: References: <20240604134738264WKaKYb3q_YTE32hNAy2lz@zte.com.cn> Content-Type: multipart/signed; boundary="=_MailMate_1DA8CF4E-A6E2-4232-9624-4A4273D7299D_="; micalg=pgp-sha512; protocol="application/pgp-signature" X-ClientProxiedBy: SJ0PR05CA0183.namprd05.prod.outlook.com (2603:10b6:a03:330::8) To DS7PR12MB5744.namprd12.prod.outlook.com (2603:10b6:8:73::18) Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: DS7PR12MB5744:EE_|DS0PR12MB7876:EE_ X-MS-Office365-Filtering-Correlation-Id: cc1dd1c7-70bb-425e-24f9-08dc849da45f X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0;ARA:13230031|1800799015|376005|366007; X-Microsoft-Antispam-Message-Info: =?us-ascii?Q?PNCaqYvbP0/rE0KetQXJzpWvRRrWEaTHYPrvgcPHg5K+VMOuMpBnl5uTy8HJ?= =?us-ascii?Q?Nl2vJj83/5zKyHO8FrYiXDR97mFrZOs1tWdVDNv48mVRo6xMwwLLlNQIJdki?= =?us-ascii?Q?RoIfCY7n7Hi6NmrKg91A7AdEFjDMczOmWv2Y9DZY3nx/GXXgJmM+FkzkA90s?= =?us-ascii?Q?48Y3az64RIaYa2xEXH+Bs2Vb8Mse9zsGD3BafJ4W68kk/ycAVWXV0K/6FPKZ?= =?us-ascii?Q?p23NnCf9zQgZLA4YSF7anAbexQBA26VU/LOOZBqIjNJH19O5wy/NOdXdE5wH?= =?us-ascii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q+ZepRIhVmKK396?= =?us-ascii?Q?Gcu+oTxTPJJ6zhbf5BVD9xBESi86kKQbADHuV5koAzHoxziYg6KG6AJrvK7k?= =?us-ascii?Q?c12P1bTYOtHMd9GFAry8Qg459dAvGi/zCYnjrOBINQ=3D=3D?= X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:DS7PR12MB5744.namprd12.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230031)(1800799015)(376005)(366007);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: =?us-ascii?Q?DFsqfUigX3vbOSy2otm25TSMAdsh9/wjslJjKzPdogL/ppAj0foBj4Wk8ZZj?= =?us-ascii?Q?5CTNfsUSX5QYYrM8vgTnKrCtncBGKTehiTB8vZcuTks9AX/ZlH9TsijCdz+E?= =?us-ascii?Q?nTEaM7sUWSgrygknEe++wXGgwOgvWpLEzRFs99r7coP51HKC4B9o8+HnPUqh?= =?us-ascii?Q?1DHwlTHHDFzH5YG55Y18OkODN2yll/dV+BymRgKfyNWy57xARot+dzpZPz0+?= =?us-ascii?Q?P0LjIJpz+F0yLsNk5aLBPjVyk9E3sjJWY8HYHjb0ok5h98RIzDIaJK7/oIPM?= =?us-ascii?Q?8IQ2bz4QmBnskd2Qa1q+NwUQn1JK1gVECJfDWYgLpgyw/s/N1J54urcAZi1N?= =?us-ascii?Q?7IeMKv6ANWorrLse2yUbT2lYR7/xVWxgE2dIIdgUp8mBOlvaEqj25gjnGoPH?= =?us-ascii?Q?vk5/pe4UWtAI1e/TO0G0bC2kw765BwOoV/2VRhY3IoIq88qhnWWcKEvGZhPV?= =?us-ascii?Q?Wb2zEFuQR2++GwmQEua9XRrtKQ1bfF10oLh4jiEMUWSloe8giVf8EWRRyY45?= =?us-ascii?Q?yCKOexgxwOfkVWpIWQ06APAUVbMnooXbftXXA3qu9EMjnmf5d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0YdEjp5DgvBmEh/80/NofwwnS4SRkCRM/TM8?= =?us-ascii?Q?tb95PTfpvt+Np8PJ41XZ4aTTMuJakh7UXDAsFq6uPrnCAkei5z3cX4QTBJvg?= =?us-ascii?Q?rAigpkXoXTUVa5dXSuo=3D?= X-OriginatorOrg: Nvidia.com X-MS-Exchange-CrossTenant-Network-Message-Id: cc1dd1c7-70bb-425e-24f9-08dc849da45f X-MS-Exchange-CrossTenant-AuthSource: DS7PR12MB5744.namprd12.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 04 Jun 2024 13:52:58.3382 (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: 2v8q6J29SscJqdNBPd39XSt1ES02C23J3w4xvfNt5GnOcgHuRyqQEcJ2FETol1/v X-MS-Exchange-Transport-CrossTenantHeadersStamped: DS0PR12MB7876 --=_MailMate_1DA8CF4E-A6E2-4232-9624-4A4273D7299D_= Content-Type: text/plain Content-Transfer-Encoding: quoted-printable On 4 Jun 2024, at 0:57, David Hildenbrand wrote: > On 04.06.24 07:47, xu.xin16@zte.com.cn wrote: >> From: Ran Xiaokai >> >> When I did a large folios split test, a WARNING >> "[ 5059.122759][ T166] Cannot split file folio to non-0 order" >> was triggered. But my test cases are only for anonmous folios. >> while mapping_large_folio_support() is only reasonable for page >> cache folios. > > Agreed. > > I wonder if mapping_large_folio_support() should either > > a) Complain if used for anon folios, so we can detect the wrong use mor= e easily. (VM_WARN_ON_ONCE()) This is much better. > > b) Return "true" for anonymous mappings, although that's more debatable= =2E This might fix the warning here, but the function might get wrong uses ea= sily. > >> >> In split_huge_page_to_list_to_order(), the folio passed to >> mapping_large_folio_support() maybe anonmous folio. The >> folio_test_anon() check is missing. So the split of the anonmous THP >> is failed. This is also the same for shmem_mapping(). We'd better add >> a check for both. But the shmem_mapping() in __split_huge_page() is >> not involved, as for anonmous folios, the end parameter is set to -1, = so >> (head[i].index >=3D end) is always false. shmem_mapping() is not calle= d. >> >> Using /sys/kernel/debug/split_huge_pages to verify this, with this >> patch, large anon THP is successfully split and the warning is ceased.= >> >> Signed-off-by: Ran Xiaokai >> Cc: xu xin >> Cc: Yang Yang >> --- >> mm/huge_memory.c | 38 ++++++++++++++++++++------------------ >> 1 file changed, 20 insertions(+), 18 deletions(-) >> >> diff --git a/mm/huge_memory.c b/mm/huge_memory.c >> index 317de2afd371..4c9c7e5ea20c 100644 >> --- a/mm/huge_memory.c >> +++ b/mm/huge_memory.c >> @@ -3009,31 +3009,33 @@ int split_huge_page_to_list_to_order(struct pa= ge *page, struct list_head *list, >> if (new_order >=3D folio_order(folio)) >> return -EINVAL; >> >> - /* Cannot split anonymous THP to order-1 */ >> - if (new_order =3D=3D 1 && folio_test_anon(folio)) { >> - VM_WARN_ONCE(1, "Cannot split to order-1 folio"); >> - return -EINVAL; >> - } >> - >> if (new_order) { >> /* Only swapping a whole PMD-mapped folio is supported */ >> if (folio_test_swapcache(folio)) >> return -EINVAL; >> - /* 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 */ >> - if (!mapping_large_folio_support(folio->mapping)) { >> - VM_WARN_ONCE(1, >> - "Cannot split file folio to non-0 order"); >> - return -EINVAL; >> + >> + if (folio_test_anon(folio)) { >> + /* Cannot split anonymous THP to order-1 */ >> + if (new_order =3D=3D 1) { >> + VM_WARN_ONCE(1, "Cannot split to order-1 folio"); >> + return -EINVAL; >> + } >> + } else { >> + /* 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 */ >> + if (!mapping_large_folio_support(folio->mapping)) { >> + VM_WARN_ONCE(1, >> + "Cannot split file folio to non-0 order"); >> + return -EINVAL; >> + } >> } >> } > > What about the following sequence: > > if (folio_test_anon(folio)) { > if (new_order =3D=3D 1) > ... > } else if (new_order) { > if (shmem_mapping(...)) > ... > ... > } > > if (folio_test_swapcache(folio) && new_order) > return -EINVAL; > > Should result in less churn and reduce indentation level. Yeah, this looks better to me. Best Regards, Yan, Zi --=_MailMate_1DA8CF4E-A6E2-4232-9624-4A4273D7299D_= Content-Description: OpenPGP digital signature Content-Disposition: attachment; filename=signature.asc Content-Type: application/pgp-signature; name=signature.asc -----BEGIN PGP SIGNATURE----- iQJDBAEBCgAtFiEEh7yFAW3gwjwQ4C9anbJR82th+ooFAmZfHDYPHHppeUBudmlk aWEuY29tAAoJEJ2yUfNrYfqK4p8P/3Z00wHEG3jJ5l4vHPNvPA1fb9aeUraW5Tvn Y0xAcbNViss4cuFknKE6z0Aw65b3nb4lQZ9Ux7m8lbpeW8JKFraj2qAjg1yMl8ZT +e44orvEwbbUA9ga0ZlcATkWETb/hMYb1E1Wa090lToXU1CjtrWSLZeU0FTAeRQT SIoNqX4faWAs2p4hOAle+YUTzzdqbXTrowQwVhXxV8efB0x+RAv8qdJd4frWtio1 oBuSNTs/iUqFykXDsQekxDon1l4SW9bWvMKP2w9PsrIoP7iH49i1rqeOYNgCuQwW TbWiiQYzjm/8tN9VP4NVNR6ZKGIXS5RR48pIoIeqX9J8QsHM6S913NM+87wZL+0k AXFXKzRAIxvyJxMCw+GpfpZ22TQrlaTrtVRpX0J0cHiDSq/24Ff2vpDxB4r1aigp WbBhFSWgD1FBjouj5i2Op/yGhxL3XhZD4FV4TFx6XCzPJGUTY6aZ3iqFQ1pMIxLO uSdWQq37GmvcD4yxjoou1QaiutbfMo10otc8g9uVEpzAjOFwoKiON9lvxT9OrYJB wI1pitQv3CPXXkQcvdFRnFD/Xc569TOHkdAOn30peh9oYbzyhxmsHDR09eYf1s64 HHdG6QkrlR+01iCyzdVUOuAEa985ca7cM/CXO8Dk4tVT8OsLqA/AObTRZrwyMpDg KxhiF9mf =VAWf -----END PGP SIGNATURE----- --=_MailMate_1DA8CF4E-A6E2-4232-9624-4A4273D7299D_=--