From patchwork Wed Jun 21 21:24:02 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mike Kravetz X-Patchwork-Id: 13287969 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 88831EB64DC for ; Wed, 21 Jun 2023 21:24:43 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id E152C8D0005; Wed, 21 Jun 2023 17:24:42 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id D9DF58D0002; Wed, 21 Jun 2023 17:24:42 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id B7B498D0005; Wed, 21 Jun 2023 17:24:42 -0400 (EDT) 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 A77938D0002 for ; Wed, 21 Jun 2023 17:24:42 -0400 (EDT) Received: from smtpin27.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay08.hostedemail.com (Postfix) with ESMTP id 64E2D140A3F for ; Wed, 21 Jun 2023 21:24:42 +0000 (UTC) X-FDA: 80928034404.27.4DF43F4 Received: from mx0b-00069f02.pphosted.com (mx0b-00069f02.pphosted.com [205.220.177.32]) by imf05.hostedemail.com (Postfix) with ESMTP id 10EE9100009 for ; Wed, 21 Jun 2023 21:24:38 +0000 (UTC) Authentication-Results: imf05.hostedemail.com; dkim=pass header.d=oracle.com header.s=corp-2023-03-30 header.b=n8DN6QJS; dkim=pass header.d=oracle.onmicrosoft.com header.s=selector2-oracle-onmicrosoft-com header.b=qJ33jvYY; dmarc=pass (policy=none) header.from=oracle.com; spf=pass (imf05.hostedemail.com: domain of mike.kravetz@oracle.com designates 205.220.177.32 as permitted sender) smtp.mailfrom=mike.kravetz@oracle.com; arc=pass ("microsoft.com:s=arcselector9901:i=1") ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1687382679; 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: references:dkim-signature; bh=O3WH09cy02Tz5lMmoi5+5H2UymjU0M6qPSSab2FSvog=; b=i2sxm3+0rH3kEROVBuLcrPOzgB0SbbMWs1GYeNoH9IZJd0iQq/PoUPEC12qxhSpM/f45FV uetprQlHTqGIBvflPAM2bU3eU8FPK6F7k+PIb5SGabxoccpM9nj/CXJFQ5Jr3nJzZC/ngf QVOE6yjkcusNgiCoKRJYzCW1VVvaTdY= ARC-Authentication-Results: i=2; imf05.hostedemail.com; dkim=pass header.d=oracle.com header.s=corp-2023-03-30 header.b=n8DN6QJS; dkim=pass header.d=oracle.onmicrosoft.com header.s=selector2-oracle-onmicrosoft-com header.b=qJ33jvYY; dmarc=pass (policy=none) header.from=oracle.com; spf=pass (imf05.hostedemail.com: domain of mike.kravetz@oracle.com designates 205.220.177.32 as permitted sender) smtp.mailfrom=mike.kravetz@oracle.com; arc=pass ("microsoft.com:s=arcselector9901:i=1") ARC-Seal: i=2; s=arc-20220608; d=hostedemail.com; t=1687382679; a=rsa-sha256; cv=pass; b=M9yNZ4kNXqcHmUUJ5E4xlPbEleNP0tg4Z9PkZujnwJOoiuoKKsJn/w7AUqyhuJLa2cdAZt d+V2B5B+CQaoLyipOrLKD9aRjakPT9o77zgk3XBqPDHVegHee1R0cDZFBpbrTRtKl3m+R8 ugVH7NNRCvuy0n7veJp3Ud7bytKwh/Q= Received: from pps.filterd (m0333520.ppops.net [127.0.0.1]) by mx0b-00069f02.pphosted.com (8.17.1.19/8.17.1.19) with ESMTP id 35LK7dVE010373; Wed, 21 Jun 2023 21:24:11 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oracle.com; h=from : to : cc : subject : date : message-id : content-transfer-encoding : content-type : mime-version; s=corp-2023-03-30; bh=O3WH09cy02Tz5lMmoi5+5H2UymjU0M6qPSSab2FSvog=; b=n8DN6QJSOQAR2fUhXNUrBkO0I44BxRZxp2A7KxuH/NrrXFmg7B25KevJ0Hbkec5muM/0 8zOmCtIeKW4ekLzPDj0s1pSD/5SrM7gduGjxO/XitncsNsQK//OLkIJMO7dXxXskIDdJ 2BzeGqMTI10KOgj5Mxa5T6FMGXAQ3u8qzGl9EOtltmlWJWewNCXZgYgTmb/IT//zPYu7 5elEnmmpbS3tR7GOxmlngQtP1jJCsqJS3SSMXUft3p1Ai4PIV7VhbpZOjP9lLzuP2dBI BTjXasGSEbdgXZLqb1q9RqS9mJVV5pusajuI+J6l3zk9PsIcAo0960YJt2he1lfJ5nZp nA== Received: from iadpaimrmta03.imrmtpd1.prodappiadaev1.oraclevcn.com (iadpaimrmta03.appoci.oracle.com [130.35.103.27]) by mx0b-00069f02.pphosted.com (PPS) with ESMTPS id 3r94vcrnw1-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Wed, 21 Jun 2023 21:24:10 +0000 Received: from pps.filterd (iadpaimrmta03.imrmtpd1.prodappiadaev1.oraclevcn.com [127.0.0.1]) by iadpaimrmta03.imrmtpd1.prodappiadaev1.oraclevcn.com (8.17.1.19/8.17.1.19) with ESMTP id 35LKCVoA005955; Wed, 21 Jun 2023 21:24:10 GMT Received: from nam12-mw2-obe.outbound.protection.outlook.com (mail-mw2nam12lp2044.outbound.protection.outlook.com [104.47.66.44]) by iadpaimrmta03.imrmtpd1.prodappiadaev1.oraclevcn.com (PPS) with ESMTPS id 3r9396d8e0-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Wed, 21 Jun 2023 21:24:09 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=h107+HCt4q0cDwgIp1ck39K2FY4cU7jHwbHq5e5yCTsMBEUFrP/y4ixd/2IUzFdpdfcIM5k+bUH8Gj+/W1n/btcDWEmN2IdyZzTRITJMMfhXGxExNIsSEp0wmB7kCJJNcwFPjkh2szMAVjF1C3YAHqcoEvSenG0SzlwpG//deGH8TqjeZfnnFERT6nTgPwFtT+sHRgu93gNHVAmv3L0BskaFzDuOlh8haWgKr82Ll1pKFG2q+qOyoZvbNeqNRUq3968ac5bRkfq3zM4VFXWwD3ecl2CR2h4AipXilJ213GSobraS2uxa8KhaHZ1w5LU9BtPXKLT4Wz9nfLJb0r5kmQ== 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=O3WH09cy02Tz5lMmoi5+5H2UymjU0M6qPSSab2FSvog=; b=ZvNMUqQ5u//zzVvQ2a80FFhkihfLMTmG+DNus5pCLwUlbdrwUxKzkjIhSjGEFb1eQ4rLI8Llt5iQ7w/zaoJ29PjcPIpmuWBl+4iykNVvw5XoGDC68Wp/OVKThmKwt2pxipI4Uln5CcTkQ2iM+7Q8q3/PyfKxapVKj9VHXW+8Doij438sMHrSrBM2Lyy58PevEi7+dYhpQsuMLH6GcMt2yrkCri+C5uO9eXdw93RDzHYUUCgdVvcCVHO+SBqqQ6WJCwez9DkNYCg88NJcyOvahwsv2emIRu5R5UCHGgQVV+BNqy+Qa/7CENLprKNGUS7zX/eo3qSfw3wlAU47LpIjoQ== 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=O3WH09cy02Tz5lMmoi5+5H2UymjU0M6qPSSab2FSvog=; b=qJ33jvYY22vBKoN/O4yToL8Vkbn6pwzZQ1mqSplLaDTZhZtEGgmjh3f0zfMwQVNDY8NtLt9MDhV3/+JIMfPc5y8IqLIdU/wqvX+9wRE8ANaxgd0jVj0/GA8QK0n+64x0XuWxrjIMwIbAujW2F7HSiKyBW9Set6TuvfY4SificDo= Received: from BY5PR10MB4196.namprd10.prod.outlook.com (2603:10b6:a03:20d::23) by CO1PR10MB4482.namprd10.prod.outlook.com (2603:10b6:303:99::8) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6521.21; Wed, 21 Jun 2023 21:24:07 +0000 Received: from BY5PR10MB4196.namprd10.prod.outlook.com ([fe80::4a17:13b0:2876:97f2]) by BY5PR10MB4196.namprd10.prod.outlook.com ([fe80::4a17:13b0:2876:97f2%7]) with mapi id 15.20.6521.020; Wed, 21 Jun 2023 21:24:07 +0000 From: Mike Kravetz To: linux-kernel@vger.kernel.org, linux-mm@kvack.org, linux-fsdevel@vger.kernel.org Cc: Matthew Wilcox , Ackerley Tng , Sidhartha Kumar , Muchun Song , Vishal Annapurve , Erdem Aktas , Greg Kroah-Hartman , Andrew Morton , Mike Kravetz , kernel test robot Subject: [PATCH 1/2] Revert "page cache: fix page_cache_next/prev_miss off by one" Date: Wed, 21 Jun 2023 14:24:02 -0700 Message-ID: <20230621212403.174710-1-mike.kravetz@oracle.com> X-Mailer: git-send-email 2.41.0 X-ClientProxiedBy: MW4P223CA0017.NAMP223.PROD.OUTLOOK.COM (2603:10b6:303:80::22) To BY5PR10MB4196.namprd10.prod.outlook.com (2603:10b6:a03:20d::23) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: BY5PR10MB4196:EE_|CO1PR10MB4482:EE_ X-MS-Office365-Filtering-Correlation-Id: 7fe5992e-5709-4a82-c7a1-08db729dd8ba X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: ht/Kd1irSBhQPnqv4hGcaI/oA5NUjrZKIkVZBpTFx+8L8wvQaL2f9TBxldjDM5uxffBWK7YIWFyeqyIPKU7gPfysf26H6atMGQ3/TZpj25rePTADv0G3G/uFKbPNSRHynhpZ/J6/q1pE9PXQgZlQ04Ry8TVWGY50QJ49fL1NX6hcGVR2p2+uN5zSjwO/pw40YXu0G7K4zjOuQS2ccePfBivNu9RJoFi1Q+Nu8Bi8JVVGbk70Xfy+tQoSKOr6RCyxeOPuLoQZR+vi5b1qPg/p9Yr6VS8l8ZfoVAilUgx9kAYlJOiuHaMB+kabMHkGNR3FqDN8/Swy73kmPatv3mIwfkoXH64WrOsWfQHfw5LQ3VrMTZr0dyM8UwvIcWwFkMmtqBxhmnHlwUIN2daQN91wng79YHkAgK6zNsr50Eq1zwKr0PhOXLtoZRris//PPJlPKmaFL/B8xbiHY/Z2U6G+J31SyG440z1juh3sGCXtVKwRXuXc5qs19cCi1JgiyNq1xJsoN1zOYfwcfORLu93SOOXQbSalWYHqhcuEjfX+uAk= X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:BY5PR10MB4196.namprd10.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230028)(39860400002)(366004)(396003)(136003)(376002)(346002)(451199021)(36756003)(66476007)(5660300002)(7416002)(44832011)(86362001)(8936002)(8676002)(41300700001)(66556008)(316002)(38100700002)(66946007)(4326008)(1076003)(6486002)(966005)(2906002)(6512007)(26005)(186003)(6506007)(2616005)(54906003)(83380400001)(478600001)(6666004);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-Anti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afl8LRjLX/o0SsAd2OFPVUxh7N9L900XOaNUa/kJBGR478S/gb864pO04RP6bODy0XHATQZ84z20nfAjs5CVmasaHAXTagjyfDbwXUJ0XPwb+XRrSYn1ACaIHaf3sY/bk5b/uZODkMPYuTWMVFOG49vaC+rVn2Wjg/RSvEW4Ogpbx3312oBmWxlpbEmH7r1XU0FL6JCBHd3Jb07G7PMuyU54Ky6Swmpw9oY8zFmFT8Ax/X5mr1BvH4PlVrcYYlU3v2+in0AjVsNtFfOZnWqGkco6Vh0s9Oy1RbQzwLBLlEIXkov6ZbFMNFdOpqB0bFQGAlmVRhxSRqcGOVKH0RTCrolVTOrDMzVAL9HnwkFUHJ6arGtyCBzLntox0iDV31op1J0uWMXnAKiQ/Nw66qaUilPJ2eIZoZMWV5ccCtdT3c6JssRG/kyPyXWGizc5c92+wmbxbmvAz2qEoLVPjvXEZw4e2+i58QRoKdE8nztbRsDSZRBwREGqcB+LMOBAinoMmFF7dSIo1pGHwKZKjibSwD5R+JeOfGLK0OCIFKRsB2h6tFhU+7c70bQBCg== X-OriginatorOrg: oracle.com X-MS-Exchange-CrossTenant-Network-Message-Id: 7fe5992e-5709-4a82-c7a1-08db729dd8ba X-MS-Exchange-CrossTenant-AuthSource: BY5PR10MB4196.namprd10.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 21 Jun 2023 21:24:07.5919 (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: GIafjIq9Ri2oDkIsx2RjP0vuWhpS1pGx1VVTTseB7e+6Is7DnkMHqhl+ftcpjrVS1VEjq0CCoPLtrN1D4uWqZA== X-MS-Exchange-Transport-CrossTenantHeadersStamped: CO1PR10MB4482 X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.254,Aquarius:18.0.957,Hydra:6.0.591,FMLib:17.11.176.26 definitions=2023-06-21_12,2023-06-16_01,2023-05-22_02 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 mlxlogscore=999 adultscore=0 spamscore=0 bulkscore=0 malwarescore=0 phishscore=0 mlxscore=0 suspectscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2305260000 definitions=main-2306210179 X-Proofpoint-GUID: n8wHBff92JPazWMLDH-zx09PmdlSh2AL X-Proofpoint-ORIG-GUID: n8wHBff92JPazWMLDH-zx09PmdlSh2AL X-Rspamd-Queue-Id: 10EE9100009 X-Rspam-User: X-Rspamd-Server: rspam04 X-Stat-Signature: 6myr6kdgq5i7rtq9s6zsac88ic81x68m X-HE-Tag: 1687382678-828714 X-HE-Meta: U2FsdGVkX19HLTqVK692E+Y+lQQutQiw6sJ0ykIooL1Recz0KhxDdaiee39xq0ch+2h8WWHSewca5b1Q/3CxxGoQCtKg2OGUGquRsmPrIn4NpfHHto+ejxPr4BIW7Uq6i8PpW6eT85O0hphTwopTek/HifrqqEn+yNi+hSOGalyfWoX02Uu7O7uWNlkq7vYqkXFC5c60Ywf9BlZLiPgjfrMORSL6/pa25Ez+SjFveV7SjH/00lBrp79cZwCqBs7lfpIpmky22XQXV3WBBgybkMoa3Xvq00ZtARoXvObdUVR0fwz/+hNynsgbIkHGyy3FsD0ucGZltV7egKslRATWkP7wtg8cebOGbdtGoH/SwdpxVw+C9HB2RQj3rYCRH/HO61JIjjpLmmpA/LJKGEGoDebCnX5VJMrrH7NHXJXOiwY+0R7GXPqZzRaebvX+SRZlJF0dJMymGLX4v7Rr09CYHlLfcKtMGkAd0HtMRrnSoLWoZhrTH8WzsinOuTsLpclbdSGWXtRB4M9S3GgrRxTKfK5q9u252XnO7lFd2h/RUeqjevR7oA2NXWaUXxESv0/1NwUnaZ0pNr5281eIQ+tx/HCvV3290NpXSOhgGClukt53lFTCEnq0QU6osfxhcTsGSl8AKG4KNl2jrJpNhqOLyR/Wt/29bYIZSsc+LRk1TpfKZDDQI5NHqd8/aSTtAVnJFuQrdu3rz6c4dEuqH2htBNEI48OVu1ylPz3WrRM0pzsmpE6xyXZOx6ix3teOjiU6aSaFwPNA50CJ6VQBonQ9EuPqC25Xb2GwiDu7pnWbTKmDR4RUFQ5GTjlbmR15OzfiL20mvIiQVX4SoOyxeH1oLAu4RYFYUgZD5jXL66X+Ssk5JxSoow133XbSpjQs+oGEfnhhha1ar87/4VN4k2gVwrd1olUkYlvU9Y83796tmjUqSX6qAynWx/9hspEA6cERF88szvxQwnXrmbV4CsU S6PNMY5z WQjBFQgR8ZTwkhmI/Iq3bBl910MUut0bolwQfruG4SJefHlCtNr0GEoEp4ZbioVhgrA3Z+CnuVGWOUWT61zqDz2+/qBIaXGEtZKEJhpvPSu3mfiMkUjPxkgZy5m42fyIh/hiQUsh3575D1jlfgY8Bi3I46i7dKr07tv5uIVoM7XymI+j32LYqjL0NgQOdqCKRobczLoihvGXy8y/Eegmn3j4QeB4HNs5Ny9EjSPhUp++jcoq89txRiAdsro7L+sP2bmQS7xQ0d09ep7yDJjg+b255kKBiK+A4t3RJcqtS6Mtaz7vTHT+Hd/KcGWtff6L8QZN+qZUIRxAtdT/SqAcEkusXdrwZD7kkeMgwU+YpIMECuPg3XzCi4tZnUMu/DheqwLNfCah++ZMAbg3kZAIsmW5OiDc/AB5g19dcleGjd5vp000P/mXE/qmz+P5n96kDfENUjnHfefC2UXc9rRA2x7I4jnOP1HKxUkpQ6qhsa9fbgwRIV82ezYtDapkTSgE1R2eP X-Bogosity: 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: This reverts commit 9425c591e06a9ab27a145ba655fb50532cf0bcc9 The reverted commit fixed up routines primarily used by readahead code such that they could also be used by hugetlb. Unfortunately, this caused a performance regression as pointed out by the Closes: tag. The hugetlb code which uses page_cache_next_miss will be addressed in a subsequent patch. Reported-by: kernel test robot Closes: https://lore.kernel.org/oe-lkp/202306211346.1e9ff03e-oliver.sang@intel.com Fixes: 9425c591e06a ("page cache: fix page_cache_next/prev_miss off by one") Signed-off-by: Mike Kravetz Reviewed-by: Sidhartha Kumar --- mm/filemap.c | 26 ++++++++++---------------- 1 file changed, 10 insertions(+), 16 deletions(-) diff --git a/mm/filemap.c b/mm/filemap.c index 3b73101f9f86..9e44a49bbd74 100644 --- a/mm/filemap.c +++ b/mm/filemap.c @@ -1728,9 +1728,7 @@ bool __folio_lock_or_retry(struct folio *folio, struct mm_struct *mm, * * Return: The index of the gap if found, otherwise an index outside the * range specified (in which case 'return - index >= max_scan' will be true). - * In the rare case of index wrap-around, 0 will be returned. 0 will also - * be returned if index == 0 and there is a gap at the index. We can not - * wrap-around if passed index == 0. + * In the rare case of index wrap-around, 0 will be returned. */ pgoff_t page_cache_next_miss(struct address_space *mapping, pgoff_t index, unsigned long max_scan) @@ -1740,13 +1738,12 @@ pgoff_t page_cache_next_miss(struct address_space *mapping, while (max_scan--) { void *entry = xas_next(&xas); if (!entry || xa_is_value(entry)) - return xas.xa_index; - if (xas.xa_index == 0 && index != 0) - return xas.xa_index; + break; + if (xas.xa_index == 0) + break; } - /* No gaps in range and no wrap-around, return index beyond range */ - return xas.xa_index + 1; + return xas.xa_index; } EXPORT_SYMBOL(page_cache_next_miss); @@ -1767,9 +1764,7 @@ EXPORT_SYMBOL(page_cache_next_miss); * * Return: The index of the gap if found, otherwise an index outside the * range specified (in which case 'index - return >= max_scan' will be true). - * In the rare case of wrap-around, ULONG_MAX will be returned. ULONG_MAX - * will also be returned if index == ULONG_MAX and there is a gap at the - * index. We can not wrap-around if passed index == ULONG_MAX. + * In the rare case of wrap-around, ULONG_MAX will be returned. */ pgoff_t page_cache_prev_miss(struct address_space *mapping, pgoff_t index, unsigned long max_scan) @@ -1779,13 +1774,12 @@ pgoff_t page_cache_prev_miss(struct address_space *mapping, while (max_scan--) { void *entry = xas_prev(&xas); if (!entry || xa_is_value(entry)) - return xas.xa_index; - if (xas.xa_index == ULONG_MAX && index != ULONG_MAX) - return xas.xa_index; + break; + if (xas.xa_index == ULONG_MAX) + break; } - /* No gaps in range and no wrap-around, return index beyond range */ - return xas.xa_index - 1; + return xas.xa_index; } EXPORT_SYMBOL(page_cache_prev_miss); From patchwork Wed Jun 21 21:24:03 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mike Kravetz X-Patchwork-Id: 13287968 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 7B8DBEB64D7 for ; Wed, 21 Jun 2023 21:24:41 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id D2B1B8D0003; Wed, 21 Jun 2023 17:24:40 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id CB31D8D0002; Wed, 21 Jun 2023 17:24:40 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id B070A8D0003; Wed, 21 Jun 2023 17:24:40 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0014.hostedemail.com [216.40.44.14]) by kanga.kvack.org (Postfix) with ESMTP id 9B4E18D0002 for ; Wed, 21 Jun 2023 17:24:40 -0400 (EDT) Received: from smtpin12.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay02.hostedemail.com (Postfix) with ESMTP id 61F86120867 for ; Wed, 21 Jun 2023 21:24:40 +0000 (UTC) X-FDA: 80928034320.12.4D201C9 Received: from mx0b-00069f02.pphosted.com (mx0b-00069f02.pphosted.com [205.220.177.32]) by imf28.hostedemail.com (Postfix) with ESMTP id DB716C000F for ; Wed, 21 Jun 2023 21:24:36 +0000 (UTC) Authentication-Results: imf28.hostedemail.com; dkim=pass header.d=oracle.com header.s=corp-2023-03-30 header.b=uVjqLnF+; dkim=pass header.d=oracle.onmicrosoft.com header.s=selector2-oracle-onmicrosoft-com header.b=HtkTpF02; dmarc=pass (policy=none) header.from=oracle.com; arc=pass ("microsoft.com:s=arcselector9901:i=1"); spf=pass (imf28.hostedemail.com: domain of mike.kravetz@oracle.com designates 205.220.177.32 as permitted sender) smtp.mailfrom=mike.kravetz@oracle.com ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1687382677; 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=QDEMuUJ+6lnBEGBCfZ8J5uE9zWyrVmNPnhHI85BkBA4=; b=iD3DXWeF7HpF5IyEgFhjhyfDnGPad5LMIka1g9xe/YTP2xlr9PBPq3Y0aRo1gjt7zhc7Y9 wOH3iZUVn+sdNRMz/K2vEDuQC/REcW0EOwKRkruYCy7cDiHkzECYOLXCfblUObN+DbrnIX 6UsbIscuQMfVt7+yhrrGbDsNWUzceTA= ARC-Authentication-Results: i=2; imf28.hostedemail.com; dkim=pass header.d=oracle.com header.s=corp-2023-03-30 header.b=uVjqLnF+; dkim=pass header.d=oracle.onmicrosoft.com header.s=selector2-oracle-onmicrosoft-com header.b=HtkTpF02; dmarc=pass (policy=none) header.from=oracle.com; arc=pass ("microsoft.com:s=arcselector9901:i=1"); spf=pass (imf28.hostedemail.com: domain of mike.kravetz@oracle.com designates 205.220.177.32 as permitted sender) smtp.mailfrom=mike.kravetz@oracle.com ARC-Seal: i=2; s=arc-20220608; d=hostedemail.com; t=1687382677; a=rsa-sha256; cv=pass; b=X3ritBA7SUTqE5aeZYl+d6LqFHADxKyWL1mNI+Yq65JUi0Dj/Qn7c4FclGn8mbUxC0b2Fm wL5sa7C0Zr7siuCO93+vbXm1JrzMlOpiwfEpprYEfnpCoHb/vWZAUq37XlEomUlSsX3mWK fluZMW9+I2twolGeBy+bvR8PiYR8JiM= Received: from pps.filterd (m0246632.ppops.net [127.0.0.1]) by mx0b-00069f02.pphosted.com (8.17.1.19/8.17.1.19) with ESMTP id 35LK8wm2030299; Wed, 21 Jun 2023 21:24:14 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-2023-03-30; bh=QDEMuUJ+6lnBEGBCfZ8J5uE9zWyrVmNPnhHI85BkBA4=; b=uVjqLnF+Wp0WRR7/25dviap71a4eiV16te2CLf5cBrqsNQoZFl0fAKOccgVKSkJuKkEO hD47o7AdDL9Wbc7dUYQyCa+6PZ6an1MsKhJVaAuE72ZX01Hl/bBHxr1jwk5udC4kmqMO 4Bg3QFrk3ytZqbhncZdA6bkSXIEwGwno9O9xWEPNp3y3sv9ODAOI3/rtMQEdgwgZr6ta snL8V3yoNZPl64GBztOWYfnNvr2ILkqvYO1UulF6OdRNj+rnkmcbHFfXFgwMN1bL+LLX kxdY+Ha+qWbH57l+PEh+A3gXzPojqS0mNJdXfvLRRweDcjZaxDMPDmdJ0h1/xpDLx/AG vA== Received: from phxpaimrmta03.imrmtpd1.prodappphxaev1.oraclevcn.com (phxpaimrmta03.appoci.oracle.com [138.1.37.129]) by mx0b-00069f02.pphosted.com (PPS) with ESMTPS id 3r94etrjqb-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Wed, 21 Jun 2023 21:24:14 +0000 Received: from pps.filterd (phxpaimrmta03.imrmtpd1.prodappphxaev1.oraclevcn.com [127.0.0.1]) by phxpaimrmta03.imrmtpd1.prodappphxaev1.oraclevcn.com (8.17.1.19/8.17.1.19) with ESMTP id 35LKELAU008401; Wed, 21 Jun 2023 21:24:13 GMT Received: from nam10-mw2-obe.outbound.protection.outlook.com (mail-mw2nam10lp2107.outbound.protection.outlook.com [104.47.55.107]) by phxpaimrmta03.imrmtpd1.prodappphxaev1.oraclevcn.com (PPS) with ESMTPS id 3r9396vuvy-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Wed, 21 Jun 2023 21:24:13 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=WJ6MWvijPBTCHzxpntXqA1PktqdPydCCanpE/kv0ehJzSwUUnjfpqUX7lCiApzjQbaMhSaUKwpi7ViPdrLc3a5rCZw4XajOzaH5cKCSPrBSOlgozlSUp3Q9kZn9UowC8LBK1nK4ie0j9bYsthVjxKz9mJGVUF7VCOzMdJ19R1gy0Gu29f5AJkRGAlvCMA10iG0p1mgRleGWA1cx8yXZzBdEul2y+O8/V7ut/0HsW0ZEWjGOu6kem40P58Um/Ofe8G2hneUCsNwSZ3okiuWIT4sG4iXnaMvt9JN9tV6nWeH95DZYNaijjigSf7P5v+pra8z78WfASACakGl5VBH075g== 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=QDEMuUJ+6lnBEGBCfZ8J5uE9zWyrVmNPnhHI85BkBA4=; b=Wr/uofxDr/lAxIo/j+zHyu0lPNrHVQSV4FIaI4lUxAoOxQT0VLPbOR7xtWwOc2bSw+hOp+1wwghheQpQFv9oXYdhl/k2FmO6vBTv8Ogke9/VOpwQB3e6k93v3jchQ25Xck/0eKyeT5FE8Qux6pvMLVcJRgQH7e0zlFhmNPVUK3sjWkj3UZNb0XyhMarLynCmtF9wFLS+XsK+ypzO90Pm5gWJDcR1P/J0vbmZ9EVFoAXNKxvghVvaqoqrKeyW9TkRrgJz0e8egPfomv1z09Wl5AAR6LSW72+mh8JUCdYKMtlEvXQkWxzOKsNrrAnbujQbiG1WMyt7PpFbRGTs9AavTw== 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=QDEMuUJ+6lnBEGBCfZ8J5uE9zWyrVmNPnhHI85BkBA4=; b=HtkTpF02I1uWyKWQSx9D9gSA6B2lf6rHGlCRy27X744yTR0f22nl7/7vZUhlNjyO2o6kS2JdV0UDEptL1Y78HOa6ELXPhCLG+S9Wkavs6zTjE2Eyd/B4i3t5+uWiiG93XJ/GCj7kDRtK31RW6zPN0HEhRNyy4nqGzHno7SaL1iQ= Received: from BY5PR10MB4196.namprd10.prod.outlook.com (2603:10b6:a03:20d::23) by IA1PR10MB6220.namprd10.prod.outlook.com (2603:10b6:208:3a3::6) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6500.35; Wed, 21 Jun 2023 21:24:10 +0000 Received: from BY5PR10MB4196.namprd10.prod.outlook.com ([fe80::4a17:13b0:2876:97f2]) by BY5PR10MB4196.namprd10.prod.outlook.com ([fe80::4a17:13b0:2876:97f2%7]) with mapi id 15.20.6521.020; Wed, 21 Jun 2023 21:24:10 +0000 From: Mike Kravetz To: linux-kernel@vger.kernel.org, linux-mm@kvack.org, linux-fsdevel@vger.kernel.org Cc: Matthew Wilcox , Ackerley Tng , Sidhartha Kumar , Muchun Song , Vishal Annapurve , Erdem Aktas , Greg Kroah-Hartman , Andrew Morton , Mike Kravetz Subject: [PATCH 2/2] hugetlb: revert use of page_cache_next_miss() Date: Wed, 21 Jun 2023 14:24:03 -0700 Message-ID: <20230621212403.174710-2-mike.kravetz@oracle.com> X-Mailer: git-send-email 2.41.0 In-Reply-To: <20230621212403.174710-1-mike.kravetz@oracle.com> References: <20230621212403.174710-1-mike.kravetz@oracle.com> X-ClientProxiedBy: MW4PR04CA0147.namprd04.prod.outlook.com (2603:10b6:303:84::32) To BY5PR10MB4196.namprd10.prod.outlook.com (2603:10b6:a03:20d::23) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: BY5PR10MB4196:EE_|IA1PR10MB6220:EE_ X-MS-Office365-Filtering-Correlation-Id: 5e90415c-bee0-4b01-7404-08db729ddaa3 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: MzgimsWW/T+oPqS4bO7F+6cLVET+SkVsJzrlTm/7G/uXFK/Rm4ecRyiWKCr8Z0pwqNrx+bAhXH8UMKB5XQsqG8qGB5a924OSej/nBHeMX8EfBBQB1ktB2g9s/utU9OuEXVjpBspfYpYPxkz6PmI6OXNntRTajR3WlUIYCmnTQW63SFBmR2D3mBgHWViXu37Kl/pUdqzavptOo85+i5a5cVMRoaUd3CFxTmYS2dg3CYhAEr7d8BGRTDEkm6qZjP2PtDWK728kB/rXoDeg8RH6ZEc71jL1+h+sC0MTgtngKuzQkmLycVIHi4BEuS2425MdbOrRsL4MSRMqupYPNPiHu50dcEqJrnW+Xez5whY8buny9zqYDkvVob58vnkJE5X7ZTb9ivC3ArQ42ykVr6YOprHG6H0oE8eEfXsStNbX5X8o9ZhpLD+KnHMJI8pWrPa2bNW7BtdE40MOLSC0KACGrFagIj0vCdyfgAIqHjgE7TvcWUgN2rhPOFRMivDkF1QfAbxIyohQFn/0FGO1PaeJQrbRSl1EhaPj62BYWJWQRZs= X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:BY5PR10MB4196.namprd10.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230028)(39860400002)(396003)(366004)(346002)(136003)(376002)(451199021)(38100700002)(36756003)(86362001)(966005)(478600001)(6666004)(107886003)(6512007)(8676002)(1076003)(6486002)(26005)(8936002)(6506007)(186003)(44832011)(54906003)(5660300002)(2906002)(66556008)(41300700001)(4326008)(66476007)(66946007)(7416002)(316002)(2616005)(83380400001);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: 0HnVqi2U2saheiiNLIzqeoRiHr/6e67oP3DfETxDfhDWqZ/Vx7G+R5CBTnoKnRFOBTuWYmBUByg7hcqta9gwq67VHLlLnqmuJyoowNrg9lHjtQ4b1Oym9erizwKDH5snVAxG/qrdUmM4HmQ48e24x0swSVqIENqdZLEMzn0UHz3W2z8aTE+GOEkDeGurH1dnJj6xRrxiCnalh+GYK1cuc9nA1sMV/EdbLGMQ9wr6ea5tXKow+7aE1VBTapsHyc6nbk6hrmaanE7mWEmPBMQ/pkRGQCdTMBuMNo03hmJbbFF9pnQvm1NhvOjmZPkT2DB6hXvIuXyuX5BC8erfzv034X9R3IipWHY6C0wUGE1NJizazPtZvi1vMccExLPh36xtAnZr+t5dIco5pv5m3Ix69kqnM/21fSQwpu6JDkOsaqSDeMEKPW8dG1Sc/LCfT+uwb4T2qZQoOKKZZGflXp646Q8n0jQuOakKrPUxZ2wJ3JdwEU93uusRpaSB+GqrFMSGiwVqGTuuhsR6knn0xFeoA7QsCeCfFugsp+8YSdy4B7qEryH3fIpD/BUjcwbD+FA0sPrjynt3fkGWhzYvGKteGirZcTQzSJ3M4+yW9XzWb3rFNM2neMagQUI/UGo/uzNgWWCyKEXpKzZ+Z+YsbeDVVigPcewR4aLvCVinq0Gy+shaqqAPa6PUjv+/aS3eBZbpxPd0C5of//b97d8mKyHXBWgMqBWKZaZwcMvu9WXMj98SVSHVd0Llleyjg5tVFzwxSKzcD3is8o1+krGy1xRFYOTr3NzRFjMOBnJIw4sVF3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lWhkHolWXtqm8T8vDm6tkaxuH26mnY7RKYaKtvAMiJT0LdldDT7f5wDBhYsQM9vi6KrvshmC07Mi2uo/O9+td7GfH4Bb5g9hXP+NTQ6pefe18ppK0r4Da0MDDdt6At1V+qz8oiKLGK7TzDTWUxG6tvNPeiN+u6+scBeG2ymQPACmC5L6QKNj+vz4e/SVHKJ7Q6HzemxNXyeCGQIKTC0hVuwT1WwOnBosghuK/GeVCnRcvNVpcikMmUXQ5+ElYxkiDaC+tAXWbORgO3uavdvOoUKPeHUu6zKnCx6ERnCFKoO9UDmVuQdl1+Px5yXOJXLy4xygUmIF7wf77+FkY082ulNO6jf+E+FmKwhqovwbXfi5+7P8oSXlVAbP5QTtz5wTj3vEA96yTUlGij8QVm1Maw6MNVLOzUFkIgpXzgjAzpIgGZEF5BxdoEqfhecDROA7pFdDN/Tuzu8h69gA585QROOxJhbWB09B00d6FxkfCcTfj82Vq42F1NyJRv1mV5s5YqPEwwpplsraQFaxru691s7JrQtE/oId8jyxO1a2Zuqesj6P1jmHMVRfWxsTn396QXSlPCGDTSOc6nDEjlfSsMBKxHoUv/Gnv/qXknjE1g71LKFCKvWZBvjpE+iSunnNYrcT0mX4hpKPZzt2I2zaN/n/xGgiZPmJuBjjkkjLNd0rzBhZVtu6JeUwOrjlbCvbFdHyvQepkSUfz9KOc9Kjlsrmh63tKsRlK36GzLY0Kbcu/H1LRTzImkcSNojkNpLKYZjRRdLi3LrYlrg5euswPkm9vYdGXsO7HE6k2SHTILslKk3+hQ3WFouTYTzBduH+ X-OriginatorOrg: oracle.com X-MS-Exchange-CrossTenant-Network-Message-Id: 5e90415c-bee0-4b01-7404-08db729ddaa3 X-MS-Exchange-CrossTenant-AuthSource: BY5PR10MB4196.namprd10.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 21 Jun 2023 21:24:10.7832 (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: 09CvwoHW/gih74KT8jQ7q76+Ucxfc5u8rPKEBFzK1MXjYcySib3vC0KonNNBp5DXaFSRiBSt9OyBXvPH5CIKFw== X-MS-Exchange-Transport-CrossTenantHeadersStamped: IA1PR10MB6220 X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.254,Aquarius:18.0.957,Hydra:6.0.591,FMLib:17.11.176.26 definitions=2023-06-21_12,2023-06-16_01,2023-05-22_02 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 mlxlogscore=831 adultscore=0 spamscore=0 phishscore=0 suspectscore=0 malwarescore=0 bulkscore=0 mlxscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2305260000 definitions=main-2306210179 X-Proofpoint-GUID: yWqJdaBS1xb_N7XkrjFbud3Ne_FGkKHq X-Proofpoint-ORIG-GUID: yWqJdaBS1xb_N7XkrjFbud3Ne_FGkKHq X-Rspamd-Queue-Id: DB716C000F X-Rspam-User: X-Rspamd-Server: rspam05 X-Stat-Signature: wdbgnu5xesseo8i549iznbkpq3wsqya5 X-HE-Tag: 1687382676-103890 X-HE-Meta: U2FsdGVkX18XOTWyIv+DN6IkYlLCsbHhGhiJb8ynMn2B/o52GC320qzZi3GLENLZIOKwEzcvdaSu2o0qcP5DQs8D6DH/WEJ6jazHnrjv6SHv+RIB6cd5gkWKt4fkiWhLAUoCRO8v9l15X3fxBF3k2l2T6Uq6tlk6mcgh29GJJ8zH0PbIPgfVYwxcR9z/8qzyjZ9cSMZxZRaZdiCiyWIeD2Aaxh+iZxRc8dIH9qzQwo8jwsBFCL3Res+7iikm42JMWuKO0nthusqNSgLcZrbyZRCmK1J9GhWL4yB8Exl0AmS2jkswU0SNVr8ccC4Q5BsGKgMCx69Y3aumebAVSWELNbI23GCqUB6VJaFY9j/Bu4noQ8M+p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yBm8LCa5EHNmMUkY+cmNRxZnSufLDrLq24pg0lfQ3JwvyAz5kHE+ X-Bogosity: 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: Ackerley Tng reported an issue with hugetlbfs fallocate as noted in the Closes tag. The issue showed up after the conversion of hugetlb page cache lookup code to use page_cache_next_miss. User visible effects are: - hugetlbfs fallocate incorrectly returns -EEXIST if pages are presnet in the file. - hugetlb pages will not be included in core dumps if they need to be brought in via GUP. - userfaultfd UFFDIO_COPY will not notice pages already present in the cache. It may try to allocate a new page and potentially return ENOMEM as opposed to EEXIST. Revert the use page_cache_next_miss() in hugetlb code. IMPORTANT NOTE FOR STABLE BACKPORTS: This patch will apply cleanly to v6.3. However, due to the change of filemap_get_folio() return values, it will not function correctly. This patch must be modified for stable backports. Fixes: d0ce0e47b323 ("mm/hugetlb: convert hugetlb fault paths to use alloc_hugetlb_folio()") Reported-by: Ackerley Tng Closes: https://lore.kernel.org/linux-mm/cover.1683069252.git.ackerleytng@google.com Signed-off-by: Mike Kravetz Reviewed-by: Sidhartha Kumar --- fs/hugetlbfs/inode.c | 8 +++----- mm/hugetlb.c | 11 +++++------ 2 files changed, 8 insertions(+), 11 deletions(-) diff --git a/fs/hugetlbfs/inode.c b/fs/hugetlbfs/inode.c index 90361a922cec..7b17ccfa039d 100644 --- a/fs/hugetlbfs/inode.c +++ b/fs/hugetlbfs/inode.c @@ -821,7 +821,6 @@ static long hugetlbfs_fallocate(struct file *file, int mode, loff_t offset, */ struct folio *folio; unsigned long addr; - bool present; cond_resched(); @@ -842,10 +841,9 @@ static long hugetlbfs_fallocate(struct file *file, int mode, loff_t offset, mutex_lock(&hugetlb_fault_mutex_table[hash]); /* See if already present in mapping to avoid alloc/free */ - rcu_read_lock(); - present = page_cache_next_miss(mapping, index, 1) != index; - rcu_read_unlock(); - if (present) { + folio = filemap_get_folio(mapping, index); + if (!IS_ERR(folio)) { + folio_put(folio); mutex_unlock(&hugetlb_fault_mutex_table[hash]); continue; } diff --git a/mm/hugetlb.c b/mm/hugetlb.c index d76574425da3..cb9077b96b43 100644 --- a/mm/hugetlb.c +++ b/mm/hugetlb.c @@ -5728,13 +5728,12 @@ static bool hugetlbfs_pagecache_present(struct hstate *h, { struct address_space *mapping = vma->vm_file->f_mapping; pgoff_t idx = vma_hugecache_offset(h, vma, address); - bool present; - - rcu_read_lock(); - present = page_cache_next_miss(mapping, idx, 1) != idx; - rcu_read_unlock(); + struct folio *folio; - return present; + folio = filemap_get_folio(mapping, idx); + if (!IS_ERR(folio)) + folio_put(folio); + return folio != NULL; } int hugetlb_add_to_page_cache(struct folio *folio, struct address_space *mapping,