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: 13210734 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 6D1CFC77B6F for ; Thu, 13 Apr 2023 23:15:31 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 82078900003; Thu, 13 Apr 2023 19:15:26 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 731B0280003; Thu, 13 Apr 2023 19:15:26 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 0C7A1900003; Thu, 13 Apr 2023 19:15:26 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0016.hostedemail.com [216.40.44.16]) by kanga.kvack.org (Postfix) with ESMTP id C814F900006 for ; Thu, 13 Apr 2023 19:15:25 -0400 (EDT) Received: from smtpin29.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay04.hostedemail.com (Postfix) with ESMTP id 9A0931A04B4 for ; Thu, 13 Apr 2023 23:15:25 +0000 (UTC) X-FDA: 80677926210.29.971AB51 Received: from mx0b-00069f02.pphosted.com (mx0b-00069f02.pphosted.com [205.220.177.32]) by imf19.hostedemail.com (Postfix) with ESMTP id 2AFFA1A000B for ; Thu, 13 Apr 2023 23:15:21 +0000 (UTC) Authentication-Results: imf19.hostedemail.com; dkim=pass header.d=oracle.com header.s=corp-2023-03-30 header.b=RtzKl0p7; dkim=pass header.d=oracle.onmicrosoft.com header.s=selector2-oracle-onmicrosoft-com header.b=GCSubIwn; spf=pass (imf19.hostedemail.com: domain of sidhartha.kumar@oracle.com designates 205.220.177.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=1681427722; 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=PRIpQsJtmpDtH4hp/QDArazlqT6QZEBMdTRXKdj9SoA=; b=MlJtPAb7N+lT3TyCA4QsKKC7uCPBKoau8jGu8B03PivXSLSv+DogyEdeP58Redh1K7TXk8 iGQDyZfSR9JU5tyTprngDpbKW1N7HCZ5YMWYvS9eWhB+4ktjXGF/D9KK62MGCHLRSb4+tR 7eCwklB3OdIjcNK5ynXUS2CZGp3d5Mo= ARC-Authentication-Results: i=2; imf19.hostedemail.com; dkim=pass header.d=oracle.com header.s=corp-2023-03-30 header.b=RtzKl0p7; dkim=pass header.d=oracle.onmicrosoft.com header.s=selector2-oracle-onmicrosoft-com header.b=GCSubIwn; spf=pass (imf19.hostedemail.com: domain of sidhartha.kumar@oracle.com designates 205.220.177.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=1681427722; a=rsa-sha256; cv=pass; b=BFORiehOBD/YQbRK3Sl08szIaTNLY1gpZHorVK6BSotNy+wL3zPBNQYcb5052coho9+rhV 7zDR2inCL0eWgzYuwqglmEvE4ETis71boVQRFMxIPeBqwR6U+9WUtAFAqYeWa1v/RtTyry wHiqnKKOR77mbstnoFKT97rvwrN/tmk= 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-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T3xeGRBymzMVcKVAXQ31+Jgq5x1quK9oZp8lBUyh/HEMI3V36AluGgHn2dhSIsOhkTycUQp3A5mKN8tnZBRgFnovm5bIND/KDiPJuYt7ps0L2TIpjOSypwQEKKyMeOE257kgyaCDDbjEcPxprq7TCkX3kRxKzfOPCsV2J0Yz0NGXicitm28u+wrwaATIhP4iqHD2Fpyv1YfW8NDaihK3Df2UFlxAFuvBTxu/EqviIrqpbip+qc3+LFKznlVoVMGi8taT40TxxsxrLqccZA8Zk+G9eVcTh+vF5YVeuRvgH4C9lRmHm7GSGQOnNBbyDpBg6aUZEj2QaZvesiAKUAQhqb4fVS1xr4t+P/kAmyrrTPv8Ol7+HX3H6qgU5D1GF3+Dai48P87tINeiCO5/fSZSIlaDzXLFKcBDaJhj9Vu5Uw8yqaIfG/5UhrExuSWuholzEEoJ3K2WTdQCK74RTmzqMIGa00dZNtbaOQU7me5fB5oqOK2eyOS4OtLmR9nLDpnADBHPhOzvTszSEcyMZJaIQOJIaaNzR2CWQZmP3qplEWNPNZ/wjVtx6pv11BspOi903jgHW/kLYQ= X-MS-Exchange-AntiSpam-ExternalHop-MessageData-ChunkCount: 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-Stat-Signature: rkdnf6wjxcryy5yeee854yh9wchaumxi X-Rspam-User: X-Rspamd-Queue-Id: 2AFFA1A000B X-Rspamd-Server: rspam06 X-HE-Tag: 1681427721-569558 X-HE-Meta: U2FsdGVkX18uaHTgPgMgWqS455/+3vSV9ELhfsyHPDUDZNhk3VxZ+J+k7GR8/PlhDbL8SWuKacRzgafC4Fxm8OS/PTsH+dvLxab3a7p8VeHjqjI/KQjPVwyuue2cLhe/T1H+tPhqAQxHuF3BtPWwSoBjrVUYIZa+pTeNoiEuQ8xz5BowOTAHGLoOtOKSsRoc27tCt0nJeytDDHvVTfTLYdYKgnJ8ipMzKNT+rvnxNMwdHQYIIxqbPimjjsaOJ9PAWy1c3lPS5l7a47fg3vzkS6bzPCmY80eXRem6rPOKQrRG5kpbFfWQhSbUSLU9Gfxi8kZb5WkiIt6+Zm+L1CZdFzAYTOpmyyIKUNvbHRraiAdmBAKGmFm22kq9wlSAItgD+8+vbl2dh9TOV+PeBCWlFlZgWhY4nz21qazU6WjwA4mWIk3QsaLpcS8hGp9/j9rWyugJAZzDAIYKRECPBjr2rrLfCLivxk1gK9YGwviB2co3zgCWXftrpYwA2TtcJvNuDQJpcIYym10E+q0RHEi3oAsZ+LbBcXwLmBT6HyBQJYhOgS3aJTtOvpBH9BIVy5QNgy9b496pupzrEm7T0if3Kbq2ywlV0rZy3jvcOBY0g99vnGHVmfUSKi+6Yawjf0b4c/lWM1MLtrQ27VKenEo6KUoLqfjpbudLViioVONgk2X6ul7NhNUlJF+Exxqh3NsaC/Bvs46xQGwE+QCRfiy/vN4JYkZa4jZJsv0F68O4dtPcMchZxnR5aW45Li2M7Zkw/M3ehcQnv5/PAZzqbQmu5ogWHz5dwSHlMauDdxvC9TnOV2VIYROL4yAflnzl/RbkuqslQAlb+Lm2NMkvI61keFbcDQjkQPDrK4lmOeyeBtLsHEALISPU7k9sYw60y/5dEXUdVH27lw8P2DK3MvhfUMTZjWD6gWF3LJEvBdEAk7mbZsQGOqNkLj+0O4tmwJhfcx1H7hHJBR75tjy7/7w xzTT5Fji sV7MMFmOOi68WRaohVtXEi70GGJWYHhVjXncO7o7EuQyhv56xWfkQEVTOJsGq0bGduzq0fbANqZWf4p6jokqJSzgt1ZmDWhXewoe9aufodO3aAHxOWVMYx+uDVDGgTyDI8uRCwqf2HvcubsY224UGRWAmQ1r70RcxBzcxG4ZA2oiopH2/kd/Tt45nZ5D+Z90mVEcxibENyTTq0pLpGl8gw8u7v2Dlu9JOJZmZB8iAOo35kWrWtE5PqfIw4SHzbJUVp4UtnzBlT6LKoAD2bJcbmRJCJJ4ZupK4Ht26e0VWr77dCRVvjSG9i8kw33gz0KR4UDyiYUIhwFnq52X7tsIo/M/vTIsr0et7PZK7WSSJAWoTxK6+bWqukliEh9xPw/kKvTNL7tDDTYV8EGFDQDmvwdD0mg== X-Bogosity: Ham, tests=bogofilter, spamicity=0.000000, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: This patch aims to remove special cased hugetlb handling code within the page cache by changing the granularity of each index to the base page size rather than the huge page size. Signed-off-by: Sidhartha Kumar --- include/linux/pagemap.h | 6 ------ mm/filemap.c | 36 +++++++++++------------------------- 2 files changed, 11 insertions(+), 31 deletions(-) diff --git a/include/linux/pagemap.h b/include/linux/pagemap.h index 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: 13210733 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 BC19BC77B61 for ; Thu, 13 Apr 2023 23:15:29 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 53760280002; Thu, 13 Apr 2023 19:15:26 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 3D996280001; Thu, 13 Apr 2023 19:15:26 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id E3451900005; Thu, 13 Apr 2023 19:15:25 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0015.hostedemail.com [216.40.44.15]) by kanga.kvack.org (Postfix) with ESMTP id B6056900003 for ; Thu, 13 Apr 2023 19:15:25 -0400 (EDT) Received: from smtpin25.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay03.hostedemail.com (Postfix) with ESMTP id 8D1B4A045C for ; Thu, 13 Apr 2023 23:15:25 +0000 (UTC) X-FDA: 80677926210.25.320C91B Received: from mx0b-00069f02.pphosted.com (mx0b-00069f02.pphosted.com [205.220.177.32]) by imf23.hostedemail.com (Postfix) with ESMTP id 2DCD114000D for ; Thu, 13 Apr 2023 23:15:22 +0000 (UTC) Authentication-Results: imf23.hostedemail.com; dkim=pass header.d=oracle.com header.s=corp-2023-03-30 header.b=r1GL5Ekj; dkim=pass header.d=oracle.onmicrosoft.com header.s=selector2-oracle-onmicrosoft-com header.b=BFTFRveu; arc=pass ("microsoft.com:s=arcselector9901:i=1"); spf=pass (imf23.hostedemail.com: domain of sidhartha.kumar@oracle.com designates 205.220.177.32 as permitted sender) smtp.mailfrom=sidhartha.kumar@oracle.com; 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=1681427722; 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=nNGzYXNZiU1HGYEV2TvGskVf68jn6hY1qJpj/I7cqww=; b=c3f6rzhzvPAIOf2u3VilADFnMBeyFKyX+nWnxuJcekShWtNv0CkAs6wX1snT18XmRccB4x egIPJGylC/HEFbN8fPZgV3GPkQ0XDhJ0S9p6nmb665F5kupRyJ+gFPi/nCwjOOtEFbMKmZ ezEQfWT6Phm2tOxquEaPF/UUamlsQio= ARC-Authentication-Results: i=2; imf23.hostedemail.com; dkim=pass header.d=oracle.com header.s=corp-2023-03-30 header.b=r1GL5Ekj; dkim=pass header.d=oracle.onmicrosoft.com header.s=selector2-oracle-onmicrosoft-com header.b=BFTFRveu; arc=pass ("microsoft.com:s=arcselector9901:i=1"); spf=pass (imf23.hostedemail.com: domain of sidhartha.kumar@oracle.com designates 205.220.177.32 as permitted sender) smtp.mailfrom=sidhartha.kumar@oracle.com; dmarc=pass (policy=none) header.from=oracle.com ARC-Seal: i=2; s=arc-20220608; d=hostedemail.com; t=1681427722; a=rsa-sha256; cv=pass; b=oplvyRcRFVqcLBDNa9jiNHBOBh/NdT0onyNP+lLQ+ypGQu4ZCbhwuOfv4rXlYGRuYu1ToX nMMDSB8Gu5gOxR2qQAZzfuZYBFHxkp8UUR+0cZTr0JwrX3N0aieDNGLvNDsGkKDnfwGuS4 j1ndq7ukTGJSsZLF8VlV9XqtFBDS7O8= 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: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qCWZ6sa7H4zdbSrOy2D9/qW4BLWg2D3S+yNr+i1b1n8pGF+BuXsi3lbvgc6Ymr4CWCJqJbjz5BP2VdWGvqn2C3fUSBlJo+C/pZ5KHqk/T5D9YO2BAJXE9l/j+251393DXbfVCj0divbTlq8OnTbFswU/+AP87ns2/eAxWFlr9E3MdOACfHVm+ZP0KaRDw25Sp04JMj63Eby356QUWRw94eePocdjcvh06lzE5ShGJ0mLH+6YJmSlJyVp5JktxSq4pg1ig4OKNx5tlSSS5cBT0u0Ui8SRBreARFOknwG9tzHW1SCPEf586o6OhV8SNM2tbW+C0G5aDaumIWIukR/WLq1y932QteZ03wkEEhNmf14QWYfvW6QOTOXyFY6zjqsOhAg8hfRiCWf1phouNePDBi6qNojtyHLJVYFjqlWOHSMUE2l0nNwZsxxkrcWICHtCrV+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-Rspamd-Server: rspam07 X-Rspamd-Queue-Id: 2DCD114000D X-Rspam-User: X-Stat-Signature: 974jzsrhrqyfwcuukjwwbtcde8cp3gza X-HE-Tag: 1681427722-478454 X-HE-Meta: U2FsdGVkX1+hbsOqkcomdyQMZPa/ahZnchuDRA64VdcLXlwrrHN6qF+Iqasey0/qIhjnLh4tpLI7HPkZ7WS120LatZQYk2cPILqXFXxgBZKyYCe7b1Lck5p2hYNBIakFIIjOXC/003G8uRbBprbiKh7JquhxyfJNLBCMcvG2u6Nu3SdQilK5NcfrPAJX+Iper5/l5npi424VmOXztS9RmWiHzV0TdsI05vY/nTSBRCiR6b1tjnPDHugXMPHJK4V/w1SblYJJFirPYdbaqYQq9fSjMvIdvMZoUB/xWlUHzyhJdgb72Y0qdzhTFbbB7bSu34mc8ewF90foT/J/rtCr6a4cj4msPUdzQy5vTmyZfjAwlP5P8NujKVC97FA7v7NAh8YzRQuqSYxHzzlVmK8K794X2sH9Feyc3HhHK9tMXCSAiJ0PNY9eq6l2OGk0Yqxs6Isc+yqJbC/LqRFyUUMBTYrtQVZK1BBAdCFSGIxr0/8QVVwa5azyU7fv6PGVh+ZvRKcYNtNdOy+oFrhrhK0Rf6yYcIMwX0+GNZx8RvhLF9ITRvq+O5ofNwxpOFhO6pXljsHqj/qI8zM64I/6gsrUKR7TG7DYLWhP3fwIj1Wc9l/EMJ8nLdpjZTybWpLl5208xZV0aemzvM6F0sKM3lSzX5XDDeMDFepxeRQoBgPFD01H5xEFH0pwhWFcZXSXpBu/Sd4WfJPap9u3fJxccx4rJLl84WWU3ATtgQdkDsRrMRKrxJdITgiQxcNOG2En/gMnhaq89do38a32re6K4M7TC5ZNtPof5gYzKPC009t/ufLI66Rv/jt7Fa1v+CVgxUlyXW2T7xGUaeynDGMNEcZb8MsJDXjevwgnRlTYyr570hnW+nMAjbDkM0/WnMMsXKMziLdD3f4ZtMxlGRNKNpF+/+3uDe/ZJiQ1q0yckuWHyw/syagzN3YstStmou++zHW0Y89EmAWXIQWaaZulMUB HDKd2hsP rP6DVWAe5T7cpHbcy9f4m4afEk1bylt7Ma/0z+HxcLyLoKQQr9WGbW7og7VH5YHeI+pmEXmMQH9gamcleZyjKXJQ2vC24WXvKdBng7T4IMUGUdAa0yI2avpoZaiZZs5uPlVYJ6+inGyWmYQP+fNYxmezwhAknhq99YE6P9U1dd0PJ5Saw1xIime9nnO7VEGSy2RXX0YMwj694Cv1AHkOpe/UuNF9ygoa33u9hEJFJq4YLLK+yav4VQsxFYktE7sCiIi5jwq9M17lGIgOb/MdkK9Y6iTwrZdOJmU0vbjlcnvA9TGjvtRIMA5Zql5mimM0sjjVKlMl6I63QJs67BUrFgl2hPonddmL0t6HOvTsatKWzRYSRTH5u5Y0k4oxcDVLiCAJxPS8343EWBjujYpPptzuGpPsEUjK5ZlNkifDg2XrGBAcPOL/no67gXdP7evUF4/Wh 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: 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: 13210731 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 4B62CC77B6E for ; Thu, 13 Apr 2023 23:15:26 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 152D1900004; Thu, 13 Apr 2023 19:15:25 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 0F1D2900003; Thu, 13 Apr 2023 19:15:25 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id D6FD8900004; Thu, 13 Apr 2023 19:15:24 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0015.hostedemail.com [216.40.44.15]) by kanga.kvack.org (Postfix) with ESMTP id BFFCA6B0078 for ; Thu, 13 Apr 2023 19:15:24 -0400 (EDT) Received: from smtpin08.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay09.hostedemail.com (Postfix) with ESMTP id 86A688049B for ; Thu, 13 Apr 2023 23:15:24 +0000 (UTC) X-FDA: 80677926168.08.4EDF0CD Received: from mx0a-00069f02.pphosted.com (mx0a-00069f02.pphosted.com [205.220.165.32]) by imf05.hostedemail.com (Postfix) with ESMTP id 20D6510000F for ; Thu, 13 Apr 2023 23:15:20 +0000 (UTC) Authentication-Results: imf05.hostedemail.com; dkim=pass header.d=oracle.com header.s=corp-2023-03-30 header.b=aAJT1FNz; dkim=pass header.d=oracle.onmicrosoft.com header.s=selector2-oracle-onmicrosoft-com header.b=uqU5YTuf; spf=pass (imf05.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=1681427721; 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=uWAWqf/Ei3Fj5gyx8nFYEz2lrYRudR7/nq90cXKlESk=; b=dgvNbI99zKtSp+MfJYUl48DkGtRQ/oxopxrzb3Xgr5IArwkkVGsNdW1x8q1wqvkLkU+1tc AHJ/1A63RrCKiF4XXMcLHyDHbjWVC/YwxSTbaLwsnSXsePlLeoTuAWXFnF5DFKcRkXXTup t9OQHjwCqwgffKeIHzpQWML3AjZscxc= ARC-Authentication-Results: i=2; imf05.hostedemail.com; dkim=pass header.d=oracle.com header.s=corp-2023-03-30 header.b=aAJT1FNz; dkim=pass header.d=oracle.onmicrosoft.com header.s=selector2-oracle-onmicrosoft-com header.b=uqU5YTuf; spf=pass (imf05.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=1681427721; a=rsa-sha256; cv=pass; b=WF2yA24UfDQJ3C9cr6T0jowlWj/eEM7t/GUCtIcP6PtoZu2o9pUXt7zfL047HP3tiD6sck U68AThoda8GK5X73Y1/lSClORKFup+SnODvCKdHrt1hWN1AtO8BlEPWZr4l+XUOMwDunZ9 tr7TXgBfcU25o0Ki+25m9wl2BE2sADk= 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+8xOlK5eB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Org: 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-Stat-Signature: 153htsjfu3m4i767ctysibcdzqqemhus X-Rspam-User: X-Rspamd-Queue-Id: 20D6510000F X-Rspamd-Server: rspam06 X-HE-Tag: 1681427720-272011 X-HE-Meta: U2FsdGVkX1/ccN4dxsGZH5rR57l0qHmi9pUPuCEh533PD86NA2zjaABpADNnXdMSd5W/0+Q726ugtFFrEMLiNdVgWZnAhvtB+V2wex2gknovttOBUUYr7p8P/6h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9hDFoURb66R0FXrIHqknGDU2usxXqEgNJF+ynpotuzDAedXqJ61es+5ohbVUsX+wfGJUKAY9fkTh7GB4r74wO7LcBW3PpARwTkzrw2PhZWIBoW6YloktZz1yg3yckCPJHgWRS1jvD5XQotf1/vzEk7nnebu68841gFU9bZ1R2qtFMvonhBUzCT9klX2HipCD5b2i4cJIShtoh5Fv/WPmLDRl0VYjPy18f8Pt9rWJXv9w4FbibCZtOj8 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: 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: 13210732 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 F29E1C77B6F for ; Thu, 13 Apr 2023 23:15:27 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 2033B900007; Thu, 13 Apr 2023 19:15:26 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 18AD7900006; Thu, 13 Apr 2023 19:15:25 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id D71A7900007; Thu, 13 Apr 2023 19:15:25 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0016.hostedemail.com [216.40.44.16]) by kanga.kvack.org (Postfix) with ESMTP id B90BB900005 for ; Thu, 13 Apr 2023 19:15:25 -0400 (EDT) Received: from smtpin26.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay03.hostedemail.com (Postfix) with ESMTP id 88014A017B for ; Thu, 13 Apr 2023 23:15:25 +0000 (UTC) X-FDA: 80677926210.26.C3F6A60 Received: from mx0b-00069f02.pphosted.com (mx0b-00069f02.pphosted.com [205.220.177.32]) by imf25.hostedemail.com (Postfix) with ESMTP id 265DCA000A for ; Thu, 13 Apr 2023 23:15:21 +0000 (UTC) Authentication-Results: imf25.hostedemail.com; dkim=pass header.d=oracle.com header.s=corp-2023-03-30 header.b="0dvFtMF/"; dkim=pass header.d=oracle.onmicrosoft.com header.s=selector2-oracle-onmicrosoft-com header.b="rFxE/ssf"; spf=pass (imf25.hostedemail.com: domain of sidhartha.kumar@oracle.com designates 205.220.177.32 as permitted sender) smtp.mailfrom=sidhartha.kumar@oracle.com; arc=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=1681427722; 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=Pn/uyozvyYbUQ9JbCnKLeYMPmrjAiQHRp1hAqucWDsI=; b=3Jt7N/MnHfryLaFNkByrLlzIFapZZuo/dgFEG76H+LBQjgZ8kGQ3dMexvESfD6j9m95N9Z CGnZlN/wCGS7OZ+m7lrrAUB8XACh4pmvj17bTePkHlGKhX9tNR8hLFvM2Dv9YBZoEpuZz0 3Dxi6NKvylvsnV6Ct9EETIpkpx9EQXI= ARC-Authentication-Results: i=2; imf25.hostedemail.com; dkim=pass header.d=oracle.com header.s=corp-2023-03-30 header.b="0dvFtMF/"; dkim=pass header.d=oracle.onmicrosoft.com header.s=selector2-oracle-onmicrosoft-com header.b="rFxE/ssf"; spf=pass (imf25.hostedemail.com: domain of sidhartha.kumar@oracle.com designates 205.220.177.32 as permitted sender) smtp.mailfrom=sidhartha.kumar@oracle.com; arc=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=1681427722; a=rsa-sha256; cv=pass; b=OZgIv1F/iPmtj3SaT3uuuBg9q9j5RhJJ9SUxuSKNWzC5Q9WFZ/BkTwc8CcLAhWK/rur7We aWFfJVUNhpPHo8GuW0w1pVlrhykFtgY/sAfXLmUPOHGGXx5G6Tuao5HXOwaxqcU7gAYSWN wXl0YC3aKvPezutdtD218+wzmbFsYHs= 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+grmnji6igSOC0VNZusZKDGpbbElOk56e4l/yDrnULTDhpjPtpKiH96iJwjl/kd9o2ajCWnIUl+CIocHQM0KkgwAY1aJqQUI6cQu/XP70mGpEYmrYYN3jJltg7daxiK+1sBh4oS0Ot+F3ZvPVTQUvh/pofvLuUTZbuif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ChunkCount: 1 X-MS-Exchange-AntiSpam-ExternalHop-MessageData-0: 3zEwby3LZ8OvMnyC1lSDD+KKAq0vX4CgJuPqEnd3R6fb0gfP9cUhSaRJhvTaNbtBiyXLAuPVFWKSuA9bg207qngbveIZKxPxzPDF0SHfxGpOl1JVlcOr+ct7gM5W6D+NS4UbK7hLcb3KdYdy3ZAKq/bQBavdiT5vKYtR8EVvmzkMXIj0vLx9gZZVYckwTUXrcfy/gdtb4CDd0n91EhO1WOuInxTq9IuTwasEEnS2fK4fGMHQngMgkq0ZhVumfeP6mHBty4nesu2IQEXEdzln3ioj84jrQePLrcLVD8nxAdsr/MxVisQ1wXODpImYR2gN1h+GBh8GcDeLZ3+gD3EKWIkdJLA2R/HKQ1Ovi0sGMJrv/ZiQJWrZNLyuYoFCe3zEHrwbPoSfB1deXXsnxuhfUR90wR3rJbOo0HvfDswXIQJ4QHVKeBs33qGP9wY6oX4xF4WqaJkKafb3EYs1rLRUPZj1b6vs22DoA6+C3gYKcc/lS0W/b6/2obMY579tzhiQ+LvjgjKfN88FEWCyWxNd86IRcFJHCrqiTaeGCF+BesjDkBEtdk3Mo9vlTW2aazFSicTYK/kaoHeg+43BYx0MzKu7pMB/fx7E3zqdfuq9A71OQldhQ9VWmIpxBUq2BS9f9lv781lyJVKVk0MBYMRghDBz1ER1cES7lz7uLw2FgWkIZDJu14ebbTWDYSje031r9nYPTOvBGjmZgEu9nu2N76UCS9sCCQrht37wRhwqoPPS6Q2Ru3z23j3vx0h68I+vQ+HYYnFfuHgIufHGbkbG5/h9F371LKl7JZtly0rNJ3Rgwne3OICbQKtG4mIeUmJFswpHmNyVPEGBJKx7kLtGxQpvSaWPJj3JEjYQSEzb+NLRmRYEv8AdNchM3w1J4narrZ0Atr+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-Stat-Signature: njdyrcrogab3j18keb35sntwrr41rx4x X-Rspam-User: X-Rspamd-Queue-Id: 265DCA000A X-Rspamd-Server: rspam06 X-HE-Tag: 1681427721-924572 X-HE-Meta: U2FsdGVkX19UkKtMDK3GlfCg4Loq/eHyKwLeenxdQIf/t4429QlLcZvz7vuHrHAXjIKAyvkekk9ExQeEICG6F1jD+7EjaWxKOvRzqYJhhWKX6+9IP8MpIZzZkEtnGmqDShc16kL7B9D8pJAcoA+aGB3K5DQUZRGF1dqNC+Ysjpxuw2T5gOqy49vGhgGNNOFgaECuxJ6kfXap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JBSfKFqbxN2jHwyxjfu07UIOwVn6QA26aEV4rADzOAsfLblczKPxWyDcB0iy+01pFTTf1xzR6b1LpFV2YAQyBBda9RLGkIdeVjX68ON9ugZ4TZWh54eh6bGGc0khpVTQqjft7 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: 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;