From patchwork Fri Jun 9 19:49:46 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sidhartha Kumar X-Patchwork-Id: 13274336 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 3AA4EC7EE37 for ; Fri, 9 Jun 2023 19:50:31 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id A6AD28E0002; Fri, 9 Jun 2023 15:50:29 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 9ECDB8E0007; Fri, 9 Jun 2023 15:50:29 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 692F08E0006; Fri, 9 Jun 2023 15:50:29 -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 56D2A8E0002 for ; Fri, 9 Jun 2023 15:50:29 -0400 (EDT) Received: from smtpin28.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay06.hostedemail.com (Postfix) with ESMTP id A1B4AAF222 for ; Fri, 9 Jun 2023 19:50:27 +0000 (UTC) X-FDA: 80884251294.28.225F40D Received: from mx0b-00069f02.pphosted.com (mx0b-00069f02.pphosted.com [205.220.177.32]) by imf25.hostedemail.com (Postfix) with ESMTP id 1E1A3A0008 for ; Fri, 9 Jun 2023 19:50:23 +0000 (UTC) Authentication-Results: imf25.hostedemail.com; dkim=pass header.d=oracle.com header.s=corp-2023-03-30 header.b=PfBrWxx0; dkim=pass header.d=oracle.onmicrosoft.com header.s=selector2-oracle-onmicrosoft-com header.b=c1q8gFze; dmarc=pass (policy=none) header.from=oracle.com; arc=pass ("microsoft.com:s=arcselector9901:i=1"); spf=pass (imf25.hostedemail.com: domain of sidhartha.kumar@oracle.com designates 205.220.177.32 as permitted sender) smtp.mailfrom=sidhartha.kumar@oracle.com ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1686340224; 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=SKlyEay909XiOp9za551/Rxv5Re8HmEauyeuNp38JPs=; b=zMJVkjLjUr5Q8XueRDN7kgz4kTikd+PysvyE6ZvJ+GjaNvh3s8sAM4Gxf11bXPUrWY83pY QeoI2Stk1ldf7lzSbsqTLb1XYQwMQNIdLetRRej9dSqB+1IINt2rSoPy++0qGeSiQFvZ6e f4FY0ucLxpUayPvrY63zyORYVcAsNWM= ARC-Authentication-Results: i=2; imf25.hostedemail.com; dkim=pass header.d=oracle.com header.s=corp-2023-03-30 header.b=PfBrWxx0; dkim=pass header.d=oracle.onmicrosoft.com header.s=selector2-oracle-onmicrosoft-com header.b=c1q8gFze; dmarc=pass (policy=none) header.from=oracle.com; arc=pass ("microsoft.com:s=arcselector9901:i=1"); spf=pass (imf25.hostedemail.com: domain of sidhartha.kumar@oracle.com designates 205.220.177.32 as permitted sender) smtp.mailfrom=sidhartha.kumar@oracle.com ARC-Seal: i=2; s=arc-20220608; d=hostedemail.com; t=1686340224; a=rsa-sha256; cv=pass; b=eMXmq109LLTBC1KfiI4KJv3HeHH9thmot7ZvFCqudmU2s4ri+a6jqNB1QrJ9MrOrZ/tEoM LQG3zwvxX3Mg6oDitrqHLBQ2+dN+pdmPlfceOnempmt0HFXT/eUSno9vc9okyREFNjKgr2 VcxAyEAXsVIjaFuXiPwR6cq14U5B5oY= Received: from pps.filterd (m0246630.ppops.net [127.0.0.1]) by mx0b-00069f02.pphosted.com (8.17.1.19/8.17.1.19) with ESMTP id 359IIPgu008829; Fri, 9 Jun 2023 19:49:57 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=SKlyEay909XiOp9za551/Rxv5Re8HmEauyeuNp38JPs=; b=PfBrWxx0EfBwvNGEXGljIb/UILwln8D8sEK6iGkQ3mxsLHNFo5VxhF//3gubfnwcordr VnHh3c5vhHJwF2HRZtgHyTOfmW1pIhnil2tmfBkeNRlScIF1hdwu7iDJ1bHgAyMtz4K4 NOU2LJjG8d/Pmk5GGKaYe3M8yDPNYY50PdZNpQs+zW9b21zr1T5w1eF97TnQ84IPosVD 9Sb38hLn+mSB53NHl0piQc4Rbcf/0UBPrv0AijsAyipX+NJazkprOG5gxFb4g0oQQWbp PbZvmYQx2DkV/i8pHjZPJQ7YjAiGymHZq9536axzaXnng2Y1X6uiDuqo5JUBYSdHP7NK 3g== Received: from iadpaimrmta02.imrmtpd1.prodappiadaev1.oraclevcn.com (iadpaimrmta02.appoci.oracle.com [147.154.18.20]) by mx0b-00069f02.pphosted.com (PPS) with ESMTPS id 3r2a6ufee6-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Fri, 09 Jun 2023 19:49:57 +0000 Received: from pps.filterd (iadpaimrmta02.imrmtpd1.prodappiadaev1.oraclevcn.com [127.0.0.1]) by iadpaimrmta02.imrmtpd1.prodappiadaev1.oraclevcn.com (8.17.1.19/8.17.1.19) with ESMTP id 359IbKFB010507; Fri, 9 Jun 2023 19:49:57 GMT Received: from nam11-bn8-obe.outbound.protection.outlook.com (mail-bn8nam11lp2168.outbound.protection.outlook.com [104.47.58.168]) by iadpaimrmta02.imrmtpd1.prodappiadaev1.oraclevcn.com (PPS) with ESMTPS id 3r2a6tm8u1-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Fri, 09 Jun 2023 19:49:56 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=LySd5CMLFhUciSV0iiO9/Fcm6zuuQgZFAJUEeTDYQD8SSyRq4C/X13qErvZ+2MngjCVPyGRgWLpv+cyiOSbquFhgqgtSFErGrpFzt5sPW4GJlhgX5Eg9Azj4eAjKRgFzZV1wqTPW4kBarLDyopzKCcGo1wbWTvHIAHN5lpXaW5zVSawfmwBxIZAB/dhaUVdvXAY84zp8kYFChi/c+6G+VswSZ6nsRVYhfycHEM8GzIANGa4vRLg7bgLiryA4FCqtf/cunswTlgdHzc9M+aVs340MNUWx6F2hCDrPjZLlPj0LzlalkwnCkwjK9pbQNphIK76eW9zlZt0AhYT5s3JSzQ== 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=SKlyEay909XiOp9za551/Rxv5Re8HmEauyeuNp38JPs=; b=OTBBaxqzh0+6ELfVQnYwanjkSGFC1k1vXrcCbP0wJY82vfBch8azbin1DZqtiwo1IiuAaO7Yl/KbVoPxHCGTt2EZ5Hn8w1xRLtN4ak1gsAl2ud4eQoSl8GpH4piZ9eIFWP35BS5bYg52pN/t1OK6TXkFDZDvwp3XnqZKh3sYaMMQeyM/PcZubnoWMIANRGgSqvFpxiGJBDhR28IDjuzR37zyE7G19BQ/3jCKnWDS8Gc1jQgzedxq04pBASM0dEtYidQgTLzrprHXy4FWvT09ENxl7VP26t2Dx+cFOh4PLiuXBnbp30vN8BiICu2VMVU0xPdMQwzPME9z/fpHygev4A== 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=SKlyEay909XiOp9za551/Rxv5Re8HmEauyeuNp38JPs=; b=c1q8gFzeknErgfRaJs1c8bkh2PTM1aZLWM/ACdR/m7dxJyz07THo/eHajJbdp3NP6X2+CDyM5W0VdVDl4qUR8bXRkodmNxC0FCr4Bvjjn1c7Yq47lvIC1zehM0k1pVbdy9uibpYS6M5GQA6JEDhNl3LXatUN4wEvyFQ12y2ol24= Received: from CH0PR10MB5113.namprd10.prod.outlook.com (2603:10b6:610:c9::8) by CYYPR10MB7651.namprd10.prod.outlook.com (2603:10b6:930:bc::8) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6455.33; Fri, 9 Jun 2023 19:49:55 +0000 Received: from CH0PR10MB5113.namprd10.prod.outlook.com ([fe80::d9c0:689a:147b:ced5]) by CH0PR10MB5113.namprd10.prod.outlook.com ([fe80::d9c0:689a:147b:ced5%4]) with mapi id 15.20.6455.030; Fri, 9 Jun 2023 19:49:55 +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, david@redhat.com, nphamcs@gmail.com, jthoughton@google.com, Sidhartha Kumar Subject: [PATCH 1/2] mm/filemap: remove hugetlb special casing in filemap.c Date: Fri, 9 Jun 2023 12:49:46 -0700 Message-Id: <20230609194947.37196-2-sidhartha.kumar@oracle.com> X-Mailer: git-send-email 2.40.1 In-Reply-To: <20230609194947.37196-1-sidhartha.kumar@oracle.com> References: <20230609194947.37196-1-sidhartha.kumar@oracle.com> X-ClientProxiedBy: SJ2PR07CA0009.namprd07.prod.outlook.com (2603:10b6:a03:505::6) To CH0PR10MB5113.namprd10.prod.outlook.com (2603:10b6:610:c9::8) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: CH0PR10MB5113:EE_|CYYPR10MB7651:EE_ X-MS-Office365-Filtering-Correlation-Id: 08b9a241-9c82-445e-7dc4-08db6922b29c X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: CuYMREmb6vMNYaM6VT5GyS95PUlDHEn8hpGX311kzW/heJcKYU7uPcMcBYUS75KJpAQjgyKqPley8k+cjupPq1jXwl2ivh4Smwvfnldx5uL8J4fO62EjbLk9l1qzgjrFzeLyEbRlLB8zMISmySYLgetK6c4i0DBs5paDPy0F14Qoe/KEU46VIAD2Ifqap/VPVXpdnT0yC6Y8xYQqc+zFUurxhcQWUxlsYnVAZCKpGuDGJJd0qBY2jXUIbmaDKoAvg/QfXMIEdFVu5M6dfWJ4tf8wE+0ELrHBEftdMQiWNkqav2fK4gH8SEFhtIpvSI0BDRIfNh9kb5vrpC7vc31UsbElIusIo3/ZFyBz7A7LanNnAAzdVGHkqrl3JRWOYKc2sG0mkjYeXz1J4jSPjT+lCioCasuTX2eW1fyjH3BruwuDTPdT9TDA9MutwOW7+YUku2oDAtohL0pQLAGQfda6DQeKOC7XW4dpP0i2m5ERRH/bfcLiiQ0l74x8c5CSfPC1ZXRDWT9O0FUG9ZU3BLpDhNzL/ncxlGyK2S95abOjBQlzjl1AVGu6+oYEFOYT5bmu X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:CH0PR10MB5113.namprd10.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230028)(396003)(136003)(39860400002)(366004)(376002)(346002)(451199021)(478600001)(66476007)(44832011)(8936002)(8676002)(66556008)(36756003)(5660300002)(2906002)(86362001)(4326008)(66946007)(316002)(1076003)(38100700002)(6506007)(41300700001)(2616005)(6512007)(107886003)(186003)(83380400001)(6486002)(6666004);DIR:OUT;SFP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15Q+wlRXScHW9JlYxZTjaqXLHW2y7+9Aw3dc3CsHR+73RBImz5mtPOrgt9jyAImUFBcx5Ekb4CKZkcGOODU7HWzDZTJMJjaQ1TDCKgHZ9GigRhbDyZ5X/x+sFzwE810b1AMAuMcpoYI5sii5m04JKErnqpPnmlaS7dAvlp0yolGHmFjo9v/mOg61thmW+kU6mUdJ3SVFs08w4k2Yg1JAtO/ZEqZPj0jG99/cfjLJu4a7F6qj/5ndnAml7Pjw+iJm/chytMt+Lf7Bb7nXVbcPIOtLK5NfJCfKt6FBO+asmgNvMhSb9LrhS6hc8Jyeh2vQzD7VQkRQcZMe1QozDMrLb/oShZhCelxLh6slCocxOjAKaFtizrJHd0hJLXahQ1sdPAb03YXcDeEk4VDZZmBGFoTiTJFUd9lbovN0wbpiQ124xAloVjPOJJ+fANDeEToxVqT3YuV9brVPkRuXEMW9PgXtoUyLjKknHZhXwyds4FXyXybkmg+2mLxTJ7y0UpdK1fCFy2VhVeB6a8hu0mV2dMMwSM/0Qs1iqC/CGHJqBzAysqwWULMYGVPRlYomsrsVv4o+gzzOcEs/HTe/9EfyRpKTGxAx+LtNAz8/gZyyCdlcMwLAQSjXtpe4qFWQYqKqBQKN68gOCF4pxE1jjdSAc X-OriginatorOrg: oracle.com X-MS-Exchange-CrossTenant-Network-Message-Id: 08b9a241-9c82-445e-7dc4-08db6922b29c X-MS-Exchange-CrossTenant-AuthSource: CH0PR10MB5113.namprd10.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 09 Jun 2023 19:49:55.2329 (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: A6e6KJRpnSlpt15/lI3PxICIdtkXIm0yngHJ62fe2dtJMb0kLqZrzh+4iV1nT9iN9MrfsqRZtWFbmte5oo92kp7Fm7elaM2kz1QICvJiq0c= X-MS-Exchange-Transport-CrossTenantHeadersStamped: CYYPR10MB7651 X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.254,Aquarius:18.0.957,Hydra:6.0.573,FMLib:17.11.176.26 definitions=2023-06-09_14,2023-06-09_01,2023-05-22_02 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 suspectscore=0 malwarescore=0 mlxscore=0 bulkscore=0 phishscore=0 mlxlogscore=999 spamscore=0 adultscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2305260000 definitions=main-2306090166 X-Proofpoint-GUID: aJjYpTRCK_KaSSfO6OZSPXJ5eqzxWvET X-Proofpoint-ORIG-GUID: aJjYpTRCK_KaSSfO6OZSPXJ5eqzxWvET X-Rspamd-Queue-Id: 1E1A3A0008 X-Rspam-User: X-Rspamd-Server: rspam05 X-Stat-Signature: 3u44iposmyj3otsdwn8cxi3kmwf4rzan X-HE-Tag: 1686340223-469260 X-HE-Meta: U2FsdGVkX18PsqsvfIkip9y1O+c5Aa/g1fL3Y3CwX3KczCVGAT5DxoIIDj0bwRvaxkM6K6CUXfmmwcGA2AeHVyLOpZhydC29WgB+8iC2LoLd4V0Au0y+H4ZUaL/lUndtPXRo8aU7jW/eWjCIb/i1P7FGeYWQ3Gj8ZVAKF5/YZT4ck1KqPFnrST4VpN2OpO9VtxlDd2mNjSImqvqLRB7PI7a69bWwJJnzjsyShH//ysXbNN84bhcn5btp21/r41Q5sK6XlBsHtpjQ+79W+T9z/m5//Doa++8AhkWCfdZcZMEMUK7J1afgGsjMQK8eXgBgTdPwp64YwZRi3Kzq09rUzVWenNmYbh47zUW4tzTIeJzEFCNqgE1f1QUzuFuW977p5PhKR6GzkfshIFt1en2qPhlo4gbNSBlPG48ODUfhHDChQIY+xAvzR/JZbRSbUc7xRCXYczYaaq2rnQDWbEiUvR39/fH+nVIxYmGvs/XJfT/B1dyJQJ3YGXrxmeTmVXr81mUZwgFTkbBeIPD3ozFzMidlm7gP+B89PnGVpZYKKD//BUzy9WkOqaW6vnaa0wWj51erYdCCBeHB8mYjf+EFurSv1mnlMy84g1fws8EDCdEPy86XbQk7a4mtUDMPACsJLMUkuxnttus6ryC+XmiS2vUGe5/WzdWSpuArwH+SSD861Vh3RTb2pdR0POzq8zp8FfmtG3iccqYIPlZ3RgcpFff7hQ9DRfw0bqqT+9IZfUXC6rvVUJIph5WLdY7C1LYLSAT+v0UF49/ChDPjjOLWE2NmvXNJnSdbjYO9Dsb15ZNng9f3i290BnU61Hq7hq8oXw0W4fOnhjLJKG3rd1GnCQbPLxgtLQzbrjIWi/ywZwAjJFHfGvYqwA3MnwbAPDObJQErRKS/Fc0yFWHy3223YkjOd8wnAxWVnia9nKVLeHeFQBVJVJ754ukRZdyXgIHflLiJY4ookOx/KuZjUEs gs1h8rDl OxHI5pFlvbUD2/kUFsNt4CUiSkD6GdihKmFtumFHpiU+6T0166wxHwXGr0o+hAy3MSRJgMtuwVhoWL95K++w/AQ4Or1heo6vm2+y/IuiBV6VdFUAkwlz5SaCoxQSQoA9+4p6+1hn771wBDE8ocFDXlruRS9IYVRxuDcAmP24q/bZZixVLNwazauZ5ubLX1ZA/T89S6xwY37rX4iLMJglUOpUqcqUr4JcPG4t4JNBDLvLEgeiZra4baFj5VhQHkaPgPTYZP6A6B2c6VDh0RfmAeFUykL0FOG++3jh5MsVFyx5ykv3rBU+1qmE27hSy0H0carj/JeJb9bS2jXFatbxp89Sq8Kp/Km0P3AUJ4SHxQ2m6w2M0CrfKWPCHvf1AyQ+VZUE3N0o9OJCRP0U+PCtICaBpOvDHEVXOKZpOLHUvuP23pCQ= 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 patch aims to remove special cased hugetlb handling code within the page cache by changing the granularity of each index to the base page size rather than the huge page size. Signed-off-by: Sidhartha Kumar --- include/linux/pagemap.h | 6 ------ mm/filemap.c | 36 +++++++++++------------------------- 2 files changed, 11 insertions(+), 31 deletions(-) diff --git a/include/linux/pagemap.h b/include/linux/pagemap.h index 716953ee1ebdb..17c414fc2136e 100644 --- a/include/linux/pagemap.h +++ b/include/linux/pagemap.h @@ -723,9 +723,6 @@ static inline struct page *folio_file_page(struct folio *folio, pgoff_t index) */ static inline bool folio_contains(struct folio *folio, pgoff_t index) { - /* HugeTLBfs indexes the page cache in units of hpage_size */ - if (folio_test_hugetlb(folio)) - return folio->index == index; return index - folio_index(folio) < folio_nr_pages(folio); } @@ -850,12 +847,9 @@ static inline loff_t folio_file_pos(struct folio *folio) /* * Get the offset in PAGE_SIZE (even for hugetlb folios). - * (TODO: hugetlb folios should have ->index in PAGE_SIZE) */ static inline pgoff_t folio_pgoff(struct folio *folio) { - if (unlikely(folio_test_hugetlb(folio))) - return hugetlb_basepage_index(&folio->page); return folio->index; } diff --git a/mm/filemap.c b/mm/filemap.c index 60f6f63cfacba..7462d33f70e2f 100644 --- a/mm/filemap.c +++ b/mm/filemap.c @@ -134,11 +134,8 @@ static void page_cache_delete(struct address_space *mapping, mapping_set_update(&xas, mapping); - /* hugetlb pages are represented by a single entry in the xarray */ - if (!folio_test_hugetlb(folio)) { - xas_set_order(&xas, folio->index, folio_order(folio)); - nr = folio_nr_pages(folio); - } + xas_set_order(&xas, folio->index, folio_order(folio)); + nr = folio_nr_pages(folio); VM_BUG_ON_FOLIO(!folio_test_locked(folio), folio); @@ -237,7 +234,7 @@ void filemap_free_folio(struct address_space *mapping, struct folio *folio) if (free_folio) free_folio(folio); - if (folio_test_large(folio) && !folio_test_hugetlb(folio)) + if (folio_test_large(folio)) refs = folio_nr_pages(folio); folio_put_refs(folio, refs); } @@ -858,14 +855,15 @@ noinline int __filemap_add_folio(struct address_space *mapping, if (!huge) { int error = mem_cgroup_charge(folio, NULL, gfp); - VM_BUG_ON_FOLIO(index & (folio_nr_pages(folio) - 1), folio); if (error) return error; charged = true; - xas_set_order(&xas, index, folio_order(folio)); - nr = folio_nr_pages(folio); } + VM_BUG_ON_FOLIO(index & (folio_nr_pages(folio) - 1), folio); + xas_set_order(&xas, index, folio_order(folio)); + nr = folio_nr_pages(folio); + gfp &= GFP_RECLAIM_MASK; folio_ref_add(folio, nr); folio->mapping = mapping; @@ -2048,7 +2046,7 @@ unsigned find_get_entries(struct address_space *mapping, pgoff_t *start, int idx = folio_batch_count(fbatch) - 1; folio = fbatch->folios[idx]; - if (!xa_is_value(folio) && !folio_test_hugetlb(folio)) + if (!xa_is_value(folio)) nr = folio_nr_pages(folio); *start = indices[idx] + nr; } @@ -2112,7 +2110,7 @@ unsigned find_lock_entries(struct address_space *mapping, pgoff_t *start, int idx = folio_batch_count(fbatch) - 1; folio = fbatch->folios[idx]; - if (!xa_is_value(folio) && !folio_test_hugetlb(folio)) + if (!xa_is_value(folio)) nr = folio_nr_pages(folio); *start = indices[idx] + nr; } @@ -2153,9 +2151,6 @@ unsigned filemap_get_folios(struct address_space *mapping, pgoff_t *start, continue; if (!folio_batch_add(fbatch, folio)) { unsigned long nr = folio_nr_pages(folio); - - if (folio_test_hugetlb(folio)) - nr = 1; *start = folio->index + nr; goto out; } @@ -2181,7 +2176,7 @@ EXPORT_SYMBOL(filemap_get_folios); static inline bool folio_more_pages(struct folio *folio, pgoff_t index, pgoff_t max) { - if (!folio_test_large(folio) || folio_test_hugetlb(folio)) + if (!folio_test_large(folio)) return false; if (index >= max) return false; @@ -2231,9 +2226,6 @@ unsigned filemap_get_folios_contig(struct address_space *mapping, if (!folio_batch_add(fbatch, folio)) { nr = folio_nr_pages(folio); - - if (folio_test_hugetlb(folio)) - nr = 1; *start = folio->index + nr; goto out; } @@ -2250,10 +2242,7 @@ unsigned filemap_get_folios_contig(struct address_space *mapping, if (nr) { folio = fbatch->folios[nr - 1]; - if (folio_test_hugetlb(folio)) - *start = folio->index + 1; - else - *start = folio->index + folio_nr_pages(folio); + *start = folio->index + folio_nr_pages(folio); } out: rcu_read_unlock(); @@ -2291,9 +2280,6 @@ unsigned filemap_get_folios_tag(struct address_space *mapping, pgoff_t *start, continue; if (!folio_batch_add(fbatch, folio)) { unsigned long nr = folio_nr_pages(folio); - - if (folio_test_hugetlb(folio)) - nr = 1; *start = folio->index + nr; goto out; } From patchwork Fri Jun 9 19:49:47 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sidhartha Kumar X-Patchwork-Id: 13274335 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 15BE7C7EE29 for ; Fri, 9 Jun 2023 19:50:30 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 7F30C8E0005; Fri, 9 Jun 2023 15:50:29 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 77EE58E0002; Fri, 9 Jun 2023 15:50:29 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 534278E0005; Fri, 9 Jun 2023 15:50:29 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0013.hostedemail.com [216.40.44.13]) by kanga.kvack.org (Postfix) with ESMTP id 4363D8E0002 for ; Fri, 9 Jun 2023 15:50:29 -0400 (EDT) Received: from smtpin29.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay06.hostedemail.com (Postfix) with ESMTP id 8F978AF21F for ; Fri, 9 Jun 2023 19:50:27 +0000 (UTC) X-FDA: 80884251294.29.870FD3D Received: from mx0a-00069f02.pphosted.com (mx0a-00069f02.pphosted.com [205.220.165.32]) by imf02.hostedemail.com (Postfix) with ESMTP id E4F378001F for ; Fri, 9 Jun 2023 19:50:22 +0000 (UTC) Authentication-Results: imf02.hostedemail.com; dkim=pass header.d=oracle.com header.s=corp-2023-03-30 header.b=ZCAy2zsf; dkim=pass header.d=oracle.onmicrosoft.com header.s=selector2-oracle-onmicrosoft-com header.b=guDH5KBY; spf=pass (imf02.hostedemail.com: domain of sidhartha.kumar@oracle.com designates 205.220.165.32 as permitted sender) smtp.mailfrom=sidhartha.kumar@oracle.com; dmarc=pass (policy=none) header.from=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=1686340223; 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=+VW3n/nXZxg1whEY9wfAZZjxf3DEoS4VsO9GtUMTfAo=; b=jdtL7YK1VkxA51xhI5JzpolLGpVbYXq7tR27pQjnalEHU7E9lIvt4vRXZW2mh4Ui9S/IzJ 5Yw1nUbKm0kW0QUvry4v/poLdrUJBRm8duBnihMa61HcSDdlG8DDW2yt/Z5BFbNi6D/lPK StTF+KDXn0cMjQFa+vwgshBv3pNyF7g= ARC-Seal: i=2; s=arc-20220608; d=hostedemail.com; t=1686340223; a=rsa-sha256; cv=pass; b=1yvI2BsnWDDw/AtO5HfqZpxkt2hoZxBO2xfJdnjrBWbXr5zC8JIdLvivZQ6hHZbVyUxK17 EtbZ79DJSFsGAnXTbJbRFvH5OCU62aL2w79q+jHoZ6luTVgA6WG8T3d1lH9vznwg5bEh1s LjybbE1hl0IeYPIqYdHoCak9+r8UbYs= ARC-Authentication-Results: i=2; imf02.hostedemail.com; dkim=pass header.d=oracle.com header.s=corp-2023-03-30 header.b=ZCAy2zsf; dkim=pass header.d=oracle.onmicrosoft.com header.s=selector2-oracle-onmicrosoft-com header.b=guDH5KBY; spf=pass (imf02.hostedemail.com: domain of sidhartha.kumar@oracle.com designates 205.220.165.32 as permitted sender) smtp.mailfrom=sidhartha.kumar@oracle.com; dmarc=pass (policy=none) header.from=oracle.com; arc=pass ("microsoft.com:s=arcselector9901:i=1") Received: from pps.filterd (m0333521.ppops.net [127.0.0.1]) by mx0b-00069f02.pphosted.com (8.17.1.19/8.17.1.19) with ESMTP id 359IBZNN013302; Fri, 9 Jun 2023 19:50:02 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=+VW3n/nXZxg1whEY9wfAZZjxf3DEoS4VsO9GtUMTfAo=; b=ZCAy2zsfTMWEhTyHinqj4DWXD0+msCU+VVHNVVkdCqA1uLORApXy/j1L5KluNrTH0jQI lP3lTF5VS/JoKIb3E8XOHpfYpxVnUVgi/EIdF9yvZBh5o4FcIEhKDfu1OyX0XXz7W4oR qPRP7b79qMwIsqEAWzvXWl/KZzoKjZFvDZg1dA39XJ6efGTDXbRcAkCWujCnAwyBcorp 35zaWJfMj4ELTWdGuZag/k8fzE7QZrs19WZzeHfSTEqhUhoPc9E8730Bx08ZChiGiX/N 5qqbOJwdaBdSak/jqZt7x3YbHeDu5e23vCeTX9XUiyg6Gw7LDLIsw/8scMraR5shQGIX Ng== Received: from phxpaimrmta03.imrmtpd1.prodappphxaev1.oraclevcn.com (phxpaimrmta03.appoci.oracle.com [138.1.37.129]) by mx0b-00069f02.pphosted.com (PPS) with ESMTPS id 3r2a6sqkv3-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Fri, 09 Jun 2023 19:50:02 +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 359Jde6m036863; Fri, 9 Jun 2023 19:50:01 GMT Received: from nam12-mw2-obe.outbound.protection.outlook.com (mail-mw2nam12lp2048.outbound.protection.outlook.com [104.47.66.48]) by phxpaimrmta03.imrmtpd1.prodappphxaev1.oraclevcn.com (PPS) with ESMTPS id 3r2a6ntkp6-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Fri, 09 Jun 2023 19:50:01 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=fMpiR+I1qTe8Xc34xcBsMg9tDLoBAY0BnsWp/wkxnAlgX39FxEqdBlDlwvsZxyu2LLPGcJY8aRbkCMukJl7BxPNvkgCw6BrUIBkUT9gRXC1NAtBB9njpgasO3f6BKzdX/n940s1/tMgBC1/XjnItIAGfxWUVjE4VW1u/QJ2Bq/9Ozml+FXVb42s/UVFvyGYSKJ+ghcQxW/j383EAua2LmRcqHZvfe5Rmbg0yoHEHz2ynvPueoI/KrAtFTp/UkZp7CORRosx7B6VIwS2txupV8vpa00t0jAJCu1AGx4T5S1OUrHjMAhSiGpUBCyqgYX6Xv9mHlkZOqKeLIH7vRQuFWA== 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=+VW3n/nXZxg1whEY9wfAZZjxf3DEoS4VsO9GtUMTfAo=; b=GpajcO7E32Li5u9Ah0Vsph4BESTOqQRaNuFeKCBd5l9/XUZI6h9e0W4LysY9syK1LHqOlI2BMqam+IYe0BWcR6tH73OPZJjEJvrWtVUES/VLvQSUO7RRJLE6NEXhEcNaxjWik04Xu5txG+smVk1LEByojb2WixAWHbdZR4vLfIEnx2DisrSYA8sonFXc99ELSjRceSEx87lTe13xXaCmfWAMyPntO86gnFFcjazxSEMGZlkxdYXEmlswSWWKz+3KQggITGzi2qIdGEiRI6Fxzh+oBc7NP5ecXk1nf07DTISdks4N1+Q+qqhBjvNhejnu/rQ6wxbcw3Yl6xJAFDQqtw== 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=+VW3n/nXZxg1whEY9wfAZZjxf3DEoS4VsO9GtUMTfAo=; b=guDH5KBYVEauHsr1OgrD1SlV3JDS3AcXLplLBiKR3oh4KZwxywxGOAXdSzwD5sLPI50Erv8e6Vqray2848J2ChwYYAHRGt44o/s4uqth6WwCsqa/EoVO4XxeYZHi4FQeOo+ZwfNJ3ITnhbOXBuWL63YyqTK6L+B1oHX57A4pImo= Received: from CH0PR10MB5113.namprd10.prod.outlook.com (2603:10b6:610:c9::8) by PH0PR10MB4664.namprd10.prod.outlook.com (2603:10b6:510:41::11) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6455.44; Fri, 9 Jun 2023 19:49:57 +0000 Received: from CH0PR10MB5113.namprd10.prod.outlook.com ([fe80::d9c0:689a:147b:ced5]) by CH0PR10MB5113.namprd10.prod.outlook.com ([fe80::d9c0:689a:147b:ced5%4]) with mapi id 15.20.6455.030; Fri, 9 Jun 2023 19:49:57 +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, david@redhat.com, nphamcs@gmail.com, jthoughton@google.com, Sidhartha Kumar Subject: [PATCH 2/2] mm/hugetlb: add wrapper functions for interactions with page cache Date: Fri, 9 Jun 2023 12:49:47 -0700 Message-Id: <20230609194947.37196-3-sidhartha.kumar@oracle.com> X-Mailer: git-send-email 2.40.1 In-Reply-To: <20230609194947.37196-1-sidhartha.kumar@oracle.com> References: <20230609194947.37196-1-sidhartha.kumar@oracle.com> X-ClientProxiedBy: SJ0PR13CA0050.namprd13.prod.outlook.com (2603:10b6:a03:2c2::25) To CH0PR10MB5113.namprd10.prod.outlook.com (2603:10b6:610:c9::8) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: CH0PR10MB5113:EE_|PH0PR10MB4664:EE_ X-MS-Office365-Filtering-Correlation-Id: 8a85cd8c-d8a7-429b-e72d-08db6922b3fa X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: zikLGqoLQ86dtfDps/8D9lPvEkI9F7jviXAda2SwHrbVCMpvH7yBJKR4iE3yyT/+smSEGZ4liHpyaWPYvGQWwdH2jW3I7ZSa25jg0XfHfLBIm+Z4hMdQsoXg+8KIRbANPMVL34oLBfsLxlDASO4/YohXe+DxlwcEBEQ9apOg/lD90pcONK7zmV3ZO2qPlXcM4iywEmnbutFzHppiehtBG9gMEfdJZtrZQCIgHMX93EesCcXAKXUPszPMz2oOcmHftrFiRb027PAMjJ+fHex8h0R/3x3ohw3qvzqQawa4kX1f1warOBR3jStuifk6iCk2Q6VXpW5KmpIElv7+P8RBhdNtsoL+UkI0XTXFEYCcNnkUyIgowIrurG6agqCXClk1AiwRyBSsSj8PBpbzGmTaGs6RRjbJJKq8/Vwe0TUysoXWvaLQ2UQ/8pfn5V7fdHxYkqN2ZdhOfHN1/OhufF1plnleHoPlZhHxy+WsEWKvcaqRLO2Gmi4QdLFDpjabXonkrgwAZw2rqabBwtuj84IPTbOQ2wG8Bji8qxkedO5+5uQsTiZcigvFwEDWIIblP0Bt X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:CH0PR10MB5113.namprd10.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230028)(366004)(136003)(376002)(39860400002)(396003)(346002)(451199021)(66899021)(38100700002)(2906002)(2616005)(83380400001)(36756003)(86362001)(107886003)(6486002)(6666004)(478600001)(1076003)(4326008)(316002)(44832011)(6506007)(66476007)(66946007)(41300700001)(8676002)(8936002)(186003)(5660300002)(66556008)(6512007);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: LvO/sEkUHWKTzNzFYznIzwhRA5m6U3byKCtsVzffb9Cj+tKWAXmlRaksYihx2rJsnpvnGwdZu5UhStx3Vkvzmau9aikWu1BCa9DLbf8v3BokQjUXrfhGhAVEtWyfnEB7HT60d5NRGOHfpLlNziGv48iPz+PP0KrecIz3Mg0ikeX2GSanyc7GnmD6z1K1vdFkXGkuFeSv3asZ6PYyQjdjMJ9lYLMGeiFVNbElGgYFGa4BJRFwWI2cCL4SJmtvJwXIESL2GpUlFyKbdR6Dgwi2WsvCMRikbgy3sZgpL1gIppULAh9nesrN/+W7/fi5VzFJm1HTm1IyJvJW1DID/h7J83wuMQ1E85J7BdDIGP0pTDoN81dxv66t+PNplKoVMNO6gwTLUhuhqtZgrSn0/lQwdkJzz872OMZ/gwehFizk/FuCkdGAxsIw9MAwjF62b4CePtezk9isxLPG3TMzuwIqzV9O8q2l/gbKyXS0tHrei7dgm+WeY+W44l83klhhHvbQ73UTAuH0FeKBZbcwgOQuabIAON4H0k8N3bQ2zuWW2RkH5sJSx+Jxo+/VZCNuFi+EEnsXNXqSgwfHN73RVBXUGf/q2UP+Mwyz3cosQassYl8WUgSOOP0MdPP1Tprk4xTbaHqnCAuEmkDpZ5AUoh8ofi/JnVXxkYwC+gJZ24Xy1CLanEwJ98fq5pxoA6ksBv8oMVNLt9fJDo1IT7jzoVujWLWGflV5V6hm8+pHT10flv5iIyMcUwEvThUv4AfSV0df1cojy+OAV/74TcMLFGZRGeR2kNQU2CuL2XPqdFqTQ+gJLCQ4OA44Z8tcj3EaG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UbA28KiDL4+Jv+AGFo5AD2XdJqP8coYDXE690j8Iu1BbCRcOQZEFj/kONTNqjp2e4xKOUdZlJZ5C7zf5T3BvIHQkaCVo/aStSx2Cxu4b+f2wbB6yksil8mGZulB98aBXzk4KMGJOXismBmRfamrNx3yvhff22rchxVynoOmPpPCHSLBX2fg9GA/Lr+9J/NJkqRNDAWn6SS0BmAqxxgUoz+1Fes8e7jihpnmwosZsgBYsXMcxxpeMqrhH8Hx2sjL7GMGUDIn3SJ8SfVUG9CeKm8ntkYLAnCS07uTQ/IrXy6vGjupHA0/fQ4jhmUkEW6wmEXrvMg7fcunJnAM34OW2rp7fqiwdsB+yxIb6qx/5s9glzq9iCl9seKNCo+mPOGcHV/Xy5RKof+qQ9n6YBarupWd0bPXVux0JrFjwmAZoGDDtkSef5E0++k6NRXomAHtrbJe5nV58W6AmEIj5KnJVMyy1cDV0ymAq/Zqnn6KHMFUmmFD3euRMmNM/6/Qwa+3NOA7bH+ool1KFvglRoHasoSAWB9WdkNesNPJJliyoFXaTnvYgU8qSVTt+VGkyPDEiwtAlDREXVcBG8UmfnwCijucpfgXWoMwvJCSuS6UzLZnJSURLxGqfVQZpa/Da2+xiQQkx0yRFVXCYR3P2/9qQLPP4xhZVHTvkFPbbu8dgbDW6+Q9LCUqt/mHcSsHo/Ls0UojSr+90aLJ2O0GR5tVlpiDGguCAY4X5xJ+RYAtLERvrNFVYraD8gAnQTqe/wrpSMYfWN0Ow0TFWQtf6pCLAkC2tOVOhfI8ac5gjREjCZjpd0iHuMkbQDVB00Lja X-OriginatorOrg: oracle.com X-MS-Exchange-CrossTenant-Network-Message-Id: 8a85cd8c-d8a7-429b-e72d-08db6922b3fa X-MS-Exchange-CrossTenant-AuthSource: CH0PR10MB5113.namprd10.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 09 Jun 2023 19:49:57.4068 (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: FRyzmmcsj4g6CABjcsriLJdDgnMVmnsxg3XzzNU2yP6W1m48Jui4ZRBxjHGvM3Ifh+tVdKAdA3Hd0dpvqhu4frKRObf3WsFOEWIvy4tgEKM= X-MS-Exchange-Transport-CrossTenantHeadersStamped: PH0PR10MB4664 X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.254,Aquarius:18.0.957,Hydra:6.0.573,FMLib:17.11.176.26 definitions=2023-06-09_14,2023-06-09_01,2023-05-22_02 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 phishscore=0 spamscore=0 suspectscore=0 mlxscore=0 adultscore=0 mlxlogscore=999 bulkscore=0 malwarescore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2305260000 definitions=main-2306090166 X-Proofpoint-GUID: tWI-TjcF9Ds9rt6x360ncLhQRttwLJW3 X-Proofpoint-ORIG-GUID: tWI-TjcF9Ds9rt6x360ncLhQRttwLJW3 X-Rspamd-Queue-Id: E4F378001F X-Rspam-User: X-Stat-Signature: m9kc951w1ammj9y5z359w3zjtf1p6jgo X-Rspamd-Server: rspam03 X-HE-Tag: 1686340222-671887 X-HE-Meta: U2FsdGVkX18Chc1oO99AbCY08tJRDjmWz+6Azu4xXMpPgLaEp0FCZOvyUUsA5Wq4N1NK9Qrm428ckN7ZcFBBVjGHzFUEF3sPREZ4zqzsZy7RJ9JeWnZf2V+QMdQtLZoueDJifbm/gyDoHjIzJtnqcsA2g0sVislTLSXASQlOgbfuuYpKA54mys16TnejT5YvOFK/Tlzq5e7TaNjZM/4LAkSrSc2lV3/2qqpQBfjjaHBZKv2vystBwDrU2i8akrOFAajn/G+BXdr4GS9DEV5jErI1vLtFg4gYQ7DFPDks8Zh4sE3ZGY0iDQtolnLOV6RMBMgyi7IXjCR/5PIoi3xlS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ner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: Signed-off-by: Sidhartha Kumar --- fs/hugetlbfs/inode.c | 14 +++++++------- include/linux/hugetlb.h | 21 +++++++++++++++++++-- include/linux/pagemap.h | 2 -- mm/hugetlb.c | 22 +++++++++++++--------- 4 files changed, 39 insertions(+), 20 deletions(-) diff --git a/fs/hugetlbfs/inode.c b/fs/hugetlbfs/inode.c index 90361a922cec7..90d27a8af4b6a 100644 --- a/fs/hugetlbfs/inode.c +++ b/fs/hugetlbfs/inode.c @@ -617,20 +617,19 @@ static void remove_inode_hugepages(struct inode *inode, loff_t lstart, struct hstate *h = hstate_inode(inode); struct address_space *mapping = &inode->i_data; const pgoff_t start = lstart >> huge_page_shift(h); - const pgoff_t end = lend >> huge_page_shift(h); struct folio_batch fbatch; pgoff_t next, index; int i, freed = 0; bool truncate_op = (lend == LLONG_MAX); folio_batch_init(&fbatch); - next = start; - while (filemap_get_folios(mapping, &next, end - 1, &fbatch)) { + next = lstart; + while (filemap_get_folios(mapping, &next, lend - 1, &fbatch)) { for (i = 0; i < folio_batch_count(&fbatch); ++i) { struct folio *folio = fbatch.folios[i]; u32 hash = 0; - index = folio->index; + index = (folio->index) >> huge_page_shift(h); hash = hugetlb_fault_mutex_hash(mapping, index); mutex_lock(&hugetlb_fault_mutex_table[hash]); @@ -693,10 +692,11 @@ static void hugetlbfs_zero_partial_page(struct hstate *h, loff_t start, loff_t end) { - pgoff_t idx = start >> huge_page_shift(h); + struct mm_struct *mm = current->mm; + struct vm_area_struct *vma = find_vma(mm, start); struct folio *folio; - folio = filemap_lock_folio(mapping, idx); + folio = filemap_lock_hugetlb_folio(vma, start); if (IS_ERR(folio)) return; @@ -868,7 +868,7 @@ static long hugetlbfs_fallocate(struct file *file, int mode, loff_t offset, } clear_huge_page(&folio->page, addr, pages_per_huge_page(h)); __folio_mark_uptodate(folio); - error = hugetlb_add_to_page_cache(folio, mapping, index); + error = hugetlb_add_to_page_cache(folio, &pseudo_vma, mapping, addr); if (unlikely(error)) { restore_reserve_on_error(h, &pseudo_vma, addr, folio); folio_put(folio); diff --git a/include/linux/hugetlb.h b/include/linux/hugetlb.h index 21f942025fecd..55f90e051b7a2 100644 --- a/include/linux/hugetlb.h +++ b/include/linux/hugetlb.h @@ -727,8 +727,8 @@ struct folio *alloc_hugetlb_folio_nodemask(struct hstate *h, int preferred_nid, nodemask_t *nmask, gfp_t gfp_mask); struct folio *alloc_hugetlb_folio_vma(struct hstate *h, struct vm_area_struct *vma, unsigned long address); -int hugetlb_add_to_page_cache(struct folio *folio, struct address_space *mapping, - pgoff_t idx); +int hugetlb_add_to_page_cache(struct folio *folio, struct vm_area_struct *vma, + struct address_space *mapping, unsigned long address); void restore_reserve_on_error(struct hstate *h, struct vm_area_struct *vma, unsigned long address, struct folio *folio); @@ -755,6 +755,16 @@ static inline struct hugepage_subpool *hugetlb_folio_subpool(struct folio *folio return folio->_hugetlb_subpool; } +/* Wrapper function for __filemap_get_folio*/ +static inline struct folio *filemap_lock_hugetlb_folio(struct vm_area_struct *vma, + unsigned long address) +{ + struct address_space *mapping = vma->vm_file->f_mapping; + + pgoff_t idx = linear_page_index(vma, address); + return __filemap_get_folio(mapping, idx, FGP_LOCK, 0); +} + static inline void hugetlb_set_folio_subpool(struct folio *folio, struct hugepage_subpool *subpool) { @@ -1021,6 +1031,13 @@ static inline struct hugepage_subpool *hugetlb_folio_subpool(struct folio *folio return NULL; } +/* Wrapper function for __filemap_get_folio*/ +static inline struct folio *filemap_lock_hugetlb_folio(struct vm_area_struct *vma, + unsigned long address) +{ + return NULL; +} + static inline int isolate_or_dissolve_huge_page(struct page *page, struct list_head *list) { diff --git a/include/linux/pagemap.h b/include/linux/pagemap.h index 17c414fc2136e..ae8f36966d7b3 100644 --- a/include/linux/pagemap.h +++ b/include/linux/pagemap.h @@ -860,8 +860,6 @@ static inline pgoff_t linear_page_index(struct vm_area_struct *vma, unsigned long address) { pgoff_t pgoff; - if (unlikely(is_vm_hugetlb_page(vma))) - return linear_hugepage_index(vma, address); pgoff = (address - vma->vm_start) >> PAGE_SHIFT; pgoff += vma->vm_pgoff; return pgoff; diff --git a/mm/hugetlb.c b/mm/hugetlb.c index dfa412d8cb300..824d6d215a161 100644 --- a/mm/hugetlb.c +++ b/mm/hugetlb.c @@ -951,7 +951,7 @@ static long region_count(struct resv_map *resv, long f, long t) /* * Convert the address within this vma to the page offset within - * the mapping, in pagecache page units; huge pages here. + * the mapping, in huge page units here. */ static pgoff_t vma_hugecache_offset(struct hstate *h, struct vm_area_struct *vma, unsigned long address) @@ -5730,7 +5730,7 @@ static bool hugetlbfs_pagecache_present(struct hstate *h, struct vm_area_struct *vma, unsigned long address) { struct address_space *mapping = vma->vm_file->f_mapping; - pgoff_t idx = vma_hugecache_offset(h, vma, address); + pgoff_t idx = linear_page_index(vma, address); bool present; rcu_read_lock(); @@ -5740,13 +5740,16 @@ static bool hugetlbfs_pagecache_present(struct hstate *h, return present; } -int hugetlb_add_to_page_cache(struct folio *folio, struct address_space *mapping, - pgoff_t idx) +int hugetlb_add_to_page_cache(struct folio *folio, + struct vm_area_struct *vma, + struct address_space *mapping, + unsigned long address) { struct inode *inode = mapping->host; struct hstate *h = hstate_inode(inode); int err; + pgoff_t idx = linear_page_index(vma, address); __folio_set_locked(folio); err = __filemap_add_folio(mapping, folio, idx, GFP_KERNEL, NULL); @@ -5854,7 +5857,8 @@ static vm_fault_t hugetlb_no_page(struct mm_struct *mm, * before we get page_table_lock. */ new_folio = false; - folio = filemap_lock_folio(mapping, idx); + + folio = filemap_lock_hugetlb_folio(vma, address); if (IS_ERR(folio)) { size = i_size_read(mapping->host) >> huge_page_shift(h); if (idx >= size) @@ -5913,7 +5917,7 @@ static vm_fault_t hugetlb_no_page(struct mm_struct *mm, new_folio = true; if (vma->vm_flags & VM_MAYSHARE) { - int err = hugetlb_add_to_page_cache(folio, mapping, idx); + int err = hugetlb_add_to_page_cache(folio, vma, mapping, address); if (err) { /* * err can't be -EEXIST which implies someone @@ -6145,7 +6149,7 @@ vm_fault_t hugetlb_fault(struct mm_struct *mm, struct vm_area_struct *vma, /* Just decrements count, does not deallocate */ vma_end_reservation(h, vma, haddr); - pagecache_folio = filemap_lock_folio(mapping, idx); + pagecache_folio = filemap_lock_hugetlb_folio(vma, address); if (IS_ERR(pagecache_folio)) pagecache_folio = NULL; } @@ -6258,7 +6262,7 @@ int hugetlb_mfill_atomic_pte(pte_t *dst_pte, if (is_continue) { ret = -EFAULT; - folio = filemap_lock_folio(mapping, idx); + folio = filemap_lock_hugetlb_folio(dst_vma, dst_addr); if (IS_ERR(folio)) goto out; folio_in_pagecache = true; @@ -6350,7 +6354,7 @@ int hugetlb_mfill_atomic_pte(pte_t *dst_pte, * hugetlb_fault_mutex_table that here must be hold by * the caller. */ - ret = hugetlb_add_to_page_cache(folio, mapping, idx); + ret = hugetlb_add_to_page_cache(folio, dst_vma, mapping, dst_addr); if (ret) goto out_release_nounlock; folio_in_pagecache = true;