From patchwork Fri May 19 22:01:41 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sidhartha Kumar X-Patchwork-Id: 13248921 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 1291DC7EE26 for ; Fri, 19 May 2023 22:02:30 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 3B289900006; Fri, 19 May 2023 18:02:28 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 33BDC900003; Fri, 19 May 2023 18:02:28 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 13EFC900006; Fri, 19 May 2023 18:02:28 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0011.hostedemail.com [216.40.44.11]) by kanga.kvack.org (Postfix) with ESMTP id 04C89900003 for ; Fri, 19 May 2023 18:02:28 -0400 (EDT) Received: from smtpin18.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay07.hostedemail.com (Postfix) with ESMTP id CCA9A160B79 for ; Fri, 19 May 2023 22:02:27 +0000 (UTC) X-FDA: 80808379134.18.39C522A Received: from mx0a-00069f02.pphosted.com (mx0a-00069f02.pphosted.com [205.220.165.32]) by imf21.hostedemail.com (Postfix) with ESMTP id 3A5A61C0014 for ; Fri, 19 May 2023 22:02:21 +0000 (UTC) Authentication-Results: imf21.hostedemail.com; dkim=pass header.d=oracle.com header.s=corp-2023-03-30 header.b=EZWVWJQI; dkim=pass header.d=oracle.onmicrosoft.com header.s=selector2-oracle-onmicrosoft-com header.b=juVpM6RA; dmarc=pass (policy=none) header.from=oracle.com; spf=pass (imf21.hostedemail.com: domain of sidhartha.kumar@oracle.com designates 205.220.165.32 as permitted sender) smtp.mailfrom=sidhartha.kumar@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=1684533742; 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=3Y22BrpTmVG5LwQMAZ+8OBnRvoromZAM5t2fjkjx9VE=; b=PVc+U5Nh1CqC/5LJQp/HR4EPvjWVgUo1et7fNKssrEBhPqEjwhfkCLtSV5M6cdzRYxqxt6 vBRzx2jft4+PJmKFP1mCAPhKJV5tqqNzDmfqmx1vVMSUp54hX4MMRNlletx3imXoaMnobW VbB+gCcUBwAxqOoo9c33rAhkHRs5L60= ARC-Authentication-Results: i=2; imf21.hostedemail.com; dkim=pass header.d=oracle.com header.s=corp-2023-03-30 header.b=EZWVWJQI; dkim=pass header.d=oracle.onmicrosoft.com header.s=selector2-oracle-onmicrosoft-com header.b=juVpM6RA; dmarc=pass (policy=none) header.from=oracle.com; spf=pass (imf21.hostedemail.com: domain of sidhartha.kumar@oracle.com designates 205.220.165.32 as permitted sender) smtp.mailfrom=sidhartha.kumar@oracle.com; arc=pass ("microsoft.com:s=arcselector9901:i=1") ARC-Seal: i=2; s=arc-20220608; d=hostedemail.com; t=1684533742; a=rsa-sha256; cv=pass; b=UjmOF7W+TxQBgBqSdwsXvN+6/5m8ZW8GxkShLYdnHuPrWnylQ/9XUIFZsmVsjgs0kph3CT bJxAjtDb8MKkfTROBsYMccsxNOwAmTNh0GZWCUw+DPa+PJKzSvABlJhS5geIjapW/a3Kv0 07Zb8/GmFPdX2Cewwgk1UMPv2qBg8AQ= 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 34JJESfY009227; Fri, 19 May 2023 22:01:56 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=3Y22BrpTmVG5LwQMAZ+8OBnRvoromZAM5t2fjkjx9VE=; b=EZWVWJQIjWm0VTNS99o1AbkKUrNO8+DBy9agkWbA8Zr2M0nuTgNfXUnUW58yMh3K2NGH 0+RGayGtQnKCNQzYkCiGnt66eXXEzJgRu/PM8GogIlo5fqBFnZuqbBVzAfF6a6nchNiC pC+krp3LUVRrNmT8NUJjl6X6X7cWPJuASmh6X6FNRm7Q3BW1qzNuFf4txIXns8d/AEjc t3WYVAuS278Qyyhfzqz8CaS4rU5YwsCDUrGQC40LaQTegVOin7Mq8p4EljYP8AukOlDu m6GtLF66P9aTZcJ1619IIvexKbC4Qb2GLbqh8/oFYZZH68HIFsh6zjmbDNZ877UKnm2i sw== Received: from phxpaimrmta01.imrmtpd1.prodappphxaev1.oraclevcn.com (phxpaimrmta01.appoci.oracle.com [138.1.114.2]) by mx0b-00069f02.pphosted.com (PPS) with ESMTPS id 3qj1fcbhy2-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Fri, 19 May 2023 22:01:55 +0000 Received: from pps.filterd (phxpaimrmta01.imrmtpd1.prodappphxaev1.oraclevcn.com [127.0.0.1]) by phxpaimrmta01.imrmtpd1.prodappphxaev1.oraclevcn.com (8.17.1.19/8.17.1.19) with ESMTP id 34JKNbZo040097; Fri, 19 May 2023 22:01:55 GMT Received: from nam10-dm6-obe.outbound.protection.outlook.com (mail-dm6nam10lp2102.outbound.protection.outlook.com [104.47.58.102]) by phxpaimrmta01.imrmtpd1.prodappphxaev1.oraclevcn.com (PPS) with ESMTPS id 3qj108c9nf-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Fri, 19 May 2023 22:01:55 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=dvXOCjSG8cFvtprfLj4L9P+PO10hyUZZlQR3e7gscvJEdUQgBoO3KjRmyDoHFB5GBZkpppXNp1r1/VuhUx5yjSB1LP6xzV0um3NqHrFs58zQUgFXAyv4IFViNPI8RspjvjnL3AyIIIsSsi4Vqy4OSs0KoTePwfkmg8BT0OnCFoaea17tHGVgoatA1nTpSfJ4voszV1qBlxWlPvqo/qLLLHVN5e0n0WJMP/+5vI9Ws91sShkiufX8GHNYRgXJ555ectVygirZFmHCfmznHX9tN2Vp259Km5fxxcT4u1BsslcRDG7V6ewsr4zFqcLzN6GuxtaACZLnIQkpj5qLG114bQ== 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=3Y22BrpTmVG5LwQMAZ+8OBnRvoromZAM5t2fjkjx9VE=; b=aebvyejMU7tC72WtPQHlB/DBtO/YTiDW5/L5qXPnlo/3hMe374GlHjFVPVCwfx4pGBzypduumUmNE71LZ80F22FdJGaJlk/N+g2CeseDBjq8V+8KgD9a4ASctmJbf0XH/P1hz356PwifTqBTU8rWjo12WPLvy+tQVd8pVvIGA5lnvmmYhuRv/8jm6mgVmhya5+ZufMxgY4J21quhg3BBp+jOP+TIlwbskxjYD0M0lpcGWwwVAs1L31XUcGQOzaF0nIC/a2Hplf+5+6y1b8WNL0ZAm+ewNoA3FDm3CH+GwbVSOmWpTuQs2le9btJiiekcbsxYOsGngJAwUQXOWdiOdQ== 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=3Y22BrpTmVG5LwQMAZ+8OBnRvoromZAM5t2fjkjx9VE=; b=juVpM6RAKYUfRbbOWRNKA13ySpAew+QjR0FNM21Qkq6cY7k1SLUszCVWyFRe68Vu8DpjVCp2I+47c2WYFVFWholwu9Ny0PW6iQ84zWr/tHYYeUkOAVGBUSV/ECNyOWAGZu3eDY24O9IHTZlKVT6thtFRfcKickncg1mRkC3ohPA= Received: from CH0PR10MB5113.namprd10.prod.outlook.com (2603:10b6:610:c9::8) by CH3PR10MB7862.namprd10.prod.outlook.com (2603:10b6:610:1ae::20) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6411.21; Fri, 19 May 2023 22:01:52 +0000 Received: from CH0PR10MB5113.namprd10.prod.outlook.com ([fe80::12d3:3f71:5b55:c342]) by CH0PR10MB5113.namprd10.prod.outlook.com ([fe80::12d3:3f71:5b55:c342%3]) with mapi id 15.20.6411.021; Fri, 19 May 2023 22:01:52 +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, Sidhartha Kumar Subject: [RFC v2 1/2] mm/filemap: remove hugetlb special casing in filemap.c Date: Fri, 19 May 2023 15:01:41 -0700 Message-Id: <20230519220142.212051-2-sidhartha.kumar@oracle.com> X-Mailer: git-send-email 2.40.1 In-Reply-To: <20230519220142.212051-1-sidhartha.kumar@oracle.com> References: <20230519220142.212051-1-sidhartha.kumar@oracle.com> X-ClientProxiedBy: SJ0PR05CA0136.namprd05.prod.outlook.com (2603:10b6:a03:33d::21) To CH0PR10MB5113.namprd10.prod.outlook.com (2603:10b6:610:c9::8) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: CH0PR10MB5113:EE_|CH3PR10MB7862:EE_ X-MS-Office365-Filtering-Correlation-Id: 4c7efd63-2d3d-45da-5a98-08db58b4a6ae X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: XhoGmR1kifsBa1vcudChDpClfOWBdCZ0qFHI8Nd1WAikakRzStPlxG0TwXPUT3/DGM1TB+jeMY5hN1KNSQSbxzxLvpr74HSF2FQOMXhcTTSjPrPuRPE05mCPfVch9ITx8FplliPOCR6ouKVLrum2/lnVtvqnd98GrpuxSjtX2ox348Bk0shUJCM2PWjqBilWZv3SNBh3QO2KdKmV37oszGDHUgWzrlAofVWqWU/ROw9d7T0VSRg+ObZHLWUYk6RwbgzmxWAQOKDmLceHzsRemb2UQ6kLzr7ERPTo9gYNYiGaBOw/iL6hXMLhfWla4CNbTZ4PkB4oxCmWIk1OMQAvIvNJuhNuheiSpx5USQLG6WVNB7P2JbZsz4fA8QHIh0pfuEcB/FKwWvrWBguAPLbW9lmgSs0NZEt/+MnWp3Vin7hRU+wIH17ua3ii3dUsx4a6NHW8tb1BY/XqDR8wiBsYwbFj3t5zYfkARJNqqVpzQU9fxU8pWw5wQgcqgHRLNkdHy9gxHlYZPE3WtMEcUnvLqu18h1uw0AQOGlJ1cShh37lUPHSLAv6Zqr7NNtts012F 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)(136003)(39860400002)(346002)(376002)(366004)(396003)(451199021)(86362001)(36756003)(2906002)(2616005)(6486002)(83380400001)(6506007)(6666004)(107886003)(6512007)(1076003)(4326008)(66476007)(186003)(66946007)(66556008)(316002)(41300700001)(38100700002)(8676002)(478600001)(5660300002)(44832011)(8936002);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount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px42rn/ykKfFJOdN9FAxx5FkASoaPN2uALW3JNYW1CM380kEj+3RChsqNywssWeq0QTSO4G83HhiddioEpOyDqEwPuUYw0MQwczOctdPE8bBT0+lbURD4NeFvLlE6s2gRYmRcAgtNjzBgnUfCR3cswXwGk44YtWKMIrR0tisD7N+W0e/7CkpbRkQWSt6vvvUdSbgXcNsCsqckwVLSKHYPWsPl9OMKEb94bCnwafPS3Bd9lepBBbaKJ1Tuex6gJDMunVMpo89gopK1ukhw8xZAvoERNIRj/DjC+RVm1Aqk4krueMHF+MNG7hqRtnsCVR1U3uNKRpQ5wJWSwjuVENGTFpFI9EGGbUnyAepDhw/Qh/blJ4nStaeg+lLU8KAR7TJIQpV7bJPdKVFSZeGunTC4vD2riSBpDSMMK00x18uSIlYfX1I1yGVCW8tIHq/EfmL7QxfTFqLIRr9yyumqdGx4vPNHJviqeJA/7mBmmijlMD4wQapb8FZIp7ycUI7fAI2VRxjo4LupM5j6O68BbfxUbqilYGDJ4zyfzKhnpZ0NeiV8NACtQ+NT9up94ZPCHSdRx8= X-OriginatorOrg: oracle.com X-MS-Exchange-CrossTenant-Network-Message-Id: 4c7efd63-2d3d-45da-5a98-08db58b4a6ae X-MS-Exchange-CrossTenant-AuthSource: CH0PR10MB5113.namprd10.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 19 May 2023 22:01:51.8937 (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: tKcd9ebVoB2QPdiVEYmVAFWRSHSkE0/fWuz8nzG3ZRhCiwwxOxce2mbOGrtUw/RrieZCw4aGbG2hpW2eIkzilDqN1y2tc4jeVoe7+CeHNnw= X-MS-Exchange-Transport-CrossTenantHeadersStamped: CH3PR10MB7862 X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.254,Aquarius:18.0.957,Hydra:6.0.573,FMLib:17.11.170.22 definitions=2023-05-19_16,2023-05-17_02,2023-02-09_01 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 suspectscore=0 adultscore=0 bulkscore=0 mlxscore=0 phishscore=0 malwarescore=0 spamscore=0 mlxlogscore=999 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2304280000 definitions=main-2305190190 X-Proofpoint-ORIG-GUID: Bzby6xGu6_4T6BllsjrEGRaz_bY1NLve X-Proofpoint-GUID: Bzby6xGu6_4T6BllsjrEGRaz_bY1NLve X-Rspamd-Queue-Id: 3A5A61C0014 X-Rspam-User: X-Rspamd-Server: rspam02 X-Stat-Signature: xz6tpzmtooy87hw1sqy5sfkjz1xkxi3x X-HE-Tag: 1684533741-477795 X-HE-Meta: U2FsdGVkX18eepiRfljrXc/WQB4CEupQKQSOKgCXnz7j2Kq2C+okW+/zoEcJry39XI049v4h1C2GLAFeIA9eGK1lNun3Pq+OPeApF4abEv6IkrQ/c4U99HbodmkgkMTheNiQabQfumlb0UbdsyWj13ZajLXm0cAz8WWIwoWyV3kElIJ89YD6ILQ8PME0pCSp3UT0qZLZY8p7hwR1Ia81eQgiS2VBkRRKNSCkY0miTsD/BGlYJzx45qgrp4noMul4DW5/+Kq5QL/VnWCTalMLTNBhuUhGqlKIVDhUNceILSy0hxKBfOxxUONjs4l5fqHChJL28WSqPwxxtqESYquIwMxB7t7Ntuxyk8y6s8aLdBp525tPQjcGSKmARVydVCDYVFIb6Hcc70C0VruxIi+eQIs3Htte01J1PuVFnFV7Nu/n/VeQVSQLNvvHHwSvqgUmkhTEJfHkmL0bjWBtLwlCmrdG3KhAJDmjjxuN5JW+riiZ754+QFmmmLLhH/HDruNMkfkuSh3ZJrMbFwNcW3jAzm6xBwtFX71DXUDXivQtd5iMK6/j4kKcQsY6HTVstNCAasOBcadZLnQ2Vq6eZCTfKd8jnFamuWFDJYJ1RuEXV/AX+XjJj16BjWs5iUW8WTpPuCleXRobigYd2ozT6LMcUpeyYnMuglAnSa9GJ+PqcrQCyDIiEAA7BBUXsVABjX0gSrYY2bZLqGWwN1eDz+hI6iA+3USWVdx2XUsvUgmQ/VRknm6FOGFbaC3B2XZVSPgvd84cbrxiOxEV/ZiYFQuE4SPq+65NtgazCEKC/rUBFLYhflqOmlmJGzeT1IHQRIYjHQr50rGseCkNEAvGzJ2TVsgC+8XFL3cDY5N0Zy/vkdGcPaM6Q/+StbS8X8+vLpdKY+EyeD0tQAv1uQ9iuLgOhwf5pJCfWLNiTOgTwtHwAVYX/vrK6lLXSTCFAZBUvrZWsklVkm+6oyhKuX2wivE tCBUgQ5w bqRMZgIaey/pImMlHG//5qGYBUkogK677sRJEPWMKc0o4AdhtGNq19moyllbvbReHvNPXKrg3p82Bp4F55eTjB37kRyvv4JU32YO3JBjY8a0gmjYLjaMDNZfODj4duE3w/JAzyog96OQ/5Ia5FWbpWwryt9CjI/+5lyyAYWthqdJtdbGf0yXh8u+YcJ6RFvD6jmBEAc+MAGvHmg4rP7Z5Zvd51I1Tx9Dj4GxQYpD4KLE8tGx4e/YVt/OTG+8uWCrbdHj+mnvnFGJ77JQuptB+IIAkqdVBUcPVGYcpDK08EQ2T+pFFz8xqGf4aWdm65kNXLX0QOH+4fBtJvMOj1AS9KS2TuNqSfTjWz5XfZwD0R6VS1+zZhYUHZLKRHOsvdbBhXQJIjtukBfcKQsIx3ANReANzfGdeJ+A2I5PTocreSSSfvDg= 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 removes 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 c1ae5ebc375fe..7ca967849c2cc 100644 --- a/include/linux/pagemap.h +++ b/include/linux/pagemap.h @@ -719,9 +719,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); } @@ -846,12 +843,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 570bc8c3db878..12eee69240525 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; @@ -2042,7 +2040,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; } @@ -2106,7 +2104,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; } @@ -2147,9 +2145,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; } @@ -2175,7 +2170,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; @@ -2225,9 +2220,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; } @@ -2244,10 +2236,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(); @@ -2285,9 +2274,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 May 19 22:01:42 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sidhartha Kumar X-Patchwork-Id: 13248919 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 3AF20C77B7A for ; Fri, 19 May 2023 22:02:27 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 92F5E900004; Fri, 19 May 2023 18:02:26 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 8DF7A900003; Fri, 19 May 2023 18:02:26 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 70B64900004; Fri, 19 May 2023 18:02:26 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0011.hostedemail.com [216.40.44.11]) by kanga.kvack.org (Postfix) with ESMTP id 5E33A900003 for ; Fri, 19 May 2023 18:02:26 -0400 (EDT) Received: from smtpin07.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay05.hostedemail.com (Postfix) with ESMTP id 2D30B4070C for ; Fri, 19 May 2023 22:02:26 +0000 (UTC) X-FDA: 80808379092.07.DE38A86 Received: from mx0a-00069f02.pphosted.com (mx0a-00069f02.pphosted.com [205.220.165.32]) by imf03.hostedemail.com (Postfix) with ESMTP id 89D2820015 for ; Fri, 19 May 2023 22:02:22 +0000 (UTC) Authentication-Results: imf03.hostedemail.com; dkim=pass header.d=oracle.com header.s=corp-2023-03-30 header.b=w7BdMuOX; dkim=pass header.d=oracle.onmicrosoft.com header.s=selector2-oracle-onmicrosoft-com header.b=CWQeke4r; spf=pass (imf03.hostedemail.com: domain of sidhartha.kumar@oracle.com designates 205.220.165.32 as permitted sender) smtp.mailfrom=sidhartha.kumar@oracle.com; arc=pass ("microsoft.com:s=arcselector9901:i=1"); dmarc=pass (policy=none) header.from=oracle.com ARC-Seal: i=2; s=arc-20220608; d=hostedemail.com; t=1684533742; a=rsa-sha256; cv=pass; b=g9gfQDsq7AqVt4pJJvf9eRkQME8j/vr7PE2LY40JpdLhTIGXoTJNlihtWL9+qbOcYWCJu2 V3qDh/FZlSnK1HdUrkITGppGYqgz1usj1g3bVpIqE65c2YQFvpWyjZ+GN/uYaU0yAo89Kt o1r8dsPprGpZ/i5oX+P+9XjucguFr0Q= ARC-Authentication-Results: i=2; imf03.hostedemail.com; dkim=pass header.d=oracle.com header.s=corp-2023-03-30 header.b=w7BdMuOX; dkim=pass header.d=oracle.onmicrosoft.com header.s=selector2-oracle-onmicrosoft-com header.b=CWQeke4r; spf=pass (imf03.hostedemail.com: domain of sidhartha.kumar@oracle.com designates 205.220.165.32 as permitted sender) smtp.mailfrom=sidhartha.kumar@oracle.com; arc=pass ("microsoft.com:s=arcselector9901:i=1"); dmarc=pass (policy=none) header.from=oracle.com ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1684533742; 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=Njbwma2Ugex5vnmCgsQkoGChOZIzUiszaD9F/su4h4I=; b=lqPtIE7G0x6Fmxg0DAjRaZYnAgfezg6t/VGRzK7eqvcWvRtt/S+xVbWah1Qtn+CUoTDAbs KaRAzcOCN8vY4SIu0V7aCaGc2cAGivpDyP+YNTyiIoXh15oe7V4e5jfXn2cuGTMYBAcrpK D+ChBkQNGjBPU52sokgy6UnOEnsr6Ac= Received: from pps.filterd (m0246629.ppops.net [127.0.0.1]) by mx0b-00069f02.pphosted.com (8.17.1.19/8.17.1.19) with ESMTP id 34JJEaTx008746; Fri, 19 May 2023 22:02:00 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=Njbwma2Ugex5vnmCgsQkoGChOZIzUiszaD9F/su4h4I=; b=w7BdMuOXTWvBSHc5D5PWVXD1jmK6aD8FmcN3pyZ3Nd0hK7eGVWfSYNLeykLJLJPEnxvB 29CZ1J+clisMjtMkceqNgTF6/66SD6u4rydTMatNKcI+rwZ0KxC8bRTQybnx5QjkV93m l5t3LuzfqWNnkcL2dZSyH9d1QgeEgnJWTK+S5lKZAoYSm900YdjfYlwoL6Nk+VTnDHF2 fX5QpE+WR9OA/W95DPynoVSleKW3a3ZX8qe9wlPbKxtxdYh6kFuAGqOUt25OxbU4rQ9t wwynzycokALj0GzWjsSk2yIa/bKByaoFaYt/dSPcuRngJ3oPLS+q8fEvP87nuz1tXP+S 1w== Received: from iadpaimrmta03.imrmtpd1.prodappiadaev1.oraclevcn.com (iadpaimrmta03.appoci.oracle.com [130.35.103.27]) by mx0b-00069f02.pphosted.com (PPS) with ESMTPS id 3qmxfc5wdj-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Fri, 19 May 2023 22:01:59 +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 34JLmUf8036536; Fri, 19 May 2023 22:01:58 GMT Received: from nam10-dm6-obe.outbound.protection.outlook.com (mail-dm6nam10lp2102.outbound.protection.outlook.com [104.47.58.102]) by iadpaimrmta03.imrmtpd1.prodappiadaev1.oraclevcn.com (PPS) with ESMTPS id 3qmm05mgxb-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Fri, 19 May 2023 22:01:58 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=MX3C/H3nQrJaMLTnel2I7QooRvjVQvnoC3/MS00a2m7gcq/4/fXRw4eY4UbEZQayouWUtaaDkMsECe2w7KqhS+bM09+AktPwxOVvixkHu+mimf9fHHgFlkkcJpqbta0rasDRWuLj9gjp6PlX2imPT6kFupl6hDMeHQu40fDXcBVGS5XfEn0G2nijBKCrsgcA9wbgR4riVXsk6HLiS1V+6LwHs2DyC4a/Qo+B0bZWgDIbEzyjFR6npcLPjmeY1JjFewDcmkHwRVlgeUv8MQ79oBBy7Nkpq5NhQG2eqVtgOIVc9uhXcH7Ch6ArxFIZc1MaUuJggkCh7NZ75zuqUE6tPQ== 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=Njbwma2Ugex5vnmCgsQkoGChOZIzUiszaD9F/su4h4I=; b=h+wNpcTySl1eYGO3oBJ7z7zXLbtJ7t0Wx6e3OMRFXMvRAwexVW8GU1T/Hqb3zu3o6LKUuP0mw2qVvE+FeInmdsr2FSEUWU36NR8KZVIjEtgNKJB8tH/nGpM+Mg9cCtJgCC7keSxam92Cx1CJglQZ+dOBwrrMAHTJOR5H2mD5cdcpOnMGkpmvWJnnIl++zvmrhNcNgdpwSWSDpApr8yXE0jxdevUpyDtDV01p3Tfc4DvkEtqqH7dy8q2n8ef0aHFsOoRgC1sMkV/+PsFQUPsZgnguPQwaJXok5OKb0y6DHe3UsItGC+kpYQB4nr8Pe7/DY+oG0GtRJJ7RVPaSkSby1w== 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=Njbwma2Ugex5vnmCgsQkoGChOZIzUiszaD9F/su4h4I=; b=CWQeke4rgL8Oxcl+jLXPB7HtiGxPVdmI5YUt0M3AlA9C7Ju+MBMN4yNIDi14wogpHoaWqEJPwMyCb7k80lyI/BlPgwPV6hG2VfFgxBgITWPU4PDxssX5g/iXMYnvFTWTxBhYaSttlwg4yxWojsHUoH1wnLTi/HA+u8Q679ksvl8= Received: from CH0PR10MB5113.namprd10.prod.outlook.com (2603:10b6:610:c9::8) by CH3PR10MB7862.namprd10.prod.outlook.com (2603:10b6:610:1ae::20) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6411.21; Fri, 19 May 2023 22:01:55 +0000 Received: from CH0PR10MB5113.namprd10.prod.outlook.com ([fe80::12d3:3f71:5b55:c342]) by CH0PR10MB5113.namprd10.prod.outlook.com ([fe80::12d3:3f71:5b55:c342%3]) with mapi id 15.20.6411.021; Fri, 19 May 2023 22:01: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, Sidhartha Kumar Subject: [RFC v2 2/2] mm/hugetlb: add wrapper functions for interactions with page cache Date: Fri, 19 May 2023 15:01:42 -0700 Message-Id: <20230519220142.212051-3-sidhartha.kumar@oracle.com> X-Mailer: git-send-email 2.40.1 In-Reply-To: <20230519220142.212051-1-sidhartha.kumar@oracle.com> References: <20230519220142.212051-1-sidhartha.kumar@oracle.com> X-ClientProxiedBy: BYAPR03CA0023.namprd03.prod.outlook.com (2603:10b6:a02:a8::36) To CH0PR10MB5113.namprd10.prod.outlook.com (2603:10b6:610:c9::8) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: CH0PR10MB5113:EE_|CH3PR10MB7862:EE_ X-MS-Office365-Filtering-Correlation-Id: 81e4c0b8-54c9-4323-8e42-08db58b4a8a0 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: GnPkATBSnVOny5fVvhfYBUp3s7ppFwjtAm2O8u0PzxBzQT68oHdZWWhxbS29XfXtvUTbPyzGN+DSTYiiZnvS1TosmqG5kC7xHWZ6KzCrRXKr9RgasWABDJMqcHbCoMRFHgJm53C31oEqcpT9BMbv/ObzLVj9VBtp8Tu4uoZhHZxFF+WDeUpl8aZTvQn9eb0c0f0ljzqrumOjap6yCW0qwFvahjq68UDPAN8eEIZ66TNz9tF1/MAgHlGkSbUDEJw6idxeCY2uu/jPzIPbLBpnrKl6boaLLnnzS8hpE42anlBEAMpnmD0d6ph2A48CSX7dFOCB45JQG/N7y00NZeBaKMXcPh7Xf4kR+56/R60tYC737bACp08Um8IzY1ihi/OKa9qGncnw9pHwl6ciyLc4zGDhgJtKiaeolFZxYA0NhHQhcB7zGvQJ1ghtIcwuxyq56Q4phmuw5ZW0lOOSjZY28/erMmePsh9XN+igf6htpfG2jtLqvE4ob9Q8OTtQgX56r3XUO3nchqFqAw20qu6lH8RWlqVHGKrtoM+Cwvbaus3iNeGlpaNv04Y7nUqgbPcR 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)(136003)(39860400002)(346002)(376002)(366004)(396003)(451199021)(86362001)(36756003)(2906002)(66899021)(2616005)(6486002)(83380400001)(6506007)(6666004)(107886003)(6512007)(1076003)(4326008)(66476007)(186003)(66946007)(66556008)(316002)(41300700001)(38100700002)(8676002)(478600001)(5660300002)(44832011)(8936002);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: j240zm75oq3wf7I92zAl4GZuleCXz/ZUJJPq9QMbjmLEFeCtEab1lUqrV5kV9AfX+G/WUMPDyTUNS4hMp3wxTDdC19U9XWtKrbLoBdOD5M3Ey/IB2bxHvkY/1O3ZYdYtNxa9V31hOZYedpGmXIIC/vz2HRH+rwh8AZB7AmchsgQf30kjvzT87HoCsGIqWLB4tUNZ8obp9vHuJtdEb0qQzRGnkTOTk6hzxHGhjc44Ut/e0Dy715rndxfBfLEsb+WLIdyjBmEoNJEofJdc0vQAZigJe1c+Slj4YmFPOTMvS5anSH36fu6ZpEWNiGaGg1pEv1CfRwurS7gUhp/ytJFK6lTMTHz+oSwlsCDa47TA5SRXomjR3Eo84xzwW0buf/rTPnqMsT2mpQ0B/FvSEKlZcw9dX33gM99R/UEMH7cc3KqQW9S2vBH0+pu+BEx4vx75oT5Zw/LaI8aVcZ2sXGrS7oEXQsdEysKo7FLXlmHmyTnZn9S6jBGFd/I918Yk+9P/lZo7jcz/aYiib25MTpWmNyp8vwNF0WOuuuOUiD3bNU8qrM+xVDrFG0ewIUeER12Sy2z0dt2ZOKJPMyREAB9T+QaaZA1ww4itztMPwx3qUphOoHNVulxXxs8SSqyIoxZSS79PriAiEiE1kyqwBAIX72wDNfwKL4Z7lGjdI/95IkoK+7xJKAapQsV1YPUvOo1VIaFTGqYex523gDPyt2Ya807HBhj/6jtX9iS2n8vS18Oo0GK2pBlDOGXpYhGsuwUbPXRijt1G3VAmjB+U6Ewmmif6YOtseuJZ5KHMi0IYAJHP2nWcGfUvxm/m5GMBJuCnMBlvpcb9vQrCOdB0uoCF7uoEfetmiT/PMpkwiF/l+XIKoonABaz4QHBCKG8/DMdqVnnzQB9Z9TCGkwPkiCuDrHAbaZUszyN+vwmQRbR5JtdMjGVySTNug9z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64rg4sGE33NW3GGckF3DqRFiWJFRwojaOEQy9bx8JO7POXOVdWU9dMqi6H1JDQbDpsogXaosgqA3npaRRuiwYpL42PZiBI1vaq/njVCBaQkfUlYIbSzIJupDjNK6GrGnZTOd2+xbMNVIx3Jgrk7fVmOapHkVxeYl1FGMsG1Rq3AM11tqZOsesRE/2YKV0rtR2ZicTM70bmEZYwwe338zqk0jo3xnvNFOe+Wrlu4B0MsKzdOnKluNgiQPusR+koGoPIzT+wdJ/izOl31vsRK6kYTeM/lw/YvrNpy9haIt9EzA0t7j4a/SBJfEU8Of4LN4sAMvx2dEoy7nwFbLoa7NVIkLY6QeZ9DPmmaTfYanfC2Mu4TKnC4+efhqdzzeh5cboDH5l8kX3Ye1Dlm68drGiBxpNjdf1yX0Pmh0O+rv+u1T4RUu/jEMbfvya0kMCOK8N563i8vrA1fS0dvOX+FplQc8nEZLq485AUwhpLXzcMXyG7z6jTXhKJF85PyevylAAPqCiG3/7n+b+CcprnQhUddqiO3ZsqMoI55N+CUOaRAqshJsj5GEzZLjQ8gOw20v49fxQxDx1nvYb8owNzEhWF4sfzl/YfG/B21hg7P9DWbJLyS+g2te6HMVNCFRoWn8Akg95msz7+cdS6d/GQG94PcUEmJ06IcO4O6TyZaDBfX4w= X-OriginatorOrg: oracle.com X-MS-Exchange-CrossTenant-Network-Message-Id: 81e4c0b8-54c9-4323-8e42-08db58b4a8a0 X-MS-Exchange-CrossTenant-AuthSource: CH0PR10MB5113.namprd10.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 19 May 2023 22:01:55.3636 (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: FtUWkY5Qzgu2wmZ15z9uAYM1FzORBFxfWAjJF71uCocYVm5770AsXVNJ50itsu+7/yc+m1Hx7vilAY7xV+o/X0iWY/IFfdSkHOKZ5bGskXo= X-MS-Exchange-Transport-CrossTenantHeadersStamped: CH3PR10MB7862 X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.254,Aquarius:18.0.957,Hydra:6.0.573,FMLib:17.11.170.22 definitions=2023-05-19_16,2023-05-17_02,2023-02-09_01 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 suspectscore=0 adultscore=0 malwarescore=0 bulkscore=0 spamscore=0 phishscore=0 mlxlogscore=999 mlxscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2304280000 definitions=main-2305190190 X-Proofpoint-GUID: TgcbY0MHEnD1NzpsRjjN8B9le0tibHYt X-Proofpoint-ORIG-GUID: TgcbY0MHEnD1NzpsRjjN8B9le0tibHYt X-Rspamd-Server: rspam08 X-Rspamd-Queue-Id: 89D2820015 X-Stat-Signature: p8dtsi8uqdni5tk6hzoqadt4nqxuh9wt X-Rspam-User: X-HE-Tag: 1684533742-675135 X-HE-Meta: U2FsdGVkX1+4/2H3lc2XM62cMT2kdx8/ROPGbZcuI+c7pK7Tyg/QQYoWomw8hLxdetpEj2ePO/9z1zMMo1ZdeO5Tp1z3yYkUmGAe/Y4lRD8NhVE6UaCwCzLjO0n8cV0nBB/TLbQvJbKOvQhdqRusnRKLhL/PcD7djhXyjlIIQTLRUfjuc+Rc4h9oYxt90XSxEJYF6F7Vi/mXjxTg5K05isnlUB91uaedzmhWgr7LqeOOZGOH2F7GrbVf5850x4QnbZqy76hwkTQ4jlLEY/cBn9I297vrMaMwSDuoJGfezZRqleZfhZYfjxNauVMbwRb1Kh4dyCiv9enZ9MvxmVLHDkwR+NDl8L7a6D5Er2hmkJIXz/11KTNVIwerBnAS1Ezn1la3JMIr/CfDK8Oja9RXGeB4L6fGst7j7WRoScZiGcDwXp7Fs8ab8yNdwPb22lcwlM6sAhuuu249dCx04Pnl01VXlihmIbR9kgIxV3fwaPkYYbMQ0fSK8vdKUR09Se2dEIR79Rbazg2CFGkq4EBorNJvgMvMOvCair+ZrEhmuwWgA8p7FnjkG34zC/M1Da3Xg47gdTx+cWrUqCVgb0/RlQUlpkGCIZl48avdp1o4selgwJM5PvY2XhcIaCmiUM8MxRBst3XgLxfSu7NVuTEaAyW9NINMeE9zdK4D1tHhqbNR09FFpcmCdJFf6O4tyeiDmCeTQcvpJGIEvXwFvzdbmAvNzVKLMlvghd5orJhGHd/3YUVaeHp+E3o7Qu3+BpuverwgTv//6mClFP4nk5HspQBKPoWdIZLPLBYk/zrR6++66k+y7wbvhnMx81FdggfP+MdFE5rKyO4BWwJnX9KzPbaEPO/searDLncBUzxIqTPRjrmQyc6kJXBi8xNPPSowym8TnWeMUNoAfFHwPpj62H6I3pbn5DxQ4wWLkg2wgS1597rdPPCIrXQQlFvAWEF3Nj1VmSBMu1BOVzmjeLS EcfW3ZOn 7yqWLqVf35TTdCGmjwG0gLnSruuSAfLyvVXKrdxmGNfmdW5LFZPtrxOyhZvVIJugdoP2iFg7q9qNXjejqAuo0ZvfWVtF6Ip6EhlzrLz01fY5PlQNbE802DnicPOR1dK6ihA6Gh4a8uD3KzCtMg44V+YYuCCC+fCJ1i9/bPaR22zlFMXG0P9lHVL0GNEpzmVshUXXCoF76Te1ObWRiDsshC1wQgVnnB9lA52V8M67OQJVFJHdm5Uw+L3J3nLHZ9dbwPsZyHs3cI1vPH/cmwiAfGYL+FKfLMdfXGy+/A6DNEdI+T6TstFbf6X5tdZU6Y5YLx8gyeMT8OtcvO9KZHh1JPgnLEFbgwp5SzuY4Z4clZ2amoZw1wDKFPn1zlRElQL6dKHCs 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: Add filemap_lock_hugetlb_folio() which is wraps __filemap_get_folio() and passes in a linear page index. hugetlb_add_to_page_cache() is modified to also compute a linear page index before calling into page cache code. linear_page_index() is modified to perform the computation on hugetlb so we can use it in the page cache wrappers. 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..204a9510510f1 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 7ca967849c2cc..86f7b180d2521 100644 --- a/include/linux/pagemap.h +++ b/include/linux/pagemap.h @@ -856,8 +856,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 ea24718db4aff..5abab61af0ca5 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, 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;