From patchwork Thu Jul 4 18:27:16 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: 13724179 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 5552CC30653 for ; Thu, 4 Jul 2024 18:28:22 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 88AA16B00A8; Thu, 4 Jul 2024 14:28:07 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 83C176B00A9; Thu, 4 Jul 2024 14:28:07 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 5A1806B00AA; Thu, 4 Jul 2024 14:28:07 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0013.hostedemail.com [216.40.44.13]) by kanga.kvack.org (Postfix) with ESMTP id 3B8C86B00A8 for ; Thu, 4 Jul 2024 14:28:07 -0400 (EDT) Received: from smtpin20.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay07.hostedemail.com (Postfix) with ESMTP id B277D1610C3 for ; Thu, 4 Jul 2024 18:28:06 +0000 (UTC) X-FDA: 82302904572.20.1198ECE Received: from mx0b-00069f02.pphosted.com (mx0b-00069f02.pphosted.com [205.220.177.32]) by imf30.hostedemail.com (Postfix) with ESMTP id 4DBDB80004 for ; Thu, 4 Jul 2024 18:28:03 +0000 (UTC) Authentication-Results: imf30.hostedemail.com; dkim=pass header.d=oracle.com header.s=corp-2023-11-20 header.b=kiRzqXIO; dkim=pass header.d=oracle.onmicrosoft.com header.s=selector2-oracle-onmicrosoft-com header.b=Sd6JnKsI; arc=pass ("microsoft.com:s=arcselector9901:i=1"); spf=pass (imf30.hostedemail.com: domain of liam.howlett@oracle.com designates 205.220.177.32 as permitted sender) smtp.mailfrom=liam.howlett@oracle.com; dmarc=pass (policy=reject) header.from=oracle.com ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1720117658; 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=XTVQda/B1LDqelqTwWuPluxnpObvBBanz2FuJ3HyIMQ=; b=8A5wY3oWvfCwQA4MTCozcrECwk0/Izr/v3/7j6dBFF2wputWaQCy27E0zpRcCana4HP/tA ld4BnwuBgTP1WVCuFgmS9MjDeRHEQd5o68dXqluO3SwwHcUz4ERpj2L3b6q1+sIUUhhHNT O8Fddb0/5JUTpW0DCh5eWkFf8n2e6Qk= ARC-Seal: i=2; s=arc-20220608; d=hostedemail.com; t=1720117658; a=rsa-sha256; cv=pass; b=z9LHLH6k/6hJpg/lUYhmUUulKW2lSORIV19VDJISTDF2Y1XkR4QGlN1JiER6G06gSYCgFa bWQETz+V3pwcng12vcSqdTQ3CAqlTwt2sWjYsGDw1pY81vgPw4WNHQsBzAb04FGumoYBoF /lXzYFyAHPiocSjeUpm+UJg4OSmOpX8= ARC-Authentication-Results: i=2; imf30.hostedemail.com; dkim=pass header.d=oracle.com header.s=corp-2023-11-20 header.b=kiRzqXIO; dkim=pass header.d=oracle.onmicrosoft.com header.s=selector2-oracle-onmicrosoft-com header.b=Sd6JnKsI; arc=pass ("microsoft.com:s=arcselector9901:i=1"); spf=pass (imf30.hostedemail.com: domain of liam.howlett@oracle.com designates 205.220.177.32 as permitted sender) smtp.mailfrom=liam.howlett@oracle.com; dmarc=pass (policy=reject) header.from=oracle.com Received: from pps.filterd (m0246632.ppops.net [127.0.0.1]) by mx0b-00069f02.pphosted.com (8.18.1.2/8.18.1.2) with ESMTP id 464Da8ew031153; Thu, 4 Jul 2024 18:27:55 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=XTVQda/B1LDqelqTwWuPluxnpObvBBanz2FuJ3HyIMQ=; b= kiRzqXIOYpX9WQvQ13iVeNa5TJP/IFvf2XAagiepAuDsMFfyCa/gT41lDaKg+WE4 /HivymS9FELEeJW/p90fpOKiTUiXCJLwIXv4YW98UZvqrO2qzMvcdMwLNXqKnix6 jQFX+wQWFMsa1h6FlnHTMTScAK7aAyyw8PzbLIIMTMZHvBy9JGaZjDpXmD7oATHR ujuTjS6IrFMlsBMLLmfgtfXrYrSalpBK4I3G5ElOGoSkGWaTiCYvfuRSd4xQWPPa A8hEjLxBk+qnp9bPCHewDjadjKDTvuLIs0ZPjlB+gp8ubuF61gIbCNdINnoEnesO HD3+GBjQhCJ+kWMk3QRwGw== Received: from phxpaimrmta01.imrmtpd1.prodappphxaev1.oraclevcn.com (phxpaimrmta01.appoci.oracle.com [138.1.114.2]) by mx0b-00069f02.pphosted.com (PPS) with ESMTPS id 4029vstk44-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Thu, 04 Jul 2024 18:27:55 +0000 (GMT) Received: from pps.filterd (phxpaimrmta01.imrmtpd1.prodappphxaev1.oraclevcn.com [127.0.0.1]) by phxpaimrmta01.imrmtpd1.prodappphxaev1.oraclevcn.com (8.17.1.19/8.17.1.19) with ESMTP id 464F64KX035674; Thu, 4 Jul 2024 18:27:54 GMT Received: from nam11-dm6-obe.outbound.protection.outlook.com (mail-dm6nam11lp2169.outbound.protection.outlook.com [104.47.57.169]) by phxpaimrmta01.imrmtpd1.prodappphxaev1.oraclevcn.com (PPS) with ESMTPS id 4028qacuq1-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Thu, 04 Jul 2024 18:27:54 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=mEAltHsR6zYig+cry4SFJKO/dp5LBE2+hcjA8yCo2q5YbRisW3ZVIFMVo8k2tbvj/iquQ07Kx8ulWYqbwd/Xt6UvSQA3JAXQejBiOrmr1ZWwh5GOq6i539vjMERIyRzUAlHUzBOiTkPogGzIE5TB0lKS5+K/0/YQ3XINNj7AJUmjtsDWxZCyY/f/W4bnByTBMZ6vZWiTgLpWRTVRlHeDsPE40t2sX8bM94AvGl7mn8ATLKd4XcTaKXdwBBoASoyWcVY+wFlVGiClP9DbhSXHMMrsMEwsViibpTk+ym1hW0QThUhcUffEHLvHCK1gIsdpfpcnZuJ+4RfiS8yRz5QGuw== 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=XTVQda/B1LDqelqTwWuPluxnpObvBBanz2FuJ3HyIMQ=; b=PV1IDo16tyKnT0iHP1SEWv6YdqjLaU8i4847uvG/X2MivRsK9yY0+Ct+wAmrBoJlV1GwCWSzQkcAbR6VHb4fzqe5Vw8WLMBRsjppKkZdUxcch4z+rgPlFwhhrQmjdhn4IvsZfr2kxHljEGtU/9DBbsi2m0z3+ZuxYyml2vlkUO3arcANeTcvD/Ng5HLmBLLLogrnpdiybvJGxK7it3YCriTYqKNdc9g0lYD3Q5XKhPph9/zAWiTQx+JY77LlQ+NiB+N1K6SUx2q3X5kc+hCC0kl9A6AHvXWbP0Wu0d9UYi99QtQMzFJaEyAdBhpS7Jwi3Tn/MIqcypHHn6h55wpX2Q== 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=XTVQda/B1LDqelqTwWuPluxnpObvBBanz2FuJ3HyIMQ=; b=Sd6JnKsIWO3Ub1DCEl8PC1lVEF/InqkkQmqD73uZ6Sis+4EBGtQ6uCW/y/Y6dS5WDezwSbyuDJm3ig8X5d46TkEZr1KZpg6z2yoCvom0TlSfxIRGlG6I18q4kcI7J4o3fXDiRGczsXj4rwqd8qKC0zUgXBuQ9Z9h3TRDMNMp8h4= Received: from DS0PR10MB7933.namprd10.prod.outlook.com (2603:10b6:8:1b8::15) by BY5PR10MB4242.namprd10.prod.outlook.com (2603:10b6:a03:20d::9) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7741.29; Thu, 4 Jul 2024 18:27:52 +0000 Received: from DS0PR10MB7933.namprd10.prod.outlook.com ([fe80::2561:85b0:ae8f:9490]) by DS0PR10MB7933.namprd10.prod.outlook.com ([fe80::2561:85b0:ae8f:9490%5]) with mapi id 15.20.7741.027; Thu, 4 Jul 2024 18:27:52 +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 v3 14/16] mm/mmap: Use PHYS_PFN in mmap_region() Date: Thu, 4 Jul 2024 14:27:16 -0400 Message-ID: <20240704182718.2653918-15-Liam.Howlett@oracle.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20240704182718.2653918-1-Liam.Howlett@oracle.com> References: <20240704182718.2653918-1-Liam.Howlett@oracle.com> X-ClientProxiedBy: YT4P288CA0012.CANP288.PROD.OUTLOOK.COM (2603:10b6:b01:d4::16) To DS0PR10MB7933.namprd10.prod.outlook.com (2603:10b6:8:1b8::15) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: DS0PR10MB7933:EE_|BY5PR10MB4242:EE_ X-MS-Office365-Filtering-Correlation-Id: f8ec7f7e-931a-4628-91ca-08dc9c5703fb X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0;ARA:13230040|7416014|1800799024|376014|366016; X-Microsoft-Antispam-Message-Info: NuW42Xe5BwYwx485L+Uno2nQfALzxBNbYaXzhkzDFnZv3yic78Vmhfn4qcJgr++BdIu+stOwUcczJD1kSZ+dj2CdqkKF276DeXfD00pEGnTdRkHAplcwUU0zZMr5duo3JwBicJJw+PPbkwNVkmcfGikORTQp1i8aTxy1PROg/7Y61n80g14yEdxucdFcJXywRpmGo5dXon8wN+ogvj6/WBDLJL++qh16TQs3k8fs+evMFnzTlLSbY9YEhT4v0lu2aNVgAmWQHGpb6qTqtNatsDXyFchL6r3XCRqmGrbpbqb4dMjdpop0DkJBRfnONZLQB/I6vyK2FfLcdiGIgtjE9trrXQKM52s57yiXTk1B4ZNa9h7eSc9/YgyP55q2RE65+QIc0PfaDq9faH748tpXiDti4HFS2V05u2D9TAWUt8dwlnmSBuusCC4AxAjglzG/Mei+SmtH98qzapEbza9GqZuVAiywp9BDIgfdNQWaL8ie7P+YZBFbQw4x1lXi/DEY6gLrMID1+4UKqk/r2lm3/jjRQGbSBgIloAFbOeBEKD7JR7xYk50AvLznWFrUbSqpzkQGzJ1gmUaMzWEfhnY7P33YdewpK00E+4kVhERUUt/lpVwraceAIDWlPeoZmRKz39EzZY6bb3wY6MvO9jV4LtQo6vrJYg7Dv9NAZyDaPpapa9EOwyKaLHnL1IrkF7oGm+7m8z5LjfRQaBdQKXJDW4csWfHzjB3Qkxs5jKlvm/8bbbP01BmRZ4/VjWJNudrzA/ZNV9UR+z5NI4/KHkrehBr5+SnlhfimT+uwSzV1AsjRojVmwasX0dP4313n0OAV+yv8jshVU5ykfKhyC/9lTySPlt8XzqFpyFXiFzPnPGWlrafKG8tabyBTc4OIdFGyRco08XvtIJC+jms8ni9uv+TGLAzX0knyR5jklmx1xtiudJsqUrv1Q+mZZMPeFr0otbE/AnWS352jtYXLJhDdTlyKxL+oQgAzluSCcKjA9ESAAwxY+s2Sou/UobHqU2tScVFFQOo0xmifjja07dnxUDQR6ePRcbwVQycCRf0lgk5W2GHZNbzuA+qNViL12/g+OB7WLjmx77QpfLTctbkEeDzqK7ZHS2g42aetvMeb8l7a+Wbp+rkAw0eQ/6rM7x4CP3TCSDdLcjzg5f+kdg54I++RmDnt/AZCvkfpkhPwx8KgwoZ/soq8z0kISBgNLAqPqTGWmnsI8My7f9zfTivuDdzxijmAjI94Iw/Gc0s9QQcPKLu/f19uQumfvfg2L3PLodxqwbxFqWWOeFkHZaEpGb6tK0ki5JylVWxRP7+EIb/QElta5bZ+EkE2JK3j3v/F2kYrQewjN8K++SS9KpmnhA== 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:(13230040)(7416014)(1800799024)(376014)(366016);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: o0VEtkHYdJy+3+dQ/7wqIaTg8NEFepI9DyCue3Y9rBmWsxFHnQTheYUkTxQ/Uo8eFg2Q6q67n5qVGuaOoTnoKcSaQ5Be7CPN6gF+gNaCh2L1sJAINk1597V8NyH67i/tP/yO+OTKVDdIWbCweaAwDLyd/o7W2fEn4qFuiAeWQYkRCfzVcoFsCUe5hErPxg/h9VowzUUF/HS3uqB02cj9f2xSCmW8YIzFLD+8w4QAOGCnsdwUPaA0wXXyytuBgMD9uLhK6891QTtX3DOC1aeFeNw9MMADgCDfSZ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MHLaMp8sPwaA+n+KYm5Os5r0VzSyRQe0GkVhOnPMreqL6IpHREQj8NiBSS0h0lX5x9YrQdu21Lxxfv+HeEOgE3tnbqFKjBHH+MSNrujoAsApjzsL0nXjCWMbdNeOkfN9uTaPY//AXu4P+jN1VyFQ2R7wZkQ1dTQ4WuuKBzwpv4vXuN2aJc2Jk8hl94vKzYfMGSbQiIPzXY90fSgD12/3RjVSe7zDMwqR/I3RZncZW0cdXpU8YCSw== X-MS-Exchange-AntiSpam-ExternalHop-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-ExternalHop-MessageData-0: V0jUwuaN+8Vy4CthXtMK+3eougRh1kK16l0YISsbvvwmR18ISUuS6To/fTcX2KtWC8HMbeR4tFtTfPtcXpwGnmzfY+27AtqKgQdVDKHRrKuvWBeBSdOsgu5bdY39dH2sEkr6sGdrO8HB0MvUXTKjxkMo0s01gT2raQf2O3lAJEmDaQNsJpopNhRmF3tPxuRsBn7kFOpX5Y7CsxuN0r5s848VxRIDS1LSmhzB9CX48FWWfVAzgPh+/x9S4yyAcXUvgIVFpYAK1az/fW5m1i17IXHQriRTZv88nZlPTsD4KmG4gCVGq7oxDAFXOmS0bd1GR9hrhaMtD5PN0FZWmo9j8hqZZRUEhBb4jh3Nq8r/+zpz6utMw4aURSYrWzxnSTW7a0EA6nlqoyW9NvlVFF4raPZo0LoLpckhBijVvjuVpTJaKE0tEx96SZhltNku9/i2m8e0G9bQcejkX77/6mPSCbQiCkaQpQ6waVvmYZ7fkOixUcOPZaVk7t1vZxlDNuWGEvAiZR0zB+Wakyen3cdRkgvcWKPlmi6Fz5n/szfv1sMEz34Qus5Q5Z0cAQ3F2yAkqsbaj2Fn//mUmTQ8yINJDVWT+XELTM/Qp9eyM50GKFU= X-OriginatorOrg: oracle.com X-MS-Exchange-CrossTenant-Network-Message-Id: f8ec7f7e-931a-4628-91ca-08dc9c5703fb X-MS-Exchange-CrossTenant-AuthSource: DS0PR10MB7933.namprd10.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 04 Jul 2024 18:27:52.3601 (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: 98S4yYHPB24Zr5ZxdJno0jiGI7Coz3ruXq/dtYot93AJ1FGWEH99ZLSI0i+MLn8Gxu+TySGJouUvJ2jEIgVFNg== X-MS-Exchange-Transport-CrossTenantHeadersStamped: BY5PR10MB4242 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-07-04_14,2024-07-03_01,2024-05-17_01 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 mlxscore=0 spamscore=0 suspectscore=0 mlxlogscore=999 malwarescore=0 adultscore=0 phishscore=0 bulkscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2406180000 definitions=main-2407040134 X-Proofpoint-GUID: iThV8naY2yXnKOxOjPv6IdJlWPl4wiQe X-Proofpoint-ORIG-GUID: iThV8naY2yXnKOxOjPv6IdJlWPl4wiQe X-Rspam-User: X-Rspamd-Server: rspam04 X-Rspamd-Queue-Id: 4DBDB80004 X-Stat-Signature: ar49fcentd8ascofbf11qjhwftdfxebg X-HE-Tag: 1720117683-466594 X-HE-Meta: U2FsdGVkX1+5XtwhGRob44Ju7/NcJVJC3ET/YV3SdMuaATiuMEf7FWWvDM8D5o0SBAUdwBa2iZMZoIsQx93so2kgSqy4856qxnR/pcTNK1CfR0xE3bYdvOHzG2JkTNUTMopXghnegOkkEEHMSoBnRF9KKjXhFhiYLKADakW8mg2xvAgTQa4ujTi7atJtRmdAWf1ooUoBzLwUY63n2GmMEv2QTGkASpxzUxZ/A45jJ1OIjsmTWzp+3dzmgtIwekQih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lOjy20fne2kk1DiemXCHdkvvbOIWgqI/wS0+0NCn3P7g8cxdDkezJMDQcm0v7ZGjwKyQ+b7XxUr2Vasx4ECCi/3ZgCRrvTbwaESEtwArGUhnSgtSfEJ/5WQELnLxw98ULdNaGDCP38xRdh5W3Dwa9Osy8f0JZz49uBMAN8+RkwlskeEvKwAHnVz 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 Reviewed-by: Lorenzo Stoakes Reviewed-by: Suren Baghdasaryan --- mm/mmap.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/mm/mmap.c b/mm/mmap.c index 0c334eeae8cd..b14da6bd257f 100644 --- a/mm/mmap.c +++ b/mm/mmap.c @@ -2935,7 +2935,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; @@ -2955,7 +2955,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))) @@ -2990,7 +2990,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; @@ -3149,14 +3149,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)