From patchwork Tue Jun 25 19:11:43 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Liam R. Howlett" X-Patchwork-Id: 13711982 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 43B53C30653 for ; Tue, 25 Jun 2024 20:01:25 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id CCCE56B00AF; Tue, 25 Jun 2024 16:01:24 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id C7F8B6B00B0; Tue, 25 Jun 2024 16:01:24 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id A836C6B00B1; Tue, 25 Jun 2024 16:01:24 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0017.hostedemail.com [216.40.44.17]) by kanga.kvack.org (Postfix) with ESMTP id 866326B00AF for ; Tue, 25 Jun 2024 16:01:24 -0400 (EDT) Received: from smtpin27.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay02.hostedemail.com (Postfix) with ESMTP id 3D6471205A5 for ; Tue, 25 Jun 2024 20:01:24 +0000 (UTC) X-FDA: 82270480488.27.4B3F7C7 Received: from mx0a-00069f02.pphosted.com (mx0a-00069f02.pphosted.com [205.220.165.32]) by imf11.hostedemail.com (Postfix) with ESMTP id B511540021 for ; Tue, 25 Jun 2024 20:01:20 +0000 (UTC) Authentication-Results: imf11.hostedemail.com; dkim=pass header.d=oracle.com header.s=corp-2023-11-20 header.b=UpOhjxAW; dkim=pass header.d=oracle.onmicrosoft.com header.s=selector2-oracle-onmicrosoft-com header.b=UXnLlavu; arc=pass ("microsoft.com:s=arcselector9901:i=1"); dmarc=pass (policy=reject) header.from=oracle.com; spf=pass (imf11.hostedemail.com: domain of liam.howlett@oracle.com designates 205.220.165.32 as permitted sender) smtp.mailfrom=liam.howlett@oracle.com ARC-Seal: i=2; s=arc-20220608; d=hostedemail.com; t=1719345668; a=rsa-sha256; cv=pass; b=oxbFQP59O5QLZ3WZ+Aaf4rFW36bhJCKV/fLmEf79ezMIk57tlu5jYxWHwPAR3YP5hv4bBM d+r44mTHaK9wKtJYYZiDXuu6sgr0EFSNbEfiQDzhzFQWiIDHw+GdUl06O9JRFKbnsbZyZ1 pNH5Vkz1KH1NhCOMESbY25SYU6Ip0MI= ARC-Authentication-Results: i=2; imf11.hostedemail.com; dkim=pass header.d=oracle.com header.s=corp-2023-11-20 header.b=UpOhjxAW; dkim=pass header.d=oracle.onmicrosoft.com header.s=selector2-oracle-onmicrosoft-com header.b=UXnLlavu; arc=pass ("microsoft.com:s=arcselector9901:i=1"); dmarc=pass (policy=reject) header.from=oracle.com; spf=pass (imf11.hostedemail.com: domain of liam.howlett@oracle.com designates 205.220.165.32 as permitted sender) smtp.mailfrom=liam.howlett@oracle.com ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1719345668; 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=1pO27aodtfvC8X+gLBZpKTNrexrYAjXEivQorvyFbrQ=; b=G9/rgw2fAVYIW6Wax//oe47WirHfhS+qnaR5rag0ig8Yawm2lb6b2B7ZghDElUPC1N0m46 oYYGg9gZYev8B/QbfSdyZbhq9XSTEh9fGs9NnVzTiMm5mF4yZFbUUyiFPMfIf6orZ5tV0q A+KtxsUdDFp0P7g82pONp6Py097/Zas= Received: from pps.filterd (m0246629.ppops.net [127.0.0.1]) by mx0b-00069f02.pphosted.com (8.18.1.2/8.18.1.2) with ESMTP id 45PIfXbf021444; Tue, 25 Jun 2024 19:12:22 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-11-20; bh=1pO27aodtfvC8X+gLBZpKTNrexrYAjXEivQorvyFbrQ=; b= UpOhjxAW4BbjWLH2YPy77DKK6mw3HwrM6gYp7K5hx98+Lzldd4b6wN4E9eLB0L6v uO+fO0EN74wB7prIL+cXDNOIQDKytRDHoaNgAElQN/HG3y5B0zYeLKtEyDI1Sl+F gzZtC81MbDYruaaUCos9kehrO30Ja4mB6/y+1nbgeXVgKYFwJ0REGURb6+cP0F3K AVg8VpGhcJzqX5WDjlY80RPnbqUHAQcf5q4jKHV/0btfrGDCDzZs7Lptu1m3dY7h 18NW6E7BrYaljIM3vfWoZ/vWpD/2q4XeI7vCuAtLbwL//IU2FcgbrZQxMDsJ1Udy hy32T/n8+jhP5xoq0LRbxQ== Received: from iadpaimrmta03.imrmtpd1.prodappiadaev1.oraclevcn.com (iadpaimrmta03.appoci.oracle.com [130.35.103.27]) by mx0b-00069f02.pphosted.com (PPS) with ESMTPS id 3ywpg99avn-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Tue, 25 Jun 2024 19:12:22 +0000 (GMT) Received: from pps.filterd (iadpaimrmta03.imrmtpd1.prodappiadaev1.oraclevcn.com [127.0.0.1]) by iadpaimrmta03.imrmtpd1.prodappiadaev1.oraclevcn.com (8.17.1.19/8.17.1.19) with ESMTP id 45PIWuu7011498; Tue, 25 Jun 2024 19:12:20 GMT Received: from nam04-dm6-obe.outbound.protection.outlook.com (mail-dm6nam04lp2040.outbound.protection.outlook.com [104.47.73.40]) by iadpaimrmta03.imrmtpd1.prodappiadaev1.oraclevcn.com (PPS) with ESMTPS id 3ywn2egtu9-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Tue, 25 Jun 2024 19:12:20 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=bI7IsMAlUkALICVZV47uE65hpdNqbJqOWfFOoyvD7BDWrPwH0lb6ldWkZpg9ndq+L+Z0mqR6tjIAOmg77xjHklmOZsFn1DYDZ7VkyOh+tGz+tXc3jGuknyub0AumFRqqAXAeyX7SDnB0jWVL/nbq56erKBh8xCjwrVFc0qLCNLcWTKkMlf5Q31lYfe5aCRaDisQwT1zvk5vqm/xX1EGE8WTpruHnrobG6Z7aISKvZzN9YOXI/+w3LklVdGsbE0DAsiG84K6WJZHvLc9viIdb4AdmvR9SO0zvPt0UTEKbKRi7pgI9dYv73IDzDoYVD8LLaQBCBcUPQL0ia9PDW8HuVQ== 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=1pO27aodtfvC8X+gLBZpKTNrexrYAjXEivQorvyFbrQ=; b=OzyPTK8gn0KQyFcLXpzTHmar08TcKQ0AQZJzAjNA1xCejW0k/f1LzdskogxbphqirtLWPptM7hkMiktgX/JdJrl5BrUz+OW3yzFAMb1a8+BkP/ClI1jQoZVYD8Z7ApP9JmVeJOCrzi08SnXMBFOXj4Ty0zAbg3+MIiIGuxfcv89ksoIyYhaKioNZ3z5hQjamkkPsawoKoimYRsxjMy56xpmIxAeQ3xCyeTY4hJACvy/MkQkuvIfCtdrSRcMjQsxWUJMV0ZDXeKyiz8KH3+A1WT9mHlfx7BLpn7ydSz/9afVpv7xzUmEUQ2d71diSyeoS81/emuSoRZ2BX2LacIe42Q== 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=1pO27aodtfvC8X+gLBZpKTNrexrYAjXEivQorvyFbrQ=; b=UXnLlavuGJI6Qz6uxUskuLiVgRKheu9dvuRXVv4uNR4CNVX5Wr+TFhnVNEma30TUUtS5MWhJ2LRLjYRXHy3iEBlvytI4Sn/2Yo0zLsX3ApdxYpO0gVtFbBT6mtfmQYncOcQDTj1YGmGMyc6JR0cVSnLESl1xMIhEkqLcgqs+H2k= Received: from DS0PR10MB7933.namprd10.prod.outlook.com (2603:10b6:8:1b8::15) by DS0PR10MB7066.namprd10.prod.outlook.com (2603:10b6:8:140::17) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7698.32; Tue, 25 Jun 2024 19:12:18 +0000 Received: from DS0PR10MB7933.namprd10.prod.outlook.com ([fe80::2561:85b0:ae8f:9490]) by DS0PR10MB7933.namprd10.prod.outlook.com ([fe80::2561:85b0:ae8f:9490%4]) with mapi id 15.20.7698.025; Tue, 25 Jun 2024 19:12:18 +0000 From: "Liam R. Howlett" To: linux-mm@kvack.org, Andrew Morton Cc: Suren Baghdasaryan , Vlastimil Babka , Lorenzo Stoakes , Matthew Wilcox , sidhartha.kumar@oracle.com, "Paul E . McKenney" , Bert Karwatzki , Jiri Olsa , linux-kernel@vger.kernel.org, Kees Cook , "Liam R. Howlett" Subject: [PATCH v2 13/15] mm/mmap: Use PHYS_PFN in mmap_region() Date: Tue, 25 Jun 2024 15:11:43 -0400 Message-ID: <20240625191145.3382793-14-Liam.Howlett@oracle.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20240625191145.3382793-1-Liam.Howlett@oracle.com> References: <20240625191145.3382793-1-Liam.Howlett@oracle.com> X-ClientProxiedBy: YT3PR01CA0022.CANPRD01.PROD.OUTLOOK.COM (2603:10b6:b01:86::26) To DS0PR10MB7933.namprd10.prod.outlook.com (2603:10b6:8:1b8::15) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: DS0PR10MB7933:EE_|DS0PR10MB7066:EE_ X-MS-Office365-Filtering-Correlation-Id: 31b9780a-7e65-4eca-787d-08dc954abb88 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0;ARA:13230038|366014|376012|7416012|1800799022; X-Microsoft-Antispam-Message-Info: Hhu3ERdUxZxhPQbOqNZKcJjZRZFI/3UYyQ1Ym7kR8Y1NfjO3Jy03boiNHht2lCUssHh4jg88udvP2JtjGhgAn7RUMd24HfXRHSpimraal9GKKCnY2nyZpQfjbB2v8ulcb9OE54khW5AwaS8Ic6Q+nk45gzNwmYsrCViSYTcOQqFpDlHGieD/iuFFesZTjWWK+yTPDtRTYmiHNqefubyUmG2kCRhSIRz2yltb3Qwr2XDfAT7hBqxKuFI/0kqOcAvN3vHJo0f/Hk82o7gTSQvSh+Lx30V/ETyqiZsJAhIFoVnn7EroTQVHiQAMPFWioEBWHEbi9cXt9DL2x36dpkEIISWp1Uza6FUQO9rNm51Lmk1NGrkbmF8pbmMlRhY76tRCTG2qHGOZJ0aGEIeyN+ZPHKHgCCwx6pMKru0O0+bziIod1dl9vjRzphP1hX5LDChDJkkMWZpGD2bMLnUMtZz+rfTLYoMZeTD2HKCPXQw5Qxi94zepfhXMr9dY5byAkFheVJqUrUaggHIJg2R4hDvzufGyr81+MrTzmMnVUKrug7zsy3uoO1pcvqRWymQVZa0qmJmzLXsXI13w2X1ZnIiSZYA4n13MP+ymONWK3RS2dK7ixx7ZLHyWiG0pJYnT0CF/D/GpqL8vKvZ+3sVMoZwk6Eff4dECmgHwEwJHlN8ffrgio69udCjcVa/9Y92a8Z+MU4fEaywkKNAMSaK6FGygn+A9n7znRX+SlctiGPL3WlJJDdQYNvmMEQ5KkD4SWkn8h7vMtPHdszvDVBx0pooWl2P/8UymA0GECPvNDd3MlZVmkfKC9rCdxMLd+HsHTS9DPv4leiwZ/CqPaLtYKe/yHKIHlTLsKSIBIIi76QmEVdGTrKuC9BAXngYCT3Tl0BqQHvXNTdVY6wCLWj5aKKUk6ozVRAWWqOC0atVjuf+zN3MHp0dVMq4H8PCi0hXFEg7PiVyVOQ1Mz5CMag1Sc2o+BKqdz0mcFfNwE5FsIqLfiIXGjYj/t6w9trqBpvSO1wLNiQfMS8JgXUZ6LaJ8gI3YWTxU09lFjJ5WVQspZ9FjKqld5bmCXitZI5d8BkBYTNHt8OLf7X4COL2NEcgNpqReKDvFl8ZftqcA3SoZ3xiM2G7jBnVAkfD5dx7O63PBB2KH8NHDpwFRb/iaLCBbvUJL3ZafXKbfAaP73atMP5vTJyyelxgVimvoDadzxyTEJeCInZc2sf8QyF2qy09/Ncojn1ILenzDMabm9KNWP/v/MXFrGqekAD64lNFjBP6h2Xt/CylfkrzqkfePRRS9+P8o5h9PtA99mvCINo6dEa2dEiyQT99HqiS1Styfa2BWg2eUMpjPNXhhI1fV2WZVODCLIg== X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:DS0PR10MB7933.namprd10.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230038)(366014)(376012)(7416012)(1800799022);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: 9ItaIP+0qm2fBoILK/dcY4VsNcp94JGEO1FqMhvfpiNreu9G4YXJgufKEns5XbdTCES6uR5k6M6ztLyMNMWmREi4awruZ5Hj1cku9g4alZdGZ3ONaCT10nD48l/UQGaYP7pagM0xuRiDDrVs9zS1AHaVZKs3VVrr68BbuLCIQTgxlwezr67mTLKp+5yXEUE/p79vN3thhPUoTwtVWtf20h+IDZ5k4Dx9807vkPZ+3qICOHjV4XfFW3p+jGINOuijAx1qblvoAjDUjMcDZ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ebczt1cQSX56hu11Z1OIpKr4kFEM1ZXC9YGSyW9/daIt65Q4waL61+KIUHDFidRINSOgF+lCfgtAqnWUfh5zF8W6BM3Nqg87FRAfqeFePObRklu7S+yR6kbQ0zcsXPkgX7uOviEIlqGaJSmO+S7UbCcoCWEfAPjX/hnLv3ljG8KOIlt/bskFKEHR/XnyhYTCdviTuqlPktiAsFfA0P35hp8RnCWH2fknw3YVPylIOTFWaTRe1nZZ0S7kCIQ== X-MS-Exchange-AntiSpam-ExternalHop-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-ExternalHop-MessageData-0: lmOp8zGtp/vYBlqYgrzUL5H9at16r1PgZ9xoaMo9PqaD/4T/PZ4/oA4ijQmurLixNuDNjJ8f2pZkwDkdPacEC7ySTL2Pj6DSuWrq0e56/4pcvLG2W/55pRMxAeIKxAtghR7t9zr5f5PCpVSJycYLJ+dd0XTRln0J31uAJCP+0nYwnWMACHFf7ERwiC4pXPO3Ff9+YrxhPn9f/zHbEiMO+Y/ebYBsLwoU/hW3Ib4QMhBcy9PXXBkOE/z4xJkjq4CIxqX+ZS6iQHAjec7wybWz9sHJgkOOJyYoqpBLejj7DKyN2/WIEq7MyaH0V7r3pc7fgQLeDGD9DDofEwI4QmfYnV13G/G4x/o8/jr82deu2e0/ecrCNZb7DUjxtKM86X1uW+bnkoO1LIIZHu0Ln/jQbDCg5J552KY7LdXWv1PEOe5vZ2yM3CYos1PMmY5/4IIuqJkVg/22j8sGCOeAwnkug66NiO3Bzsk/ZnDZ4h8Ltqjytc68nOCqiHha5Da2YVyWNMAG3BDdL+RR4Y5pnfZlPqOgIq/YZrvDeYi3bd+v+hpBmvt7dBiDNZGo1EAOqf/S2L0P4rkYnTnyANwKUgethaxeeEPoMYyCxFiGlV5PEPE= X-OriginatorOrg: oracle.com X-MS-Exchange-CrossTenant-Network-Message-Id: 31b9780a-7e65-4eca-787d-08dc954abb88 X-MS-Exchange-CrossTenant-AuthSource: DS0PR10MB7933.namprd10.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 25 Jun 2024 19:12:18.7167 (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: s4UPJssrBMFEdKzpU2KaubEg0Gf49c6duCKRrdG9SPu0wCiztM6gY6v8+zigYZ7BDVqDLgY3TgX55vTH1YzECA== X-MS-Exchange-Transport-CrossTenantHeadersStamped: DS0PR10MB7066 X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.293,Aquarius:18.0.1039,Hydra:6.0.680,FMLib:17.12.28.16 definitions=2024-06-25_14,2024-06-25_01,2024-05-17_01 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 mlxlogscore=999 malwarescore=0 spamscore=0 suspectscore=0 adultscore=0 phishscore=0 bulkscore=0 mlxscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2406180000 definitions=main-2406250141 X-Proofpoint-ORIG-GUID: eol9UYN4NX4KRhF6moniVmPqXSffVbOv X-Proofpoint-GUID: eol9UYN4NX4KRhF6moniVmPqXSffVbOv X-Rspamd-Server: rspam12 X-Rspamd-Queue-Id: B511540021 X-Stat-Signature: oamcakpimpboerhkra9xxubd9swibm93 X-Rspam-User: X-HE-Tag: 1719345680-354847 X-HE-Meta: U2FsdGVkX19WS8+xeIfDtaq3UhtxEgalME1vAqvM6rjHpnRVIRGyd7pdentPumMRcgMqeoYOhexvjlf98y3uMsqBUuqlLrk3oO6tmGR+O69jtciv24M5gDR07fA/031S3ORHEf3OupgkchIpPvRs+mtyRvcRND0CNw4/3ZUguvA3PW9S0LTStBA24m+eD3577wiID8phrgT65hzB7WqaoUw0pgb9CJGB3BHh3RWjRMdF/lhBdt22fjR79aiudnB/Wl+GXzb+uS0keHgOskA+b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OnnkjVX00tono5SHqh5jWjTZP/FWscyIuo5SXCPdmPFk1MZ0p9SK0DfRnDVIRo6QPK4HKvqS7sMZYJPxBqHpssdOEGZHlMhnv9jSsRAfagj584jyiD6Qre 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: List-Subscribe: List-Unsubscribe: From: "Liam R. Howlett" Instead of shifting the length by PAGE_SIZE, use PHYS_PFN. Also use the existing local variable everywhere instead of some of the time. Signed-off-by: Liam R. Howlett --- mm/mmap.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/mm/mmap.c b/mm/mmap.c index b7f47964aaf0..f3edabf83975 100644 --- a/mm/mmap.c +++ b/mm/mmap.c @@ -2925,7 +2925,7 @@ unsigned long mmap_region(struct file *file, unsigned long addr, struct mm_struct *mm = current->mm; struct vm_area_struct *vma = NULL; struct vm_area_struct *next, *prev, *merge; - pgoff_t pglen = len >> PAGE_SHIFT; + pgoff_t pglen = PHYS_PFN(len); unsigned long charged = 0; struct vma_munmap_struct vms; struct ma_state mas_detach; @@ -2945,7 +2945,7 @@ unsigned long mmap_region(struct file *file, unsigned long addr, * MAP_FIXED may remove pages of mappings that intersects with requested * mapping. Account for the pages it would unmap. */ - if (!may_expand_vm(mm, vm_flags, (len >> PAGE_SHIFT) - nr_pages)) + if (!may_expand_vm(mm, vm_flags, pglen - nr_pages)) return -ENOMEM; if (unlikely(!can_modify_mm(mm, addr, end))) @@ -2980,7 +2980,7 @@ unsigned long mmap_region(struct file *file, unsigned long addr, * Private writable mapping: check memory availability */ if (accountable_mapping(file, vm_flags)) { - charged = len >> PAGE_SHIFT; + charged = pglen; charged -= nr_accounted; if (security_vm_enough_memory_mm(mm, charged)) goto abort_munmap; @@ -3144,14 +3144,14 @@ unsigned long mmap_region(struct file *file, unsigned long addr, if (vms.nr_pages) vms_complete_munmap_vmas(&vms, &mas_detach); - vm_stat_account(mm, vm_flags, len >> PAGE_SHIFT); + vm_stat_account(mm, vm_flags, pglen); if (vm_flags & VM_LOCKED) { if ((vm_flags & VM_SPECIAL) || vma_is_dax(vma) || is_vm_hugetlb_page(vma) || vma == get_gate_vma(current->mm)) vm_flags_clear(vma, VM_LOCKED_MASK); else - mm->locked_vm += (len >> PAGE_SHIFT); + mm->locked_vm += pglen; } if (file)