From patchwork Thu Apr 13 23:14:49 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sidhartha Kumar X-Patchwork-Id: 83126 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:b0ea:0:b0:3b6:4342:cba0 with SMTP id b10csp2416vqo; Thu, 13 Apr 2023 16:20:13 -0700 (PDT) X-Google-Smtp-Source: AKy350a90JeKjXIGQbg9ZRjRfYe8+e4Yl9W2700fZ467XT8AGCw/SwrpBSIhTtylTGrygZ9fKRat X-Received: by 2002:a05:6830:1304:b0:6a4:2cba:1eb3 with SMTP id p4-20020a056830130400b006a42cba1eb3mr1864142otq.15.1681428013168; Thu, 13 Apr 2023 16:20:13 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1681428013; cv=pass; d=google.com; s=arc-20160816; b=VBAzhn2ZhpMBjtU1xJjCCr1k94Obdcoprpz6vDdvpolMtQu1APgBMIooZD6LvzlRZ/ 4DrmJNJVC3EY/LYcx7oI4rddyEgPzEpgsBu0mOL0aPmR1gxNs52Oz3B6J/i0audmDivG 9yWd7LtXjdJKJePwZ23lYvnXsI3+HPzX4U+OHO0XuM4sztj5654i8isusoktR2j3meKr YwXQGT/Pihpkx6v1q7EqsGciD0my1pMpThRySZokz19jpbkP9Si6Z+32GrBpTm7B0gMu 8odP1a5QoZTmJGclABBwQdSwtbciHBs/XSaI+OPapXuJMB0oaTgIQgqeSETjLUoD4FYx 1/uw== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:mime-version:content-transfer-encoding :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature:dkim-signature; bh=PRIpQsJtmpDtH4hp/QDArazlqT6QZEBMdTRXKdj9SoA=; b=UIj1eQlhHgMgLdY3sonlohW0QZZreqR3VcxAwyaerNTq6wOuYAwO2l7YtIB7FJ6g7Y yuHPEdFADlWWdD4a+wjEiHYHb2ABlgzS7LsWsw5OwwEmEaYPShNSgvQRagdY/hvo/NBw abITAIy36bNyfPkLMMaWzQfgUGXKDrI9EtKXSosBZiBmE9bqogD6caJ3rqZ956w0M5G0 Y4ijQQhRScdywXTeOqykh0k0FwhD2+qpkPCaMM97D59TrHC/0HVsDZaCydR9WW33mEOC sgwf0Worc5kiUuotjHcJgzzRmabJpG8iEiokcZCHAKXjM0I4tSU5EY7Y7PktjLBWbric O+9Q== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@oracle.com header.s=corp-2023-03-30 header.b=RtzKl0p7; dkim=pass header.i=@oracle.onmicrosoft.com header.s=selector2-oracle-onmicrosoft-com header.b=GCSubIwn; arc=pass (i=1 spf=pass spfdomain=oracle.com dkim=pass dkdomain=oracle.com dmarc=pass fromdomain=oracle.com); spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=oracle.com Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id v1-20020a05683011c100b006a14aa6116asi2643003otq.37.2023.04.13.16.19.59; Thu, 13 Apr 2023 16:20:13 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@oracle.com header.s=corp-2023-03-30 header.b=RtzKl0p7; dkim=pass header.i=@oracle.onmicrosoft.com header.s=selector2-oracle-onmicrosoft-com header.b=GCSubIwn; arc=pass (i=1 spf=pass spfdomain=oracle.com dkim=pass dkdomain=oracle.com dmarc=pass fromdomain=oracle.com); spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=oracle.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230484AbjDMXPn (ORCPT + 99 others); Thu, 13 Apr 2023 19:15:43 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:47372 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230388AbjDMXP2 (ORCPT ); Thu, 13 Apr 2023 19:15:28 -0400 Received: from mx0b-00069f02.pphosted.com (mx0b-00069f02.pphosted.com [205.220.177.32]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 894EB120 for ; Thu, 13 Apr 2023 16:15:26 -0700 (PDT) Received: from pps.filterd (m0246631.ppops.net [127.0.0.1]) by mx0b-00069f02.pphosted.com (8.17.1.19/8.17.1.19) with ESMTP id 33DKxFuS000556; Thu, 13 Apr 2023 23:15:03 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=PRIpQsJtmpDtH4hp/QDArazlqT6QZEBMdTRXKdj9SoA=; b=RtzKl0p7ZNwaWrvILRt+MQyJufmn63GPdkgum21o9gE9A6KQXKksBGcHwEawLkYkscSj mycnl7oYFp0hCergK1OxftAoZmIERPKSPuafEmkG8m9M5I/20ZoNTMqw2g1SaXKE5gGo qWJIkP5ty/6+eFLNa4ARKew3XEnYx3yOz0/y851NFI1wiioj0vDDyGMgNGM5nH78GI1S L9CxflTy1yJnyaRp+pjHjoAvngad0UELUb+wkLc0MuQ+4Tto76cnEYsMHgghLap1/f8K l/rhNtfVBFwLrNUi1lZ9Gr8lx3vr0bLDEnrW0iFeLz8lySCA/sAZAi5GKHWd4a+VO5Ey +w== Received: from phxpaimrmta03.imrmtpd1.prodappphxaev1.oraclevcn.com (phxpaimrmta03.appoci.oracle.com [138.1.37.129]) by mx0b-00069f02.pphosted.com (PPS) with ESMTPS id 3pu0eqcuhd-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Thu, 13 Apr 2023 23:15:03 +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 33DL8UqK039696; Thu, 13 Apr 2023 23:15:01 GMT Received: from nam04-dm6-obe.outbound.protection.outlook.com (mail-dm6nam04lp2046.outbound.protection.outlook.com [104.47.73.46]) by phxpaimrmta03.imrmtpd1.prodappphxaev1.oraclevcn.com (PPS) with ESMTPS id 3puwbsfhdw-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Thu, 13 Apr 2023 23:15:01 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=cOi7SyG5iazmulGDaErNNq6dlPGmUK+JwSKFhv5NXCvyu6uvADDBRCKKm9sQXMGcMJV+VQqNc5yV73faQyWcZvt1Ek5bqKWhOiGg1NJwirFXz1FLK6DL2SEZfsUlJS/1NrXI+9nZYUOn7DZNMYdwf9yoyXWVES0hOeK/xMPfITqqP4wobL/FXGCDn0WqieWUqCvhaqoe7xcaTfr6sk9N+1BGs+z0sKlCpCJmEM7ywyC1rPKoB/A81fXpvoLOsVjRUgFyV+cJu5R4VRndN64XPACFHtHqNeYE3gkYHHEkiOdzuWizquFwdrMYaHRbafdGIQ22B5l2W7stvNf66In2xg== 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=PRIpQsJtmpDtH4hp/QDArazlqT6QZEBMdTRXKdj9SoA=; b=Jmd6HVDle4AvChDG2L+U0BtsIscis/2nzhqOqYHmqCUPVe3U94f+ihM8QS7KgORW7zPy02vvSRdKjo0l5Pk+zKwG3yzSQmIQKJHXgCEGTo6K40H2o/KTjdlnPzyeC2seHkVMd/2ONBeBLDXMWS3NtTYCmAqvTr7qhXOmKuEbSSfVGcyGsmGcUNOrXU+MgDRWGPg7owF+R6ksNybGRgbglvxjNsZHMBMHrwif6SutmxVSCDQoUmsaV0rxQn2OPQvumUp/tFpmFFQxj+nG10FS2UOimBrBuu0MbMVWt3zvi5oiH0BPG75Hc8ne3xYXDYkezgJmmzjktk5gC75iKLgbmA== 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=PRIpQsJtmpDtH4hp/QDArazlqT6QZEBMdTRXKdj9SoA=; b=GCSubIwnKa5WhqPfN5B2ZqpY2+IeFg5/LXj81ESwKBsTxMSQQkFhrz1q/tl0tFHFnygrsIoHpcuGzhm3+TmepKAua23m0iB9FASB8c8ZR6VbWww7+VaG8t2WBXV9qe0HOM+0gtr7ug878rdDxIEjQ+wkVp3plQ0mQrbJ46ZTf0Y= Received: from CH0PR10MB5113.namprd10.prod.outlook.com (2603:10b6:610:c9::8) by SN7PR10MB6287.namprd10.prod.outlook.com (2603:10b6:806:26d::14) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6277.38; Thu, 13 Apr 2023 23:14:59 +0000 Received: from CH0PR10MB5113.namprd10.prod.outlook.com ([fe80::12d3:3f71:5b55:c342]) by CH0PR10MB5113.namprd10.prod.outlook.com ([fe80::12d3:3f71:5b55:c342%6]) with mapi id 15.20.6298.030; Thu, 13 Apr 2023 23:14:59 +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, Sidhartha Kumar Subject: [RFC PATCH 1/4] mm/filemap: remove hugetlb special casing in filemap.c Date: Thu, 13 Apr 2023 16:14:49 -0700 Message-Id: <20230413231452.84529-2-sidhartha.kumar@oracle.com> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20230413231452.84529-1-sidhartha.kumar@oracle.com> References: <20230413231452.84529-1-sidhartha.kumar@oracle.com> X-ClientProxiedBy: SJ0PR03CA0154.namprd03.prod.outlook.com (2603:10b6:a03:338::9) To CH0PR10MB5113.namprd10.prod.outlook.com (2603:10b6:610:c9::8) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: CH0PR10MB5113:EE_|SN7PR10MB6287:EE_ X-MS-Office365-Filtering-Correlation-Id: 1c96e82d-37fe-497f-faad-08db3c74e6d1 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: vdtDNffrFn9g11lYomChjMKhgY8OdTRgSVb12yH0sAwbtR/MZmulPH79b7qk7cGcdWSBfqsZdqSalt06ca8qyRu4SKWiyGvnPqlMCAGD6UfcwULKuo53xSKaAjWrDezW8/Q6LH+6K/qfUhYamGRQ4fZ5j9XIxHMk1vS70xc2WEsIhtRfP0Y2IjPwZjGeZfW+bGvTvkRh1207EgBbSkR2TWAlUSIMeCz4tacqyOQyvIhdQ5VQ8AffkBwq0swcu+85+t4zkLPwCzJGcJrby8sWITU/NMH0Yv1kHipmhskRUxat19Uo4dDfBG3NxNI8XK2gNr69nkfk44vI5je4n9l1iuaLQh+G8jF/7AJpej2Kgyphs/2hyXZYb+tvldhQa75uesxwbTBVmVe7VZVV5lJMNhOWcT3v6IDDfd1ipFYQZCyNnT9bb32CGV5tccXaSmMXstNMowVl3tJ65Gletc0KEgppH7CbiCw4xlTZZwZT5kkaoS692R8LJsSWnXwOacFKty+4ErbShAysZ5Fq5aMNGJQayUMbE+ddG4QixWDoxG0nKYzoe/Ea07rKWJdzysin 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)(39860400002)(376002)(396003)(136003)(346002)(366004)(451199021)(6506007)(86362001)(6666004)(6512007)(107886003)(478600001)(6486002)(1076003)(186003)(66556008)(66946007)(66476007)(4326008)(38100700002)(316002)(5660300002)(2616005)(41300700001)(83380400001)(44832011)(36756003)(2906002)(8676002)(8936002);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: 5AyJ1y5HmjabXx1w4Uaa344D2qwMtAyFqjb4IIAkK8Ry5VH6PDMCjseokjVIIGJTVlSZYt7l7SXjk9kduD8zv9I51JnKOyQ4xqW2EVwMm3kQbR3CRFkNcbPrcVVvD6hKXfaYRugFab5H5j62qfGIa5IN1SvDGgsk8A7+6hRX+/9pcTrrRAe6i3z61PS0eFaeQwiePtgW58myP0W2IlGBT20aLG1SmQrm0Ww2PZuYCQmslWt91/RI8PHG7DlZ3D6MZ82nB45MuZLVjoGPvBnAS5ZoVWrm126r326W3y+KXrFPoohfxIupkRpp0pS3YqQ1ik3DAqRsop3lNWPPPC8p43ueVHNd8pquj3pNAIwv5i1M5t7zsRqfDUylWRJ2/QgD6w9CoBKpmAYXBpyhkM+5L4/Xhp9i6cDJcLu+tj416zBpmDCW2Pq0bpgRrTrJq5jLulFGMFemVmOfJ/gBPX2ofjAct842dT2IZlSYoaTJfO8qtP+qcmNfPhpj2tow+4yfqv2OB70EanPfRGqFvWMBjxEM0DT1aIruE9n5QQjI5S09x3ak020z1PbqWoRUBDsu+45Ku8rhBZ3bV2BlzCGe0P/O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 1 X-MS-Exchange-AntiSpam-ExternalHop-MessageData-0: t967ruiFklitBy8Zd23w2HimJRec4trp4OJuAbbms3hFqNktMKoSipxtu2ifASeQWutQyRvCG1rw41S8jId4HJ+Jz6Rwu8fyLQztfaHFOOE5GJAKqWKWb9gIFokq1D01tBkR1kofYwcaN1XtYCXHTH2f5hr/Ev0974DJjaWQ/Qy5yktGyCuJ3uozFDqFLxP7tc+TEM8DnivH/550Zd+f3bQQSQHXSZ62TGvJLLR+VgGwvOQWbiNLqDFUX9eVlysI4QswMXfQuHmPsRzyGwdvBzMni9/K65tFnVQDVUyEhEG5jWR8jD8m+OV1h3i93woHTGM+wBDjwT0EhsRYs2a0ErMTq3qsDrF3fMth1sva/c7va+ROxGeBLwcJPpCbDlDimpPiH3GcSc43SCudCNdV379asRr7ZKa/818Ds2k4rKbMs5PVsnlPDK8WL8HK5pfW8NVCWhBy+z5Z+JFOxX/pz42wan5iw7cohSURIU8fFz5Tm1oYq/jFEXLkDfedz/1M77VIhPT3QBIXlc5gvOCE1PlbBy9b0RFnGn1ZUJBmHiWlmW/+3EIQUOe6iMywtJHgvwHB56CoLIxBOXVmC90rttWkq83w7edFf4bt/ukYmY0d78FtReSlkYkeJCmwP7QseWKUTG8wfbUIxzzHOEIziPuDVQFZJ7Hih9kLDIXNLr1+UA/WfwvkH6jqf30m0s3vhzu62BVH9ojIBr9gN+hqgUmEHLnzaJstwOXR1b/27/IF08qjD45d9uV4UiAHYyC27TcXXjdU/PFXcd68vrXVYZIsFWgYy7R8V9UgYJGfataceNWdUAvRO0v68EzLJgjNfEJy+4ZlQknS+BPdzZ4Vm7n5d4FZWo3fNML2pDgiSaj8yOG4hPzzrZdbuSOEastNf9n+abf9L6gcjzt+UXKxZSEQRciCzyGqOCJ18fd0zW8= X-OriginatorOrg: oracle.com X-MS-Exchange-CrossTenant-Network-Message-Id: 1c96e82d-37fe-497f-faad-08db3c74e6d1 X-MS-Exchange-CrossTenant-AuthSource: CH0PR10MB5113.namprd10.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 13 Apr 2023 23:14:59.0681 (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: 6sw7GDjbBv/MCVN+GbK3b062fYIHZzCUWzke2bQACAZKfE80yrtkSIshtk7T62JOtJdLU4AmOVZbGOdeiy/lM+1PS/WUXcpOq95OK7m3bkk= X-MS-Exchange-Transport-CrossTenantHeadersStamped: SN7PR10MB6287 X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.254,Aquarius:18.0.942,Hydra:6.0.573,FMLib:17.11.170.22 definitions=2023-04-13_16,2023-04-13_01,2023-02-09_01 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 mlxlogscore=999 mlxscore=0 malwarescore=0 suspectscore=0 bulkscore=0 spamscore=0 phishscore=0 adultscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2303200000 definitions=main-2304130207 X-Proofpoint-GUID: y7rTOmua3XSpD2ZxXbo6N_BQud3xTn-d X-Proofpoint-ORIG-GUID: y7rTOmua3XSpD2ZxXbo6N_BQud3xTn-d X-Spam-Status: No, score=-2.8 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_LOW, RCVD_IN_MSPIKE_H2,SPF_HELO_NONE,SPF_NONE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1763105060446912017?= X-GMAIL-MSGID: =?utf-8?q?1763105060446912017?= 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 fdcd595d22944..330b1db913f5a 100644 --- a/include/linux/pagemap.h +++ b/include/linux/pagemap.h @@ -717,9 +717,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); } @@ -844,12 +841,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 a34abfe8c6543..fadc8ca9b9695 100644 --- a/mm/filemap.c +++ b/mm/filemap.c @@ -131,11 +131,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); @@ -234,7 +231,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); } @@ -855,14 +852,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; @@ -2069,7 +2067,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; } @@ -2133,7 +2131,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; } @@ -2174,9 +2172,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; } @@ -2202,7 +2197,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; @@ -2252,9 +2247,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; } @@ -2271,10 +2263,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(); @@ -2312,9 +2301,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 Thu Apr 13 23:14:50 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sidhartha Kumar X-Patchwork-Id: 83136 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:b0ea:0:b0:3b6:4342:cba0 with SMTP id b10csp8591vqo; Thu, 13 Apr 2023 16:33:34 -0700 (PDT) X-Google-Smtp-Source: AKy350YN2NNK58qlWP2VRzdLkFkazOhjmOcxrz3UxQnAPTTBhLnqby9tDbuao+DP5op2Ubkp5z8Y X-Received: by 2002:a05:6a20:af0a:b0:ec:2b10:835d with SMTP id dr10-20020a056a20af0a00b000ec2b10835dmr3979013pzb.13.1681428813730; Thu, 13 Apr 2023 16:33:33 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1681428813; cv=pass; d=google.com; s=arc-20160816; b=L/Ch7zGaGAYHvkA1KS53gPpEYILkTHEETwlad6tNMkFnv7sKtc3WQzhdwUL0g+QVmO fGJQxguLuscIOKuUH4otl4u+lAah5ERF7qT+vdM3MHMR6R2zbQ1V7Eka3PFPUnFAe+du nZ7SBuClAuURuoNY4UgvAmoNOsdtegijw0bXi3CylxGq7FuXX/mtkVFcpBfo1OGdvAT+ H84KQLg8BFM444y36WPaODhf7kqF3Whx0voDOlVcsy/3ZcDEQ3hjFbakqM1et99eZs/j lLRK1Xp8yEP1RZSO8VW980SsL9pQF66eHiUQguDr3p2JBaWQxd80X2sh9zPfBAuaelMl twFg== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:mime-version:content-transfer-encoding :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature:dkim-signature; bh=nNGzYXNZiU1HGYEV2TvGskVf68jn6hY1qJpj/I7cqww=; b=ifM0Xgib7O+vAkky8sGU3PPd2db/CR3SLQcR7qvT5m9V31FpK9+823JnNhRO0x8thN 4fhc8s3RDfLsKKrrERsF8jPq0YSd4kGgHnX3wDwimlZ0SFZQzjFEs0jBrEzdLUDqec9W VX9hHAWWZvWuYlJs+jRWQ3UFEodWTtVHW9mRedbHvRwkJrkZnLrt2wzQ8sCeCHGsY4OO 53bdxGAcrocT9ezqyG1NfMOSIJwi2ExhNxQfTUeOT1tGjqP+QylJRdtUvieafCVibk9A mMsUT4zQDsO0jWx81k5o8A7CzltVGPjUsBH7TeWYf5YJ7SzR+waX0KlhYkVW+/6Z4ViL f0JA== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@oracle.com header.s=corp-2023-03-30 header.b=r1GL5Ekj; dkim=pass header.i=@oracle.onmicrosoft.com header.s=selector2-oracle-onmicrosoft-com header.b=BFTFRveu; arc=pass (i=1 spf=pass spfdomain=oracle.com dkim=pass dkdomain=oracle.com dmarc=pass fromdomain=oracle.com); spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=oracle.com Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id g63-20020a625242000000b006365bcab83csi2757191pfb.264.2023.04.13.16.33.21; Thu, 13 Apr 2023 16:33:33 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@oracle.com header.s=corp-2023-03-30 header.b=r1GL5Ekj; dkim=pass header.i=@oracle.onmicrosoft.com header.s=selector2-oracle-onmicrosoft-com header.b=BFTFRveu; arc=pass (i=1 spf=pass spfdomain=oracle.com dkim=pass dkdomain=oracle.com dmarc=pass fromdomain=oracle.com); spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=oracle.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230473AbjDMXPj (ORCPT + 99 others); Thu, 13 Apr 2023 19:15:39 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:47370 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230386AbjDMXP1 (ORCPT ); Thu, 13 Apr 2023 19:15:27 -0400 Received: from mx0b-00069f02.pphosted.com (mx0b-00069f02.pphosted.com [205.220.177.32]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 40C51BE for ; Thu, 13 Apr 2023 16:15:26 -0700 (PDT) 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 33DLfvWm012832; Thu, 13 Apr 2023 23:15:04 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=nNGzYXNZiU1HGYEV2TvGskVf68jn6hY1qJpj/I7cqww=; b=r1GL5EkjS2MTXcND/H3g1BFigCOSnP3y18rQsEZRVOTSfLLfaJGaaxc6uyx0zbE/fpAq x4bjhgtR5e8gPP+JMAR6gATRbdIUeprym1QRb8MzKfwpDlAl+OPIQvUhL/SUKF2HxuAo HWavCDLiUIHe+GW2NQfO8gaPKVz+N5qsLVuAUmBJj1oOm1rYVeLDlXpT+tSpI0vyv3Z0 ZHrWw3SIWcJrAgLmn8wUm5ep3KP8ZC6u5owHd+D3TpCvjrJJxT+vucToo1x9ys/8peo7 5eB7mgjrGuXmzqcZ0szjp526TunTmO/5WqlwTfhviN++rf53FDmAXIwx2S9AtQnex8Yo sQ== Received: from iadpaimrmta01.imrmtpd1.prodappiadaev1.oraclevcn.com (iadpaimrmta01.appoci.oracle.com [130.35.100.223]) by mx0b-00069f02.pphosted.com (PPS) with ESMTPS id 3pu0bwn0pd-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Thu, 13 Apr 2023 23:15:04 +0000 Received: from pps.filterd (iadpaimrmta01.imrmtpd1.prodappiadaev1.oraclevcn.com [127.0.0.1]) by iadpaimrmta01.imrmtpd1.prodappiadaev1.oraclevcn.com (8.17.1.19/8.17.1.19) with ESMTP id 33DLeMve025109; Thu, 13 Apr 2023 23:15:03 GMT Received: from nam11-dm6-obe.outbound.protection.outlook.com (mail-dm6nam11lp2169.outbound.protection.outlook.com [104.47.57.169]) by iadpaimrmta01.imrmtpd1.prodappiadaev1.oraclevcn.com (PPS) with ESMTPS id 3puwdt922n-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Thu, 13 Apr 2023 23:15:03 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=h9Ds4l3QeXH7RjubDukRnzbQyurfyKBnqZ3YPOM+/+Iw11LpTN4IZIRLgsfAB0cKtU6lUclQ6rPTCLYXNGqrs2T30+93ZjvQWM+qMAz7Vm8SCYKHHRUOYtjhgxYNIQ7wt5UIf9cwqZZ8wytY2GwD0s8OqJ8PV1oMyklLitrFd4w/vV9mYB1QfRZCUbukOywoCovmnC85XREbuCMdcOSkuf1ycz/QZQfwMUFCLxdGXuxMGp8foCnJMNZ2gg4StMgNLTw5y0TmnXoR8qQvrowf+5PWYE3lSs8OjRQgowu68F7yjj2CIz3tvIZAPpi23xyCMfGwGaoY39pTiAgtgpI9SQ== 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=nNGzYXNZiU1HGYEV2TvGskVf68jn6hY1qJpj/I7cqww=; b=ZQ2hiA+bPxO7+xgVLTEHZCvyoC4weXQwpOjg3NOUUkYH+MOw/mHca09TwDSWGDmtc3SITQBYVDrPgIPjuTxoNA5ke2LLknG00GsMNFMMgfLeF5uL5IlcBkQm1oxMYP2wJLDOkue8ERi/fkzcMMPUGv1SWcdS7W7/rWR5+5VYLy870+vXFYd0IOisuQPsmDQgleX5rFEa6agF539mlfEVqssJxMPpojTIwShyrzcv7Rq7NXmkMe2g95kTlPdAHQdcCRC8vUEBNQgDR+EC8sq0kpgsaTdmH+CQLyVFI97LV8r6bUxCT0c9QpnFkIPcRgFZpUZhfaIdW6J9/2PQ4+oSFQ== 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=nNGzYXNZiU1HGYEV2TvGskVf68jn6hY1qJpj/I7cqww=; b=BFTFRveuwm0X0wALVZ2EZQyCuyeZxrbktxb5vWQH/ejUDpvXytV6LIh7m28TOC2bKLyD7csd8q+zkYLKnDGKbRU20xDaKqtd10UU1MpcPDjyOFxXExlI29Ap3LvGhKfwr6h2elX5IcqZD2DgJ7NHH2afsKhzF20tpCYNJVqEbqU= Received: from CH0PR10MB5113.namprd10.prod.outlook.com (2603:10b6:610:c9::8) by SN7PR10MB6287.namprd10.prod.outlook.com (2603:10b6:806:26d::14) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6277.38; Thu, 13 Apr 2023 23:15:01 +0000 Received: from CH0PR10MB5113.namprd10.prod.outlook.com ([fe80::12d3:3f71:5b55:c342]) by CH0PR10MB5113.namprd10.prod.outlook.com ([fe80::12d3:3f71:5b55:c342%6]) with mapi id 15.20.6298.030; Thu, 13 Apr 2023 23:15:01 +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, Sidhartha Kumar Subject: [RFC PATCH 2/4] mm/hugetlb: remove hugetlb_basepage_index() Date: Thu, 13 Apr 2023 16:14:50 -0700 Message-Id: <20230413231452.84529-3-sidhartha.kumar@oracle.com> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20230413231452.84529-1-sidhartha.kumar@oracle.com> References: <20230413231452.84529-1-sidhartha.kumar@oracle.com> X-ClientProxiedBy: BYAPR08CA0030.namprd08.prod.outlook.com (2603:10b6:a03:100::43) To CH0PR10MB5113.namprd10.prod.outlook.com (2603:10b6:610:c9::8) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: CH0PR10MB5113:EE_|SN7PR10MB6287:EE_ X-MS-Office365-Filtering-Correlation-Id: a25a9b17-5ef8-4420-16ab-08db3c74e822 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: 0uABKVaLs7QYZGQm2oft410K/vB54Jw01PyDPt+o6U6qqUVj2QuN1qhBk0r4m4qhgW5KpSR3RHRhl5PKSNrDq09gd7z3SGqDkRtHv6JhjDv5nVKigwfe0dwqCUa/rEY1/VIa1LGzdUqiYEBAeJ0NQ0xgIf/8JLbQknk8yhhds4lIpoKHYEAD/S8o4xA7nchtNA/yeujwqEsKjPZBHP9h3XTIqYHbmJ3F9fXAHcVN/VJEKOKjGhzoop+MfeOkwHgUP2KIHxPD6N//0RY22MkYlKHA0EuqgaaIDL9PzwI5ilae5n2iO2/cqeocPGDl5StoLxPUsU92t+znrAcQxHpOAT9mX7ZvC6vcZDpMv5gAqbo0blLcjXmYgDJWpyJwIXGSSHyNzXsJ3C/MRPjM/rhrJhj/y9sGg/hSkEq37XjgHNGdMBHnMy25i/KQeY7Xw+PIvOdLHgi1BaAYChq0U6Utm9v5tL2E989pjpcJ123BVAVngN/nP+y4cL9+/22/eeGhpHImystF78VaZ0t/ac9YiY87MXDPZove8wlPcmBE4K/dGGPGJEc520LyQzaainF7 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)(39860400002)(376002)(396003)(136003)(346002)(366004)(451199021)(6506007)(86362001)(6666004)(6512007)(107886003)(478600001)(6486002)(1076003)(186003)(66556008)(66946007)(66476007)(4326008)(38100700002)(316002)(5660300002)(2616005)(41300700001)(83380400001)(44832011)(36756003)(2906002)(8676002)(8936002);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: 6LBj9ZHQd8TUsZgUJ4OTe3HbIGLw9DQpdPVmxyp4mtaUZcXbxTKrsRRwHhB/fjC/ljQQUqcGQ7Bm1POca73H50ll6MUnbqM5wT6o1NBRuWgTgp5OLewLezg5/tvAjMDjUoMbf95W1BPMCDIleEhvyL0fAh20nydyUR6JIAJgF5t8idLtov4tfqUpk6X4gzaMi/6ZxxhW2HHmIf7fA8hJAJHhx8efYMF87IK7PbfMp8NmZwZAkd6lUCXPFpQuQFDHm+cwZdpameGI2rU7cSfotWnc8wfBBpSRs1Eyc/X9kZtLEOD3nqLdDY289iVhQmi7VkYXw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QWYfvW6QOTOXyFY6zjqsOhAg8hfRiCWf1phouNePDBi6qNojtyHLJVYFjqlWOHSMUE2l0nNwZsxxkrcWICHtCrV+gUD+oMy0C9H/TO4jGWQOi79srMEv6YP9iMVNzZZDOMOxvX34juFfaozKofv05xQp5qEEFGGD6gyxisu4Z0m4Lf+mHqBcU= X-OriginatorOrg: oracle.com X-MS-Exchange-CrossTenant-Network-Message-Id: a25a9b17-5ef8-4420-16ab-08db3c74e822 X-MS-Exchange-CrossTenant-AuthSource: CH0PR10MB5113.namprd10.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 13 Apr 2023 23:15:01.2705 (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: /5sw/U/qKegAloe+DwZ9HEl6jXblC7HBsGASMo9UyLDuUxNhTKkjsZTcGipGA9PdbUXi3d8WYISWZz6QLeoU8QcPzmMPT2Z5MZLvS2AE34o= X-MS-Exchange-Transport-CrossTenantHeadersStamped: SN7PR10MB6287 X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.254,Aquarius:18.0.942,Hydra:6.0.573,FMLib:17.11.170.22 definitions=2023-04-13_16,2023-04-13_01,2023-02-09_01 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 malwarescore=0 mlxscore=0 mlxlogscore=999 spamscore=0 suspectscore=0 bulkscore=0 adultscore=0 phishscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2303200000 definitions=main-2304130207 X-Proofpoint-ORIG-GUID: CGdbZDWTTTrGciyPweo43NDpf6YvVJui X-Proofpoint-GUID: CGdbZDWTTTrGciyPweo43NDpf6YvVJui X-Spam-Status: No, score=-2.8 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_LOW, RCVD_IN_MSPIKE_H2,SPF_HELO_NONE,SPF_NONE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1763105899726690802?= X-GMAIL-MSGID: =?utf-8?q?1763105899726690802?= hugetlb_basepage_index() can now be removed as hugetlb pages have ->index in PAGE_SIZE. This also allows removals of vma_hugecache_offset() and linear_hugepage_index() which are replaced by calls to linear_page_index(). Signed-off-by: Sidhartha Kumar --- include/linux/pagemap.h | 7 ------ mm/hugetlb.c | 50 ++++++++--------------------------------- 2 files changed, 9 insertions(+), 48 deletions(-) diff --git a/include/linux/pagemap.h b/include/linux/pagemap.h index 330b1db913f5a..bb60282317875 100644 --- a/include/linux/pagemap.h +++ b/include/linux/pagemap.h @@ -792,16 +792,11 @@ static inline pgoff_t page_to_index(struct page *page) return head->index + page - head; } -extern pgoff_t hugetlb_basepage_index(struct page *page); - /* * Get the offset in PAGE_SIZE (even for hugetlb pages). - * (TODO: hugetlb pages should have ->index in PAGE_SIZE) */ static inline pgoff_t page_to_pgoff(struct page *page) { - if (unlikely(PageHuge(page))) - return hugetlb_basepage_index(page); return page_to_index(page); } @@ -854,8 +849,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 f16b25b1a6b93..011020a30f4ac 100644 --- a/mm/hugetlb.c +++ b/mm/hugetlb.c @@ -949,24 +949,6 @@ static long region_count(struct resv_map *resv, long f, long t) return chg; } -/* - * Convert the address within this vma to the page offset within - * the mapping, in pagecache page units; huge pages here. - */ -static pgoff_t vma_hugecache_offset(struct hstate *h, - struct vm_area_struct *vma, unsigned long address) -{ - return ((address - vma->vm_start) >> huge_page_shift(h)) + - (vma->vm_pgoff >> huge_page_order(h)); -} - -pgoff_t linear_hugepage_index(struct vm_area_struct *vma, - unsigned long address) -{ - return vma_hugecache_offset(hstate_vma(vma), vma, address); -} -EXPORT_SYMBOL_GPL(linear_hugepage_index); - /* * Return the size of the pages allocated when backing a VMA. In the majority * cases this will be same size as used by the page table entries. @@ -2087,21 +2069,6 @@ struct address_space *hugetlb_page_mapping_lock_write(struct page *hpage) return NULL; } - -pgoff_t hugetlb_basepage_index(struct page *page) -{ - struct page *page_head = compound_head(page); - pgoff_t index = page_index(page_head); - unsigned long compound_idx; - - if (compound_order(page_head) > MAX_ORDER) - compound_idx = page_to_pfn(page) - page_to_pfn(page_head); - else - compound_idx = page - page_head; - - return (index << compound_order(page_head)) + compound_idx; -} - static struct folio *alloc_buddy_hugetlb_folio(struct hstate *h, gfp_t gfp_mask, int nid, nodemask_t *nmask, nodemask_t *node_alloc_noretry) @@ -2703,7 +2670,7 @@ static long __vma_reservation_common(struct hstate *h, if (!resv) return 1; - idx = vma_hugecache_offset(h, vma, addr); + idx = linear_page_index(vma, addr); switch (mode) { case VMA_NEEDS_RESV: ret = region_chg(resv, idx, idx + 1, &dummy_out_regions_needed); @@ -4810,6 +4777,7 @@ static void hugetlb_vm_op_open(struct vm_area_struct *vma) static void hugetlb_vm_op_close(struct vm_area_struct *vma) { struct hstate *h = hstate_vma(vma); + unsigned int order = huge_page_order(h); struct resv_map *resv; struct hugepage_subpool *spool = subpool_vma(vma); unsigned long reserve, start, end; @@ -4821,11 +4789,11 @@ static void hugetlb_vm_op_close(struct vm_area_struct *vma) if (!resv || !is_vma_resv_set(vma, HPAGE_RESV_OWNER)) return; - start = vma_hugecache_offset(h, vma, vma->vm_start); - end = vma_hugecache_offset(h, vma, vma->vm_end); + start = linear_page_index(vma, vma->vm_start); + end = linear_page_index(vma, vma->vm_end); reserve = (end - start) - region_count(resv, start, end); - hugetlb_cgroup_uncharge_counter(resv, start, end); + hugetlb_cgroup_uncharge_counter(resv, start >> order, end >> order); if (reserve) { /* * Decrement reserve counts. The global reserve count may be @@ -5582,7 +5550,7 @@ static vm_fault_t hugetlb_wp(struct mm_struct *mm, struct vm_area_struct *vma, * * Reacquire both after unmap operation. */ - idx = vma_hugecache_offset(h, vma, haddr); + idx = linear_page_index(vma, address); hash = hugetlb_fault_mutex_hash(mapping, idx); hugetlb_vma_unlock_read(vma); mutex_unlock(&hugetlb_fault_mutex_table[hash]); @@ -5669,7 +5637,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(); @@ -6014,7 +5982,7 @@ vm_fault_t hugetlb_fault(struct mm_struct *mm, struct vm_area_struct *vma, * the same page in the page cache. */ mapping = vma->vm_file->f_mapping; - idx = vma_hugecache_offset(h, vma, haddr); + idx = linear_page_index(vma, address); hash = hugetlb_fault_mutex_hash(mapping, idx); mutex_lock(&hugetlb_fault_mutex_table[hash]); @@ -6185,7 +6153,7 @@ int hugetlb_mfill_atomic_pte(pte_t *dst_pte, bool wp_enabled = (flags & MFILL_ATOMIC_WP); struct hstate *h = hstate_vma(dst_vma); struct address_space *mapping = dst_vma->vm_file->f_mapping; - pgoff_t idx = vma_hugecache_offset(h, dst_vma, dst_addr); + pgoff_t idx = linear_page_index(dst_vma, dst_addr); unsigned long size; int vm_shared = dst_vma->vm_flags & VM_SHARED; pte_t _dst_pte; From patchwork Thu Apr 13 23:14:51 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sidhartha Kumar X-Patchwork-Id: 83117 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:b0ea:0:b0:3b6:4342:cba0 with SMTP id b10csp1927vqo; Thu, 13 Apr 2023 16:19:03 -0700 (PDT) X-Google-Smtp-Source: AKy350YZm0Q6j2Vb8C9UPa4MOC/Zb6eB1B9sMY0M5q/wYmj9nop3qb0q8fERCRLXQaBh+IaereiF X-Received: by 2002:a05:6808:4a:b0:387:12e5:543a with SMTP id v10-20020a056808004a00b0038712e5543amr2024478oic.29.1681427943521; Thu, 13 Apr 2023 16:19:03 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1681427943; cv=pass; d=google.com; s=arc-20160816; b=rej0V6Sp8kg85BzvdvX7roSgcBKXFUVE6/qkXCl14mT2kOkzoL5PAQTwpjYwfcoD2e kJDzVhA4MjxCM+ZmJRENWuuuQgvcV4wBOEM0bkzaymlb0UNX30NrWG+b6rog5dWtC7NO i+c8CMLUSKVYLQN+awldsvn2aX0Q4za+S56w/8Q7DM9WIMPkJ8nxwWXfW1ox/sqvNeKM OdV1dtwF1VP6c7zg2gE5g1Jlx+A3x2eV0OTbQ4/y8D3mYUnglKiTBzHGvwR07El2mlLn Zhh7KpKu16PZLTDfkG/p0QCMvU/5/TNTEAAmvGDKD7xxNY/Z4+rAACUf4tN/YTwIwosN x6Qg== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:mime-version:content-transfer-encoding :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature:dkim-signature; bh=uWAWqf/Ei3Fj5gyx8nFYEz2lrYRudR7/nq90cXKlESk=; b=P14/8lTtnVm0UPsXLNItyE5gnp5dW7PUoPxcxJT8wuw8yhOIxSCNdvLhIGHtlag0au XJKvDH4p2o3Z6snkfo/M0w657TOzYBgN2yfGm1phWCSEOuEfnLfET1MxTfJnYVbbR8ZZ Kr+5/l1M16LOdnRT5Uo5tjnlWQzSOxuoh1ZdLHoJPnOAqEe785GtFhT2W91piWrbkvln l+Ew6ahVZ22cIxX/rXbgpCFThfXGvbhkWs88GZihllFlwYdOXNBnG2aWJ7vgiVth2Sia KgZ2DDQ7JxLNLdc3ObgQFaUyraWERDhBbRoSp8LBONSs77NcQZ97FwQ8Lx87lC8WI0My TlzQ== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@oracle.com header.s=corp-2023-03-30 header.b=aAJT1FNz; dkim=pass header.i=@oracle.onmicrosoft.com header.s=selector2-oracle-onmicrosoft-com header.b=uqU5YTuf; arc=pass (i=1 spf=pass spfdomain=oracle.com dkim=pass dkdomain=oracle.com dmarc=pass fromdomain=oracle.com); spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=oracle.com Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id s4-20020a0568080b0400b003897c1db849si2669377oij.48.2023.04.13.16.18.41; Thu, 13 Apr 2023 16:19:03 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@oracle.com header.s=corp-2023-03-30 header.b=aAJT1FNz; dkim=pass header.i=@oracle.onmicrosoft.com header.s=selector2-oracle-onmicrosoft-com header.b=uqU5YTuf; arc=pass (i=1 spf=pass spfdomain=oracle.com dkim=pass dkdomain=oracle.com dmarc=pass fromdomain=oracle.com); spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=oracle.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230406AbjDMXPb (ORCPT + 99 others); Thu, 13 Apr 2023 19:15:31 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:47404 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230379AbjDMXP0 (ORCPT ); Thu, 13 Apr 2023 19:15:26 -0400 Received: from mx0a-00069f02.pphosted.com (mx0a-00069f02.pphosted.com [205.220.165.32]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 29E91114 for ; Thu, 13 Apr 2023 16:15:25 -0700 (PDT) Received: from pps.filterd (m0246627.ppops.net [127.0.0.1]) by mx0b-00069f02.pphosted.com (8.17.1.19/8.17.1.19) with ESMTP id 33DKxDtY006509; Thu, 13 Apr 2023 23:15:09 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=uWAWqf/Ei3Fj5gyx8nFYEz2lrYRudR7/nq90cXKlESk=; b=aAJT1FNzLwYB2/uI4hlFnCsz9tYb9S3UnpJu6rqGiIvyvNiLEPBFLtzr6WYy+iY2W4Nw oUM60yCwU1/1zKEnhk9Vpli7Arpv0/0vWKmma7gCGKhaG0XTB3PMDpJBiBLpzrPD9FS/ FRnLqlj7sA5tgmWNGRAiCKOwQxL10q9fqFGyU3jU9g67oaKq4mWMi5fvuP0QJkaY0O9g rFCl/15cGT2WSR5tA9x+KeTbaNN+rzs+NVr6Y9yDO1/cnByND3MBOiZ3hkJoX3yML6yi 03YY44T6/rjprXKydw0g6SMuSWr0vBPldumt7t7zqzKVcxDY4eknrzgXhNrI9p/4POYD Tw== Received: from iadpaimrmta02.imrmtpd1.prodappiadaev1.oraclevcn.com (iadpaimrmta02.appoci.oracle.com [147.154.18.20]) by mx0b-00069f02.pphosted.com (PPS) with ESMTPS id 3pu0hcct79-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Thu, 13 Apr 2023 23:15:09 +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 33DM6C1i012738; Thu, 13 Apr 2023 23:15:07 GMT Received: from nam12-mw2-obe.outbound.protection.outlook.com (mail-mw2nam12lp2045.outbound.protection.outlook.com [104.47.66.45]) by iadpaimrmta02.imrmtpd1.prodappiadaev1.oraclevcn.com (PPS) with ESMTPS id 3pwwgrs6sx-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Thu, 13 Apr 2023 23:15:07 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=GyLAHQiJb+QKJpj+/CyYxfrHo9VeW60e/IYWnABXMnYcjxE09oP44vUNVGViCV0pdjJ5hECSnodegTmx+Gcb0s4IMZngVvbUgKlbULPjcGsIi95H/zinbIP8hpvr6H50IujDu6QNqmsmJwDvVTncC3FRSxrm23lz8acv83b5qRByg7xtCyGrgAgR3jnFMjIGkhn+PhT7L55dA3n+DAZZmmq+Sq8AMkXrZtcD0+Hy8QR0GGse9AzKkXplvOaZE2xICPEK9oc9JfW5L3CWWBRSpB9/dzUoGq0aqNbcRNbIUnYyY4oDN7Y4ZE8b8jyF48DxaafLMKIitClTtEQcEFNCow== 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=uWAWqf/Ei3Fj5gyx8nFYEz2lrYRudR7/nq90cXKlESk=; b=gNo6A2ccqV1d8or7J+bmt5dyk2F7j6a1GGVCHC97vMnS3oUwgydlY8JA9bI1Qc7c2Z5WEMN12bsMAVDXVIT2Ay2SDdniiftv5JjoRbExYWjuix7/kekXz4LxEbbA+65UOBVB8YIXVKox8YgDGX1HcPuCozN55gKSnrGD4c9ARCHl8nNQR/5CI5JbkQXYT5Fyk558NYeSmtt7WTaFmRDdl53s5aAhBfuHohu9ziclOsYhT3eorUPhYpHgRbk9p9QBE18wB0OlBY1xrn1NQLSynFwTx/A0vruaiof5WvVR3kinx2eNm2d0TRw8auyt+Hvf9TPUAnjk9uODJnRJbCILcw== 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=uWAWqf/Ei3Fj5gyx8nFYEz2lrYRudR7/nq90cXKlESk=; b=uqU5YTufFuT8lZEI8q3DUtTRvIHkNDPyXN97/m1HW7wI2VHOuqTfAnfdzoZMTkEywm5JC/udCWaHi5inYZkmYCdCzLrKjP/JEsL47fx0RXZCzpshKpK3J0ToJNc32gc8/ixqFbKLcuOHVqZZ+mY5TOqiZHMlWpvwuP5vpuqRXeM= Received: from CH0PR10MB5113.namprd10.prod.outlook.com (2603:10b6:610:c9::8) by SJ2PR10MB7058.namprd10.prod.outlook.com (2603:10b6:a03:4c5::9) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6298.28; Thu, 13 Apr 2023 23:15:03 +0000 Received: from CH0PR10MB5113.namprd10.prod.outlook.com ([fe80::12d3:3f71:5b55:c342]) by CH0PR10MB5113.namprd10.prod.outlook.com ([fe80::12d3:3f71:5b55:c342%6]) with mapi id 15.20.6298.030; Thu, 13 Apr 2023 23:15:03 +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, Sidhartha Kumar Subject: [RFC PATCH 3/4] mm/hugetlbfs: remove huge_page_shift in hugetlbfs_file_mmap Date: Thu, 13 Apr 2023 16:14:51 -0700 Message-Id: <20230413231452.84529-4-sidhartha.kumar@oracle.com> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20230413231452.84529-1-sidhartha.kumar@oracle.com> References: <20230413231452.84529-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_|SJ2PR10MB7058:EE_ X-MS-Office365-Filtering-Correlation-Id: cbf7892f-e418-4a0c-84ef-08db3c74e942 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: Ft7Q9VNN4CuRV2Yg0feXbICi3Dk2njvd58Tpia48t/RIARVTji1dHoYShTCjBbDIqVa+uNdhONI8O+Roa025A0kM3igt6J0gA66xhSGrkCS1ZgLhx3SnlrdNGBHxHpTtO0i4anIjSbw6bXRYDx6YL2FJNNViXVHte3G+fpuoBMUmSTUufSrblI+gbVgt9zNk6GeIFh0cfk3o3ywpIabFP5YNxjNQfFGKx7egS0LtOMf8jtFxm03+RVm+rk1MR7dnL/NohO31syEEJi//jJkuYbBN0vUeCu7bs7e8gtCp0g5eVQmdHHQ4iSuPRKFqMV6iyp+pRHK8QIJULJB24JNVvGkkBpkLp/CMF1xfUhlo4zkq/d5+h+qzy+84gfDlwzGWBRgeMwU2UqXfC95MNXtPmFvqFMfiwe7l2J6Hl7tcz1/7pq08V0fe30S+6oM3W33nUTsU0fW1eekRBPDOH1TjMaXUHhIqgd6FhmPVeYK0/+7dPBNvD7Adz1sZNkU0SbIeDaWKbX1NesmpqCs2pqsw2/aHKq4APzTUYIxJXITOEbRWIDc1SxAQ0YVwbqutlqV7u/07s2KVWYN2opvYTccQ8MwB6G9HLv80jLxauNoq3r4= 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)(39860400002)(396003)(376002)(136003)(366004)(346002)(451199021)(83380400001)(2616005)(6512007)(6666004)(1076003)(478600001)(6506007)(107886003)(6486002)(186003)(44832011)(36756003)(38100700002)(5660300002)(4326008)(66556008)(66946007)(66476007)(8676002)(316002)(86362001)(41300700001)(8936002)(2906002)(14583001);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: jQ+ytWDpVxXiuYHL66opYg0wPYSzop7viMdSsUmNd2KRqsEz5kOyXMgjRZf3FsHfgMTC3jfvG3fPrnZUU80qId07LCLt1OJNcMzduZB0NJ3wCrJTEeFVrIl1Pyv+HnP7p5uO4iUJ3vln78XngzjoGY6+z24bIpnsZhDZOcLvYVXwvGkweeNVk9VT8WydNvHKq07RUsVxo0WlwieL9HKGgEuy9EDyurXqqjl/xwgm7sq4lHW2UamMkGpHhUUVuYxCuAlD5EJ02cZgFbEnRRPsK0iWW8q96t4EIv9gf5NAU9onrtSMU+RHj3R/4NJIQjnPYvCByDOEt5Rqey0tlm6P9PIU+zbIm0y/7ldxafURoHrfB4KxEk4lau7V8ol/9kA3q6akLv7JN7aquS13bJ+aEhaucZ4UikeL/grEvciecK87w+5w0PZUscv6rKRZG/QTtevWb3FfWqq3Wqmx0/xLO2K4hfIg/2Ir16Q1yNoWg29wTj9LZJT6AXnj+8xOlK5eBbm7RdnKA192YqWK0COTH9yeBdVrEkRO9dHkxjDRKy+9NVbysQDeIm0ymWirKglOKfRxnH4a9q0KZkjmmJP2LxhALzVcDOd5Bse9DYkIaWf8fe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AntiSpam-ExternalHop-MessageData-0: +FlBMkAOwUNyXovwUkkRKJQpFyrbECUFu18m1tOr1ZNRaJx85XB582gvRh7zlVv1qKAnh7s+iE6BaabdhG8/UE8LjnXu0meDGeJzQru1iRh0usFBtQAB+Zj7yhMrkLg6m0BfRKN504Dnnlr4jVezdcFhDv5BNE5GqSL7aRPCCGTCIpnn0kZ+RV4psTqlmTnJi9E3VC/W6rfnIl9ojmrRSA3+hFvTVlZ5tMZzWvb+MeqtKr3k2gtDo+KS1hrR2YeMHeD7Qg0bK8VkYf0LYJscBBiQcRR65jDznAJcpTgrMdgP/gfIyzMSNyuLqWWqKc52XkrkJyp8AW56v42dVgVeoxiCV3JvwGKylznl+lfclvmmkNyTYlwK0AdI9WBXf7WvnjpvMimwCQWh774NNBk/lKI1nWVATLNWb5CxLzSj2UU7ASa3k8MYf/8yBdzgOvWQzAKrSajnS6W3fZP3smVAbSxwhk4siJW+eQqM6qLzZ+WpRfaJCkaLbK2XzvYzcFRkYKT38SCIvJA92Nv1l3+eTUqbVw5EOpqmILQc0DuwiFDtFCwvi2OIdd505v4vO28pb8y7xwSyCJmsMeBWy87Q3qRBuNuP+Ff+ycAgBJfrgwunM7iwmjv7zgB0jJ6eUqJ3+Zyo5aVYNJxjYBSbm2egelES2aE6ryzdX1S9qXHhUYQvYHFIZsAqls1oC3VLXY2qLf21FxTYfdrag0urkGm5NlXU73G9uIGweAMXyLDm8d3narNpMVOW8ZORFp/WvdQPNfO2EecjkY3KFk2g+qJYt7yWKdaFWWhSNBc9fnhs8A0e2hWsjD8bRjifNr2/4ZIsWVrnG9be1n5rrRYdy4C07dodhiz7riimuSV5IwlYO4H1ElCZCdfzgEc2SnKSkJCLSBLZfTpGwGIQuMKWDybWPcNqQxmyQOLASnOiLnseKIM= X-OriginatorOrg: oracle.com X-MS-Exchange-CrossTenant-Network-Message-Id: cbf7892f-e418-4a0c-84ef-08db3c74e942 X-MS-Exchange-CrossTenant-AuthSource: CH0PR10MB5113.namprd10.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 13 Apr 2023 23:15:03.2415 (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: 8Rq9LQ6h9sTjvE6awaoRWwa03U3iAeca2fSwzi/vZYclS3NgJeohBiUHNaIJ4qGlOjfkvFzjDYmiXBKlygwOtF7NuIhgkKbikpo7hODvcjg= X-MS-Exchange-Transport-CrossTenantHeadersStamped: SJ2PR10MB7058 X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.254,Aquarius:18.0.942,Hydra:6.0.573,FMLib:17.11.170.22 definitions=2023-04-13_16,2023-04-13_01,2023-02-09_01 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 spamscore=0 suspectscore=0 malwarescore=0 phishscore=0 bulkscore=0 adultscore=0 mlxscore=0 mlxlogscore=999 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2303200000 definitions=main-2304130207 X-Proofpoint-GUID: oTJEq6S9dbV-oLmX7WngSRhbdy9gbx2z X-Proofpoint-ORIG-GUID: oTJEq6S9dbV-oLmX7WngSRhbdy9gbx2z X-Spam-Status: No, score=-2.8 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_LOW, RCVD_IN_MSPIKE_H2,SPF_HELO_NONE,SPF_NONE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1763104987341615449?= X-GMAIL-MSGID: =?utf-8?q?1763104987341615449?= Remove shifting the vma->vm_pgoff and len arguments in the call to hugetlb_reserve_pages() within hugetlbfs_file_mmap(). Adjust the chg variable within hugetlb_reserve_pages() to match previous values which are expected by cgroup accounting code. Signed-off-by: Sidhartha Kumar --- fs/hugetlbfs/inode.c | 4 ++-- mm/hugetlb.c | 7 ++++--- 2 files changed, 6 insertions(+), 5 deletions(-) diff --git a/fs/hugetlbfs/inode.c b/fs/hugetlbfs/inode.c index 702d79639c0df..9f2e71f2e9f52 100644 --- a/fs/hugetlbfs/inode.c +++ b/fs/hugetlbfs/inode.c @@ -165,8 +165,8 @@ static int hugetlbfs_file_mmap(struct file *file, struct vm_area_struct *vma) ret = -ENOMEM; if (!hugetlb_reserve_pages(inode, - vma->vm_pgoff >> huge_page_order(h), - len >> huge_page_shift(h), vma, + vma->vm_pgoff, + len, vma, vma->vm_flags)) goto out; diff --git a/mm/hugetlb.c b/mm/hugetlb.c index 011020a30f4ac..a28fbdff886ff 100644 --- a/mm/hugetlb.c +++ b/mm/hugetlb.c @@ -6752,6 +6752,7 @@ bool hugetlb_reserve_pages(struct inode *inode, { long chg = -1, add = -1; struct hstate *h = hstate_inode(inode); + unsigned long hpage_shift = huge_page_shift(h); struct hugepage_subpool *spool = subpool_inode(inode); struct resv_map *resv_map; struct hugetlb_cgroup *h_cg = NULL; @@ -6791,14 +6792,14 @@ bool hugetlb_reserve_pages(struct inode *inode, */ resv_map = inode_resv_map(inode); - chg = region_chg(resv_map, from, to, ®ions_needed); + chg = region_chg(resv_map, from, to, ®ions_needed) >> hpage_shift; } else { /* Private mapping. */ resv_map = resv_map_alloc(); if (!resv_map) goto out_err; - chg = to - from; + chg = (to - from) >> hpage_shift; set_vma_resv_map(vma, resv_map); set_vma_resv_flags(vma, HPAGE_RESV_OWNER); @@ -6823,7 +6824,7 @@ bool hugetlb_reserve_pages(struct inode *inode, * the subpool has a minimum size, there may be some global * reservations already in place (gbl_reserve). */ - gbl_reserve = hugepage_subpool_get_pages(spool, chg); + gbl_reserve = hugepage_subpool_get_pages(spool, chg) >> hpage_shift; if (gbl_reserve < 0) goto out_uncharge_cgroup; From patchwork Thu Apr 13 23:14:52 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sidhartha Kumar X-Patchwork-Id: 83118 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:b0ea:0:b0:3b6:4342:cba0 with SMTP id b10csp1943vqo; Thu, 13 Apr 2023 16:19:05 -0700 (PDT) X-Google-Smtp-Source: AKy350Z85vGI0xFnecPFghVE3qHLO6Z9PmIXJQEDlr53gIWX6nMwDxMEv64jps15YiycSYmk8i6X X-Received: by 2002:a17:90b:1e4c:b0:23e:fa90:ba37 with SMTP id pi12-20020a17090b1e4c00b0023efa90ba37mr3050958pjb.49.1681427944995; Thu, 13 Apr 2023 16:19:04 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1681427944; cv=pass; d=google.com; s=arc-20160816; b=vXxp3J+BslNvuedW1kHvhqPkBZElBZFaadbrVMmZkLrCpcuHzHljAPU4itBCKNrFpm HIY8sf813gstU/Kw9XgmQYnnu403ijlO2+y7Vxz0pp3JOBzvqtY1BfoDDZAv5OEl+1Nb n9EQOJ4OPWhPyz2RuqsY0hgRWLiSedWyJ3/Dc12ywwi4njeBpyV/9W4XF6pk3bsFebGO jhdNfSVukmAFxO5P7rFbkI/cONPJMAo3HYzE1Ba4F7QJML1eG//69zYjhN0XG2xaW23z tasWpz0wfZTpmd/Wyke8/1dxPPG34Y1cVOmem1fcqxArQFxBIjFnT0bJdlmbIuPq5frg Pu8g== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:mime-version:content-transfer-encoding :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature:dkim-signature; bh=Pn/uyozvyYbUQ9JbCnKLeYMPmrjAiQHRp1hAqucWDsI=; b=R8jSVL+GpFC5VHkqKsVPTWtJY88nutg3t83LnOqLjZzUOxnd2ub92F+tYX+cjEyesb FwlqobdgAx3kj9MvgHdmGLFQQW3G18ylme5eiF76A5DJ6nM2Ig0tTbO7ioF92BOcm+XT QL48cJ+VE/xka2ZeQ74ct4MuNM/fCEGjJuyoD67VZgr5U64o6yMCdz+ltapaBVKx94ol aI5Umrcb4JWiWMPGyPZ3SNFb6Tm/MhEX9/RGjFYnsCU9m6oYXXWZ68hoUynwfiWKY0uu u+JJenc9I/rqrTicAPPrHMw6jKU/br/UWUqG73tSg6Da9phphlknW6bKqnEnFDScCEeD kDHw== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@oracle.com header.s=corp-2023-03-30 header.b="0dvFtMF/"; dkim=pass header.i=@oracle.onmicrosoft.com header.s=selector2-oracle-onmicrosoft-com header.b="rFxE/ssf"; arc=pass (i=1 spf=pass spfdomain=oracle.com dkim=pass dkdomain=oracle.com dmarc=pass fromdomain=oracle.com); spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=oracle.com Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id a187-20020a6390c4000000b0050fa04005e6si3171933pge.412.2023.04.13.16.18.44; Thu, 13 Apr 2023 16:19:04 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@oracle.com header.s=corp-2023-03-30 header.b="0dvFtMF/"; dkim=pass header.i=@oracle.onmicrosoft.com header.s=selector2-oracle-onmicrosoft-com header.b="rFxE/ssf"; arc=pass (i=1 spf=pass spfdomain=oracle.com dkim=pass dkdomain=oracle.com dmarc=pass fromdomain=oracle.com); spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=oracle.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230445AbjDMXPf (ORCPT + 99 others); Thu, 13 Apr 2023 19:15:35 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:47230 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230385AbjDMXP1 (ORCPT ); Thu, 13 Apr 2023 19:15:27 -0400 Received: from mx0b-00069f02.pphosted.com (mx0b-00069f02.pphosted.com [205.220.177.32]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 4848BE9 for ; Thu, 13 Apr 2023 16:15:26 -0700 (PDT) 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 33DKx5RC012833; Thu, 13 Apr 2023 23:15:09 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=Pn/uyozvyYbUQ9JbCnKLeYMPmrjAiQHRp1hAqucWDsI=; b=0dvFtMF/fpryAsXldSwLoCOp18Z1Lyq4GG7YFBi5OOD9GFD9dmPWoZhZ8xM1JSx7L1SK eucmDj0bz0j/GwgndlPjy9NLDhn1dCueDVSgM2qaRibZ2dgUtevoHAb9kpj8LvOjETh3 uT4Gf6UsdwQ6pGfkIuU8A9dWGtsJpnjNVGwNzRFHwe2n9aZWR4rsUxB0I4OaicBpnb9g dvjTSqypsIrSl9FhUcQ61DWxqzSFFCl1+sHPf8KsR1LbK3s6zIkTZuJQ9ybb0dgnJtdC tknwBgnLaONdblIjyx0QxZNfzzUXL4AaVWl4ZhhImiF5D/psRNLeTPeHkDrslSqi08TQ 5A== Received: from iadpaimrmta02.imrmtpd1.prodappiadaev1.oraclevcn.com (iadpaimrmta02.appoci.oracle.com [147.154.18.20]) by mx0b-00069f02.pphosted.com (PPS) with ESMTPS id 3pu0bwn0pe-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Thu, 13 Apr 2023 23:15:08 +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 33DM6C1k012738; Thu, 13 Apr 2023 23:15:08 GMT Received: from nam12-mw2-obe.outbound.protection.outlook.com (mail-mw2nam12lp2045.outbound.protection.outlook.com [104.47.66.45]) by iadpaimrmta02.imrmtpd1.prodappiadaev1.oraclevcn.com (PPS) with ESMTPS id 3pwwgrs6sx-2 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Thu, 13 Apr 2023 23:15:08 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=HpC8EINTOSjvKdPEXqqJ4dCdQTOGU+rpHjgjIjgZ+f7pL7QuaGEj7QvijeOspuic+yijS/Hum2LHfYNpR7KgRZa41gqmCddXKjF/+ZC9HJyQ+PVFQG4fpxy5g4wNsnf1vnIj+1+A+V7vQTE5Lu3gtQTZX5pNl8GTtmGT/AWu517Iwn5Q7oMcRgorDO7fX8uqZSsGXP5izzuuwFFMZWROXFcAD5znvfRSSkPViLA45f5hnTwTphjQaSaaQJW0kD34UzGijSltcHz9VeZCC2ufDcuZjurGQnskZaIPn0sRR2nnEVevZPOjyKKrzze7C4QZNhK3bTxlKmF+pn552+ml/g== 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=Pn/uyozvyYbUQ9JbCnKLeYMPmrjAiQHRp1hAqucWDsI=; b=odF2m/tGzJ7Xj6pDKN3HPt+ZBMO8zpVQO2rgcG8qi5rkU+UPgpi/mFuBDZZq9YHhxefhsnl4wK7aNys8akWaQs33FfsYzxAA0uExkqgmACQF1/+3piE84LkEnOwF1HtB3+Up9Jq+JmaC93Qo4DEOHM2eN26DM8rCfLQcqnCbQOfZi4DtzvTpUXFSAtKaw2G5wZFg50UTUYg96FNYaqFHbV5gFnGQDEKBm3Obn920PnRpWMWvQfaF2VKbwEm5vksD41YapALrFIF24H4xGQBQ1ePTkvZ9RGANfywz73WPl4J6GUpRbR9Ruf3CptbJ7rgLX1YZ2AFtKdbqQWacsEpHcg== 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=Pn/uyozvyYbUQ9JbCnKLeYMPmrjAiQHRp1hAqucWDsI=; b=rFxE/ssf9PHxMr7IiXgHAnbcdxEubXqJat1r2Gs19VXWzr6/aoAw06BXj+60sss296D2E0clgrFduh1S9IRKvyd8WEcKDL+sHSawlOWnr4WO8TqnFuT4SYRnHY20yYRsR/ojOiK1MPnd24lP9YBGaUIDSfO87+aSPOHyP4gy0fQ= Received: from CH0PR10MB5113.namprd10.prod.outlook.com (2603:10b6:610:c9::8) by SJ2PR10MB7058.namprd10.prod.outlook.com (2603:10b6:a03:4c5::9) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6298.28; Thu, 13 Apr 2023 23:15:06 +0000 Received: from CH0PR10MB5113.namprd10.prod.outlook.com ([fe80::12d3:3f71:5b55:c342]) by CH0PR10MB5113.namprd10.prod.outlook.com ([fe80::12d3:3f71:5b55:c342%6]) with mapi id 15.20.6298.030; Thu, 13 Apr 2023 23:15:06 +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, Sidhartha Kumar Subject: [RFC PATCH 4/4] mm/hugetlb: add hpage_shift to alloc_hugetlb_folio Date: Thu, 13 Apr 2023 16:14:52 -0700 Message-Id: <20230413231452.84529-5-sidhartha.kumar@oracle.com> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20230413231452.84529-1-sidhartha.kumar@oracle.com> References: <20230413231452.84529-1-sidhartha.kumar@oracle.com> X-ClientProxiedBy: BYAPR04CA0024.namprd04.prod.outlook.com (2603:10b6:a03:40::37) To CH0PR10MB5113.namprd10.prod.outlook.com (2603:10b6:610:c9::8) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: CH0PR10MB5113:EE_|SJ2PR10MB7058:EE_ X-MS-Office365-Filtering-Correlation-Id: 0ce97d5c-a0b2-46fd-2b85-08db3c74ea9c X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: w4/AiuRqqnVrhVz90TnGnmq8iYraqYbHQFN0ywLo01p+6Nkyxy+8APIkKnCCFF6NmncmBEr/T8MVygvqUz4VFRKo8inelt/eYNaTZwm/aGyZGjdxb3gyfuGDIRWUHZ7tLmKlJ1C1m/97jqgv9dSdY67VKWTyLurZAJl8uIXn6aJw/Vmw61BmlUkH9LgRu/axYCvwHLMONDALjQxAhH+13mMxYJc7GnzUTHeoq3tjnqzToPPOy49BNPPi640SCEBUB/tOA3ZJroQBgLhATkNKoeWahilbvv8xoYEFBi4NS5qdo/cyGy2DDYgZe4v+mn8Dro3Hd2ioa/GPiPupjaIGlfvWLMXki9KQ/e/9k1N9g3I5ptdlJKzb6t8l+Myay6rrNj92lgiQK0MPgd7NNQfi3muieRcVOiGkph4qo4p/6cQo7gLf3S/nW9qh+0JKAFMErcwax3CAf1cP3q9lF8/zDbCM935zGcslQ+yrx9vBrVbHqv4GDEB5Ps0eWOEDAVteTz0zb9RebLIck7H88GzvQpiwVn1xBDADCNxf+c5/v/9lb6w7eCt3SKr/wAGbbRGC 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)(39860400002)(396003)(376002)(136003)(366004)(346002)(451199021)(83380400001)(2616005)(6512007)(6666004)(1076003)(478600001)(6506007)(107886003)(6486002)(186003)(44832011)(36756003)(38100700002)(5660300002)(4326008)(66556008)(66946007)(66476007)(8676002)(316002)(86362001)(41300700001)(8936002)(2906002);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: zQ0cQwAyeZuO9ZaIsSmTn6mpukd5n+njao2oscvJ/uV23+2c8nrxDJfLn3w9Yc3nNSKGUKaq4iWnx7lqn0/zFauUmyYY853tHFMIgU1XrLA+4n0+6sD0lXtuL+K3M9kQeXryXZK74byFdA67ZAndzmNQRzXgQpG1YUuXdVmAZjVy4ZtCooAYnxPR79582jHO4xg/tHoYEjfPUxQTKw3ayOjfyizUidat2Gg47EyURZOUvczdxqd4CXqEq0Wc/rmYmxyLYvhWjGC7ouMcQ6Ck9LJH0EjxzvLZA8WpQn/kX679x1WGtXn59lglJCUoVcQmCvl4S4SJxsXSYGmeZC6KfFRWxjZwJqzQW8zobBJgr/xVyp/ALQZiP4/4DHHrEkJog1Y5Fqe2TN7bOTjEZM1NHHlGJNCazNb6h+Qdh3Eoh0CyAu44WJw+lhLS+grmnji6igSOC0VNZusZKDGpb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narrZ0Atr+4wDgyqA7fpPHNzgLnhh8mT9qRnoC1Req7p0U= X-OriginatorOrg: oracle.com X-MS-Exchange-CrossTenant-Network-Message-Id: 0ce97d5c-a0b2-46fd-2b85-08db3c74ea9c X-MS-Exchange-CrossTenant-AuthSource: CH0PR10MB5113.namprd10.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 13 Apr 2023 23:15:05.8760 (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: TdEePQS+mOhZL7UIm+AP8kCmw+1+c6r9OJN8KAStDXoxMRRahulsj2xVVIi7v9fjKJmICLHNoIVmihkdzXKacavravfa3hWw2g9RzaLH0/k= X-MS-Exchange-Transport-CrossTenantHeadersStamped: SJ2PR10MB7058 X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.254,Aquarius:18.0.942,Hydra:6.0.573,FMLib:17.11.170.22 definitions=2023-04-13_16,2023-04-13_01,2023-02-09_01 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 spamscore=0 suspectscore=0 malwarescore=0 phishscore=0 bulkscore=0 adultscore=0 mlxscore=0 mlxlogscore=999 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2303200000 definitions=main-2304130207 X-Proofpoint-ORIG-GUID: n6gWasBagPD6C4GIBWJiFpEWZl7Uo6re X-Proofpoint-GUID: n6gWasBagPD6C4GIBWJiFpEWZl7Uo6re X-Spam-Status: No, score=-2.8 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_LOW, RCVD_IN_MSPIKE_H2,SPF_HELO_NONE,SPF_NONE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1763104989242901011?= X-GMAIL-MSGID: =?utf-8?q?1763104989242901011?= adjust the return value of hugepage_subpool_{put,get}_pages() by hpage_shift to be consistent with previous values. Signed-off-by: Sidhartha Kumar --- mm/hugetlb.c | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/mm/hugetlb.c b/mm/hugetlb.c index a28fbdff886ff..258c211020c3a 100644 --- a/mm/hugetlb.c +++ b/mm/hugetlb.c @@ -2992,6 +2992,7 @@ struct folio *alloc_hugetlb_folio(struct vm_area_struct *vma, { struct hugepage_subpool *spool = subpool_vma(vma); struct hstate *h = hstate_vma(vma); + unsigned long hpage_shift = huge_page_shift(h); struct folio *folio; long map_chg, map_commit; long gbl_chg; @@ -3017,7 +3018,7 @@ struct folio *alloc_hugetlb_folio(struct vm_area_struct *vma, * checked against any subpool limit. */ if (map_chg || avoid_reserve) { - gbl_chg = hugepage_subpool_get_pages(spool, 1); + gbl_chg = hugepage_subpool_get_pages(spool, 1) >> hpage_shift; if (gbl_chg < 0) { vma_end_reservation(h, vma, addr); return ERR_PTR(-ENOSPC); @@ -4778,6 +4779,7 @@ static void hugetlb_vm_op_close(struct vm_area_struct *vma) { struct hstate *h = hstate_vma(vma); unsigned int order = huge_page_order(h); + unsigned long hpage_shift = huge_page_shift(h); struct resv_map *resv; struct hugepage_subpool *spool = subpool_vma(vma); unsigned long reserve, start, end; @@ -4799,7 +4801,7 @@ static void hugetlb_vm_op_close(struct vm_area_struct *vma) * Decrement reserve counts. The global reserve count may be * adjusted if the subpool has a minimum size. */ - gbl_reserve = hugepage_subpool_put_pages(spool, reserve); + gbl_reserve = hugepage_subpool_put_pages(spool, reserve) >> hpage_shift; hugetlb_acct_memory(h, -gbl_reserve); } @@ -6871,7 +6873,7 @@ bool hugetlb_reserve_pages(struct inode *inode, (chg - add) * pages_per_huge_page(h), h_cg); rsv_adjust = hugepage_subpool_put_pages(spool, - chg - add); + chg - add) >> hpage_shift; hugetlb_acct_memory(h, -rsv_adjust); } else if (h_cg) { /* @@ -6908,6 +6910,7 @@ long hugetlb_unreserve_pages(struct inode *inode, long start, long end, long freed) { struct hstate *h = hstate_inode(inode); + unsigned long hpage_shift = huge_page_shift(h); struct resv_map *resv_map = inode_resv_map(inode); long chg = 0; struct hugepage_subpool *spool = subpool_inode(inode); @@ -6939,7 +6942,7 @@ long hugetlb_unreserve_pages(struct inode *inode, long start, long end, * Note that !resv_map implies freed == 0. So (chg - freed) * won't go negative. */ - gbl_reserve = hugepage_subpool_put_pages(spool, (chg - freed)); + gbl_reserve = hugepage_subpool_put_pages(spool, (chg - freed)) >> hpage_shift; hugetlb_acct_memory(h, -gbl_reserve); return 0;