From patchwork Wed Jan 25 17:05:31 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sidhartha Kumar X-Patchwork-Id: 48221 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:adf:eb09:0:0:0:0:0 with SMTP id s9csp386327wrn; Wed, 25 Jan 2023 09:12:28 -0800 (PST) X-Google-Smtp-Source: AMrXdXvxqLJigEN9394sklghB26uc35ztqL+ZBOtc68cB48COcihcVvtXSY8wwFPlKX0NCx0lewG X-Received: by 2002:a17:906:7185:b0:81b:fc79:be51 with SMTP id h5-20020a170906718500b0081bfc79be51mr33203225ejk.50.1674666747980; Wed, 25 Jan 2023 09:12:27 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1674666747; cv=pass; d=google.com; s=arc-20160816; b=tLgX3XUutYo/BxqYgiVFPMdGiNAv1MVTyKphhjDFT6bGakiygAOP4vo1cmqOn6vNGD av2nILC5ydbZB7KD+SEOKYDIFPZRlVgXjJ7KtBZDBIEE8C/uucfYbIaIhq2H00NC365n SqfZ4gZ/1KwqSjSrb8mfsMAq9slnr29yIZVAyNj7pxlbtLpsfPpzIQ6flAyJPfnDx2kE KMWVKPkz6xImyHDJBIoZjb90s1fJRmKzxXUwGNw7xr+iZkgEyHw7fFBhiKks3FsYEFxE VqfzuPiuX1scJC19zWMeO4kgfYIHHeq9dgpbrQn8JZkomRr9wJEBgkR8oQJGVsPM3tRc EOEA== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:mime-version:content-transfer-encoding :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature:dkim-signature; bh=kg6K/uovRnrO0MaE25vLuqZe0ttrD5ZD9baHCb9erk4=; b=khtahNz7PT+trge+4vcrFELp8oQq7Cr8jA3S5OMG+nE7300nFyOr5fXWs65hgmwPMh EzrKjoHlSPiu2RC/zGr6oKGcuCj7nFHIrGoJZvODt5JNy6emZcfplFN/MWF5PA0iQd5C Jusc7paGfMr4P2dno+QRFFxBEYeGMx1uLOdaR6t3RH9iA5YniTwe8sKvpvuGi4zdbvj+ igrHwkibQ7McKHkOcQDLA/maU2qEwoLRlSEfAetI7eQrsbN0xupv3DJkB+7C1U+h4SuR B6ypRuwYjfOWc3HS7qO083Ec7GJStkdZwPBm5X2Ed3Mbf7FInDEqxF9atzrT/sGGfI4h ZUMQ== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@oracle.com header.s=corp-2022-7-12 header.b=qqwDUn7p; dkim=pass header.i=@oracle.onmicrosoft.com header.s=selector2-oracle-onmicrosoft-com header.b=xfm7MMGk; arc=pass (i=1 spf=pass spfdomain=oracle.com dkim=pass dkdomain=oracle.com dmarc=pass fromdomain=oracle.com); spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=oracle.com Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id 15-20020a170906224f00b0084d4730001asi6764325ejr.89.2023.01.25.09.12.03; Wed, 25 Jan 2023 09:12:27 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@oracle.com header.s=corp-2022-7-12 header.b=qqwDUn7p; dkim=pass header.i=@oracle.onmicrosoft.com header.s=selector2-oracle-onmicrosoft-com header.b=xfm7MMGk; arc=pass (i=1 spf=pass spfdomain=oracle.com dkim=pass dkdomain=oracle.com dmarc=pass fromdomain=oracle.com); spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=oracle.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S235822AbjAYRG1 (ORCPT + 99 others); Wed, 25 Jan 2023 12:06:27 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:56964 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235859AbjAYRGX (ORCPT ); Wed, 25 Jan 2023 12:06:23 -0500 Received: from mx0a-00069f02.pphosted.com (mx0a-00069f02.pphosted.com [205.220.165.32]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 360DE59B4C for ; Wed, 25 Jan 2023 09:06:20 -0800 (PST) Received: from pps.filterd (m0246617.ppops.net [127.0.0.1]) by mx0b-00069f02.pphosted.com (8.17.1.19/8.17.1.19) with ESMTP id 30PFQ7nM029151; Wed, 25 Jan 2023 17:05:54 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oracle.com; h=from : to : cc : subject : date : message-id : in-reply-to : references : content-transfer-encoding : content-type : mime-version; s=corp-2022-7-12; bh=kg6K/uovRnrO0MaE25vLuqZe0ttrD5ZD9baHCb9erk4=; b=qqwDUn7pjd4SAw4vIsCzQGgdiTvQlp3SyfQUqV/vqJbb4t3+R027AzXFB/1Q6lfhh0eQ bezbtha+MC2vVrEdRa+/H2oKtJGlDFSkbdQ8TADa6rjQAOoqR+GBtozPWFLmNGxnxyYE Lw/Yg0us4RL6TtqIJVwgDFEd+X3Xq9/KsaVjN8HKS0OY8carToqA6M3+U/aXZOxnAApz HgHvc740n5UaACxM/sOdVdzRK/QWqLjp3J0hTdxIDclr1XHGEyRIEn/nrMbciNJT2ZVE Medouw399I6UpycrAF5bCuu6FXZv6HJE16+fuc+2PLMM5OxxDNczw96Q/MEqdRC7J/Xs BQ== Received: from phxpaimrmta02.imrmtpd1.prodappphxaev1.oraclevcn.com (phxpaimrmta02.appoci.oracle.com [147.154.114.232]) by mx0b-00069f02.pphosted.com (PPS) with ESMTPS id 3n88ku0dts-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Wed, 25 Jan 2023 17:05:54 +0000 Received: from pps.filterd (phxpaimrmta02.imrmtpd1.prodappphxaev1.oraclevcn.com [127.0.0.1]) by phxpaimrmta02.imrmtpd1.prodappphxaev1.oraclevcn.com (8.17.1.5/8.17.1.5) with ESMTP id 30PGGUXF034229; Wed, 25 Jan 2023 17:05:53 GMT Received: from nam10-dm6-obe.outbound.protection.outlook.com (mail-dm6nam10lp2106.outbound.protection.outlook.com [104.47.58.106]) by phxpaimrmta02.imrmtpd1.prodappphxaev1.oraclevcn.com (PPS) with ESMTPS id 3n86g6tsq3-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Wed, 25 Jan 2023 17:05:53 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=T3E7m6wmbp2JkFAaDQyZowX8XHkUMpisMmHAk9kF/wXYM+i+EXDaPHjMNGKEy2n08AG/tCjfNAI4dWEHK52f35OIYWfr+//HqiWMbiladbx3ARVfzwX8bqap2e+qgeudrx1eUmjHngzoVbg+kDytMak6xaxA+pL59TQNvRtRslq0SIjCakV045xbjJWGAJ0MH2LxrRgdYZKDxlrtieTmfMX+8QIeGX25z/rLfVA00vC1DwLmQNYaRGwG9UxkW5vhimZjaD+b8jFvvkEVwhZ1CRNR2K9MUZ2Uxue3Vwb54JMSaXUXhI6S055uOdrMhFJqtYgs6fEyyTqLQ7UsP0OwJA== 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=kg6K/uovRnrO0MaE25vLuqZe0ttrD5ZD9baHCb9erk4=; b=P4tPLbC3Mux5ApNkCS+3ELHezme36v1vWGmu0IUcseb9ic3+yAOpMz2eedN8HTX0jo+SlD64ASt/NYsWk4qw3zSW3gMBKS+KeBY7GDgdD6Z2w7emQHkgpBEbEECkIUxifozfcC1fymNe54TlxNYrL1cIeBFeJIMyqu4rkYMF1lyfR/2+khCJODdt3o7BTByH/xcSUrD+LeeC908/wKReRe3EbMAjHBtvDbNtiSciqtd34jcMAGpHxHtSgyzSb+XNmQoOmoBaRnuEkIvAMqCxizXlVG9zAUAiu886Hw9BamYQXyzMwGa0cgu5iRO9DF7eOIOOdmXONk0yNxk4cEt3lw== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=oracle.com; dmarc=pass action=none header.from=oracle.com; dkim=pass header.d=oracle.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oracle.onmicrosoft.com; s=selector2-oracle-onmicrosoft-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=kg6K/uovRnrO0MaE25vLuqZe0ttrD5ZD9baHCb9erk4=; b=xfm7MMGkauoejhQzrGTMEBpiXF3gL2srrRapX2BS8oVQF1wJWGrGmn9Odhq/RU1KUmGKMcV/S8U2mqQQzfciTBFBxN0VMdOQB1LcV1RsIon7SjbYjgddT3lDyNWHsiDPr8n+Ej+DS942VmBRQN1d6khBvN93SSIVpqVaqRaJslA= Received: from DS7PR10MB5117.namprd10.prod.outlook.com (2603:10b6:5:3a6::17) by MN2PR10MB4384.namprd10.prod.outlook.com (2603:10b6:208:198::23) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6043.20; Wed, 25 Jan 2023 17:05:51 +0000 Received: from DS7PR10MB5117.namprd10.prod.outlook.com ([fe80::93ca:e22f:aa6d:94d9]) by DS7PR10MB5117.namprd10.prod.outlook.com ([fe80::93ca:e22f:aa6d:94d9%2]) with mapi id 15.20.6043.017; Wed, 25 Jan 2023 17:05:51 +0000 From: Sidhartha Kumar To: linux-kernel@vger.kernel.org, linux-mm@kvack.org Cc: akpm@linux-foundation.org, songmuchun@bytedance.com, mike.kravetz@oracle.com, willy@infradead.org, jhubbard@nvidia.com, gerald.schaefer@linux.ibm.com, Sidhartha Kumar Subject: [PATCH v2 2/8] mm/hugetlb: convert hugetlbfs_pagecache_present() to folios Date: Wed, 25 Jan 2023 09:05:31 -0800 Message-Id: <20230125170537.96973-3-sidhartha.kumar@oracle.com> X-Mailer: git-send-email 2.39.1 In-Reply-To: <20230125170537.96973-1-sidhartha.kumar@oracle.com> References: <20230125170537.96973-1-sidhartha.kumar@oracle.com> X-ClientProxiedBy: BY3PR05CA0029.namprd05.prod.outlook.com (2603:10b6:a03:254::34) To DS7PR10MB5117.namprd10.prod.outlook.com (2603:10b6:5:3a6::17) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: DS7PR10MB5117:EE_|MN2PR10MB4384:EE_ X-MS-Office365-Filtering-Correlation-Id: 9ae529d7-f5e3-4f42-46d4-08dafef66999 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: MHh4HTrhPWV+gNp3KC1//UeEonEAbQoFsyQbNNelWonqzQaI3y2vJs0kavreh1hxfMd7k3giJA5Js3ApzHOhNwXbbCWtZfEQEAwe1B8RjbF2o7+30zNTmKT77moKyLto091VD+IU9TQMMABHc+u2e8tenMGZSYHkKpOzDKxvUWcMMB0dKwHw/QCCNG22SiZE9MADINwjuGErjNWzBQUUNVQjhTBq3ldjd7SxMLZ5rbfZ1iOoI7yKmW1to1RmdIzXjF4ng4e+u2SHKf2qZkZT51otWHvPm4Sv6UHn3//y6OT2hvLal+E2cRuvwlj9S09mU35MyUHSc8GsNMh1nZxh0/EvTiXgDqMf9MAfhWzP9m+mjCu6uAgJQEWxy6uioAUpA04TK8PJXqZQ/7nJZmscqKFmTyszd8wDTz0vR+jyijaFJ+V+F24z7S7OYkIRnq7kq4w1kVUkSVQm0cSXVMCkeMP10ecYukTT2L+/KaukCQRhEBB48I0f/bnC+FwJQbDgbzsz+V91QQhH4yTO5IJ93KhE7P11kdO1OePBRiBIJq3NMGJBZz8OvkWdl36LB2jOFNAI0rFbTh9IY8WGjkKFazto+Ja4dsFH54z2E7nsbuGIe1/UmJ3Ob7fgmSqgW1P+2TlkaxEpuqpnA92Nn2hVwQ== X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:DS7PR10MB5117.namprd10.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230025)(366004)(396003)(346002)(376002)(136003)(39860400002)(451199018)(186003)(26005)(6512007)(38100700002)(66946007)(66476007)(66556008)(8676002)(83380400001)(4326008)(8936002)(41300700001)(2906002)(44832011)(107886003)(6486002)(478600001)(5660300002)(6666004)(2616005)(1076003)(6506007)(316002)(86362001)(36756003);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: lRwKCDUhY0v5II7Rh8aU9MIVFsCZlkjnRuPHUnB5d2+j6oCriw7SNPOEuB8IM1+PR5VNCadMiNzmb4/9mMqTYDsKcUEwU2zGozew+ayGlH2rCmNpmg+pVgjFO5ud9zXymAlyC7jDAtPe+p+F7lI1Ai+VzeOxH90idp6368qxVmP5RHw8Q4PzvbMYZ3I5AnAr6CkjH5lMAZbxockFcgjeecWdaJSsnpLOxFEe3ZXo8NN1F0xZpXEeaayKK1TmyeQ/KXcElBwGFgUxO3SjOP+NodTorrYfDM4DxZeq1cyNw/pSt2mdMzu8WML1G6pdIoaitX1koZbLgg0suWVLkOziiXyipcVxaeTgcsNnltG/S283XqcX6QjnrUizL9Zd4J+UDXIXeOCpY5Js+MqxQV9mHg4Z+EC+OWYyCLEkHvzZGu1papAQ2z/DqB6oaACuQaFqRRKUCd7uaWVqxSvZGrPz3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jIdHbKXskAriDfzPgt5AHYQSzPQJemIRThcC1+zHznvB1nZ+tnFIbDUUpkVVR3S/bHtq/qPju70LftAg= X-OriginatorOrg: oracle.com X-MS-Exchange-CrossTenant-Network-Message-Id: 9ae529d7-f5e3-4f42-46d4-08dafef66999 X-MS-Exchange-CrossTenant-AuthSource: DS7PR10MB5117.namprd10.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 25 Jan 2023 17:05:51.5283 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 4e2c6054-71cb-48f1-bd6c-3a9705aca71b X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: ha5phOlvjnGgBhLAySqbvJNKXk915/EAvWTmRJYgAyInj0OhhpdeJsR+f1jG3SjvH8Yj871ueEUk6NAb6XKfPK0w0qmKfxcnxjb6uu8rmaE= X-MS-Exchange-Transport-CrossTenantHeadersStamped: MN2PR10MB4384 X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.219,Aquarius:18.0.930,Hydra:6.0.562,FMLib:17.11.122.1 definitions=2023-01-25_11,2023-01-25_01,2022-06-22_01 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 bulkscore=0 suspectscore=0 malwarescore=0 phishscore=0 mlxlogscore=999 adultscore=0 mlxscore=0 spamscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2212070000 definitions=main-2301250152 X-Proofpoint-GUID: cEHhU-R-nztFGelfKgcaqYl945ldQ-Ei X-Proofpoint-ORIG-GUID: cEHhU-R-nztFGelfKgcaqYl945ldQ-Ei X-Spam-Status: No, score=-2.8 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_LOW, RCVD_IN_MSPIKE_H2,SPF_HELO_NONE,SPF_NONE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1756015360312958258?= X-GMAIL-MSGID: =?utf-8?q?1756015360312958258?= Refactor hugetlbfs_pagecache_present() to avoid getting and dropping a refcount on a page. Use RCU and page_cache_next_miss() instead. Suggested-by: Matthew Wilcox Signed-off-by: Sidhartha Kumar --- mm/hugetlb.c | 16 +++++++--------- 1 file changed, 7 insertions(+), 9 deletions(-) diff --git a/mm/hugetlb.c b/mm/hugetlb.c index 849206e94742..e506a46b7871 100644 --- a/mm/hugetlb.c +++ b/mm/hugetlb.c @@ -5651,17 +5651,15 @@ static vm_fault_t hugetlb_wp(struct mm_struct *mm, struct vm_area_struct *vma, static bool hugetlbfs_pagecache_present(struct hstate *h, struct vm_area_struct *vma, unsigned long address) { - struct address_space *mapping; - pgoff_t idx; - struct page *page; + struct address_space *mapping = vma->vm_file->f_mapping; + pgoff_t idx = vma_hugecache_offset(h, vma, address); + bool present; - mapping = vma->vm_file->f_mapping; - idx = vma_hugecache_offset(h, vma, address); + rcu_read_lock(); + present = page_cache_next_miss(mapping, idx, 1) != idx; + rcu_read_unlock(); - page = find_get_page(mapping, idx); - if (page) - put_page(page); - return page != NULL; + return present; } int hugetlb_add_to_page_cache(struct page *page, struct address_space *mapping,