From patchwork Tue Jun 25 19:11:44 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: 13711868 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 75C42C30653 for ; Tue, 25 Jun 2024 19:12:53 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 77EC26B00C1; Tue, 25 Jun 2024 15:12:34 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 68DDD6B00C2; Tue, 25 Jun 2024 15:12:34 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 41EBB6B00C3; Tue, 25 Jun 2024 15:12:34 -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 1A0D36B00C1 for ; Tue, 25 Jun 2024 15:12:34 -0400 (EDT) Received: from smtpin06.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay03.hostedemail.com (Postfix) with ESMTP id 3EC5BA057E for ; Tue, 25 Jun 2024 19:12:33 +0000 (UTC) X-FDA: 82270357386.06.4CAFFA8 Received: from mx0a-00069f02.pphosted.com (mx0a-00069f02.pphosted.com [205.220.165.32]) by imf15.hostedemail.com (Postfix) with ESMTP id DBFCEA001B for ; Tue, 25 Jun 2024 19:12:29 +0000 (UTC) Authentication-Results: imf15.hostedemail.com; dkim=pass header.d=oracle.com header.s=corp-2023-11-20 header.b=dnoxc4zH; dkim=pass header.d=oracle.onmicrosoft.com header.s=selector2-oracle-onmicrosoft-com header.b=C1dFjlNX; spf=pass (imf15.hostedemail.com: domain of liam.howlett@oracle.com designates 205.220.165.32 as permitted sender) smtp.mailfrom=liam.howlett@oracle.com; arc=pass ("microsoft.com:s=arcselector9901:i=1"); 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=1719342741; 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=bcNfRGlmtr+f6hLnJ3M5/LOiANFoVZKsDxZzPTfL0ks=; b=wtft33R8adgIZ3cd085XskjdsgJFsypf7RWqMbsJibe0W9bnCipjgzQEpt6YhAEL8F65S2 v27Xum3lf92jJoF5BKdcpvTh1s0sdHKRaebtkEvJoymUZEpBLB2TN4YxtjqrrMlFDlNJhR PKF1eUCDpuoiWTWjd3yUSNJ4WP1jwAI= ARC-Authentication-Results: i=2; imf15.hostedemail.com; dkim=pass header.d=oracle.com header.s=corp-2023-11-20 header.b=dnoxc4zH; dkim=pass header.d=oracle.onmicrosoft.com header.s=selector2-oracle-onmicrosoft-com header.b=C1dFjlNX; spf=pass (imf15.hostedemail.com: domain of liam.howlett@oracle.com designates 205.220.165.32 as permitted sender) smtp.mailfrom=liam.howlett@oracle.com; arc=pass ("microsoft.com:s=arcselector9901:i=1"); dmarc=pass (policy=reject) header.from=oracle.com ARC-Seal: i=2; s=arc-20220608; d=hostedemail.com; t=1719342741; a=rsa-sha256; cv=pass; b=31t6YAVzegZXPU6Igk3V/5J9OCc2LbLqZ5Lyh+p/4q+IJE1ejuDBroXj/kLF+sn/KBebXB Ojf8WIVjzrZvSsemz5mtL5VXcWHefBWN+fc21meFRFsWVjSnybyHGNT03XoNjhhSySCNPo rac90p/rKEIMB9O5hiuY/CaGmyuO3QE= Received: from pps.filterd (m0246627.ppops.net [127.0.0.1]) by mx0b-00069f02.pphosted.com (8.18.1.2/8.18.1.2) with ESMTP id 45PIfWwm028638; Tue, 25 Jun 2024 19:12:24 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=bcNfRGlmtr+f6hLnJ3M5/LOiANFoVZKsDxZzPTfL0ks=; b= dnoxc4zHcudVBHWNhxkFCR5bG6VebdfJWLJOlMl8HT0RXHxmRkES5Y5B2uNB3FE3 Rey+9xpLwNQm+28ynJ4R2uyoV+ytNQy60SwJC33hxIjpsI/vEol96oCXNd+gyI8Z hQMwmElZSt+By/Ld4PIfYsODc1NsjpEjRDW9jChBXJKiaLrp6Ohgh7X3loMPZ0kR lT17zUn3I6LOb8y+tgJ1INpr3f6dwwYgEWMYDTCAPsqvjEUomIjBtEAMQbdj5pEb ricMYSDWMWUHVbcjDN/Pdsk1gWB7H2NNc+d7DPq71+3zoRhInyc5VcgzEQZFitey D67scj24nKg0NY1Vm3Y10Q== Received: from iadpaimrmta01.imrmtpd1.prodappiadaev1.oraclevcn.com (iadpaimrmta01.appoci.oracle.com [130.35.100.223]) by mx0b-00069f02.pphosted.com (PPS) with ESMTPS id 3ywn709j69-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Tue, 25 Jun 2024 19:12:23 +0000 (GMT) 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 45PJ2DjH023323; Tue, 25 Jun 2024 19:12:22 GMT Received: from nam04-dm6-obe.outbound.protection.outlook.com (mail-dm6nam04lp2041.outbound.protection.outlook.com [104.47.73.41]) by iadpaimrmta01.imrmtpd1.prodappiadaev1.oraclevcn.com (PPS) with ESMTPS id 3ywn2ehgg8-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Tue, 25 Jun 2024 19:12:22 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=ZT+w5GLUC4jmdp87VWsVBTDL0oLsXEz1AWEyoF2werffQ0A2dxuqZw4KZz/z93SeMsW48gl66Dx+KkOwQA6B7PaWEOPqvEkGCMr0sLKu9wRdmtwAZotwKA8ty4/hqL2eh1EHNGF2/XWFDvGAqNLLL4kAgvY4pL80I0gOlJhGAM8emFCFUFiT4HhlZ1WUEdTwTspVOgfVvdUVi4qpQtOEhkEcHldt99/LJuyWUr61fdTkiEIFJVHMRjJ5XgiOu3miclGrOK6ZlQiRK1B1d7s50xXXUeEzWqoBe2ZpIYizfE7GimKZGSluAb9KkJm7Q3FUMzBDETcr+byf22P0/pA4Gg== 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=bcNfRGlmtr+f6hLnJ3M5/LOiANFoVZKsDxZzPTfL0ks=; b=gwfnv86HPGWHCpVlP1Q2J8spL+6+5hgz1/mWBt1U9Fj412NdDZnq+CowH26pAwUjukrGytT6ZaCs9gdz8eX+ffKBSE4L4ePXOX1G7L3QedDmRLrhTJCqpjL/F7/vIxDjpCELqMM8GTrZG3uJng7Lse4egMSfQe7L5GH5p+RK3t1Ute8utW0pkfiagWc7euC1SLIiKf+JJs0/n9YEUq/VL2A+ECicSNU+ZE1GILPBngJ4OE7jTXUYtKHeqCLbixdDVuaDCjWoPC9bj4CLln2sdfVCVbWZyufWpD/OAX7IqNiXj8wH0XLGpgxTj54zaj85FRXfgG1Kz3cUnOpAIvPzoA== 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=bcNfRGlmtr+f6hLnJ3M5/LOiANFoVZKsDxZzPTfL0ks=; b=C1dFjlNXQUalLRsUiJICYvdOqkVRkJ3OvvvroJujp+yLji/VaXKaXQZY6OL0FurfDBiY+iNl/NLbyDBhqADqJoK6FkdmuLKwmrGymtJw/u6Fgn0EiJbWNNkd3O+/799BNNuwyzJ6BA1v656pRCcfjjhkqkXIjWMMRVyLaifR6RE= 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:20 +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:20 +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 14/15] mm/mmap: Use vms accounted pages in mmap_region() Date: Tue, 25 Jun 2024 15:11:44 -0400 Message-ID: <20240625191145.3382793-15-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: YT4PR01CA0247.CANPRD01.PROD.OUTLOOK.COM (2603:10b6:b01:10f::7) 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: 7d2c065a-2b4a-41b7-32f7-08dc954abca5 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: QwBwg5CBpuiKKUBOTNzE4BIM1YgcPTt/iA5kJ0/rHI0zHuEGN4aqFR9hCeH2uOFyzKeLAPsS9yJWfd1egeV8lYcVA6SeIoYGxQSbYKrt690ZKM3iFmNf1xnquS/9hLo+qiu2ZZDz1ythBELxursg0q+WAQfVVqkX7U7ifjn/DWzwqrgwiqokEdR4UBwtzkeiGJ+fA5JDCCJ+MYdLCJU9YgPXBCkLgUgMyU6fTEgogCOMOhiR8Cg2bqsSCy1w9fkF6cZoVbFEcqCKU5JddKoJJCMpZBh4IPSMVk6r15iyal/ruHL9ehgUGJv1SxY/ylipJh/zxRer9XQybD64IoOe+zbqhjn1JkVNBmkGPZFR64hfAIYcL3MaVGzoxKpJ1Nojp0ghmfNAJUu5vpnCsoKweJdCxuRMa1DG2eFAshjyzOmzNe+f8t1cUSQgdMkfVkISz++hljaLED1y6x8C63P65UAP2lz8L62RAjetP2WGyrp8O/sfeESFGRdntb5UbFvrmny+knOfvSiL7Re9lHKMSZsbJgCSu0IfbVSCZq2z7Ze7lfFTWonzAg5AE/Q+WyqVshMCZQfpzESzLGmK7fQM19z3iI2PE96G6tccbi7ycHB8Bcb1CvJ3juAhe/QSdVx3ovKV2KZGHuIR/m+wgBzsq8n07LL6m57xLUZ3A5IlO/n68ubyjsBCqVMYyLh493J3n/phgz6Qkc0ZXRNwKLGa5rO/5H+u62KO8TnoBvNoJ5mzpiqsufls9Q+MHiFk4sUJAUJgoCXS54U+64KECdQixPhatQOBMgevffqMiXA7dA1e+A/AaUanCpcQ+S1tofwQ655yHK0RRLJQ9XPcGs5aj5VK2C8UKBDnCvBU4NxqQlY+lrPT9gEtd2/+4v9iiDT+lIS/BDmGAlZbyu6qnPPIwpTWzwb4JEAkckKVHvMemeXA7QKfMF+bShFw+u+Wu+MSrunipNe7HebLxEN/p2w2AuiZtEuT83mHpvfhH3JgYVg1JO1pD9J74XQGy8gT2VAlDVhgoScj5j0jS2JTiLFIUkQPON1+0n7vliH4ezsnsV6bvuDKbLxqJZJitwb+p+BpTF/W7qsvNT1EKp9NdaKXZnIpFZWr5PHmBPnd9uFZEzmIg/ZckupTTFh2/tx0bXeWaU+lEDP6KKCNwxkJjrH+S/TGX+rdfqt5QUkIjYlnlWxCi1NW2/Xeme7UL8CYt0TQCDb4n6JmwI+rXAnNgD2s/0g6EMikD1ctg/DAEbrNMvvtxvXlbDaRZDXTxsq4F3Qt2Mzu+/CB6x5HK7L8wSdDBhfsbPFx+ckoRTKHaRMIH9z/0WUr0sQ3oxLBxOHyWmG4QQE0XP4rdKisGvGHqIUpNg== 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: rtVbDsdnyd2AJ+wJDUpG6lUpYvDUI1Y7BHFStNxSgURqIEPY1XQKk37ZaAU5dIwUyvckW9pDdo+83Kfe5DhutDb3uuhuI5UOJNx0UJKM6yLJsPe7MuByVuyqmYj0TY5Rl3/3NYnWucErXdoGKNDmuRepKIZbG5FQLBvLS2WGNNSwhVeWEW0jpeYdbKPHgm3TMk9u3moO7n+1laLor4S1myLy2AKTLKQ+4gEkl7nBKXUOflfoSHeff2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Pvmjwj/MDtxLoCOee5+uP4yPYKdzWVXTlk0X6DN3D7Gnb9fLnl1+DnK/DA8iynSaVPDgGOFMM2fWNtDSGIqSeP+ydKZamuzlYK37l6vUQW9wlispR44Kr6qA2CiDbfo0/teu4Lla9ofDakDq7CL0QzI34v8jNfP1pasZMeljx9DuX0EaLOSA1YWGaY5e5oJfIQ1i4fuoVO3h2GkxctcIq9b3aXi47Sg6wP/nJKCS1AbcjVI97HvWSgpq6gWKghrpiJe56SuOwUAiBNBFz6LAXnEF/Kz1qEEIDbPZiSh/b6h0u91CsA== X-MS-Exchange-AntiSpam-ExternalHop-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-ExternalHop-MessageData-0: YHCCUwYNiWJHRHh6+Ma/S3nEGSmTgeBmabyYNRS6Ki16ue4cbgkrltz7tn9byUdcHJCa8bBTFdRWz5LFHgbdfy3YJgH7YZE5N64eoSon//tITDzFw+x1rxmPoTOcPfKyae0ZvTyesDf2uZMUy3xuwLXW9lgEyBUr2L/IWl6XLAR/J+jupNOWepHEZDJtiVjNakS+yn5UHYzoFIQ8ryoGs9ERXvjcvQwLLdcmkBlr5S0QR9fBrcoQu50KuBiaaHx32ixWps/JNq7aNCelzW/vHUcqaWM7sL7kILiUZ98Shq0M8IdlcIrMgUVCJCMRhd3Pc18Bg58RDLAmL0f3Fyhy0L0l9MOQWP7mtRzJEpV0ZqvLAnZk/GB8XrkOOh8kTD8l2Rc+lYf/FNPSd/CbefGLaY3jXUDdWriM4PoYJ2oT3m05yOTcGAKnOfF7HbTNxywIAgQaGn1B0uGnk2ZP2lXjvnkEw3/oDRJlq+5p5cGp1uWCetHMoEWHfwXM0xFyfPwh39ea84TtpGECQSEnUnD+XUorERjlEKp0h1r6zzEydZLcdFNEmu7OfQlcx66mHnvzxwDrCvrOdVKB3tGEmNR4PWeJDH0Awv9aIgbiEN9D4j8= X-OriginatorOrg: oracle.com X-MS-Exchange-CrossTenant-Network-Message-Id: 7d2c065a-2b4a-41b7-32f7-08dc954abca5 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:20.5828 (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: oueB3we2m3KyNEp3ab7TkLBKT4ADGKcWIUTfv8aw6nwTNlGwebJvqSR3/l+I6QN2arilIz9QjkHTdbxiiUfhyA== 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 spamscore=0 bulkscore=0 suspectscore=0 phishscore=0 adultscore=0 malwarescore=0 mlxscore=0 mlxlogscore=999 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2406180000 definitions=main-2406250141 X-Proofpoint-ORIG-GUID: lLNtQOmyY7pePJyxxQzDEaY02vMZxRVE X-Proofpoint-GUID: lLNtQOmyY7pePJyxxQzDEaY02vMZxRVE X-Rspamd-Server: rspam11 X-Rspamd-Queue-Id: DBFCEA001B X-Stat-Signature: wst9wbkkzpfge6teupnoi96sr6huqoya X-Rspam-User: X-HE-Tag: 1719342749-486611 X-HE-Meta: U2FsdGVkX1/t5SQx5Kdum3Zaj4iwCmxJiVypsl3yRUKFxpRC4NhY77znqjjYZusQgt5zwIiE9MpQSUgveCBOUd8wz4d4gUci2LIngDm2jhqYee7m71JJzaoj4u5vNx9wxVBWqj5Vyr7LRbOnCjqXjx6uKzGrA/35kgHUJg6WeuLIfECQU3oNqEVmpabjV8elfijb9U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vE/q6uUCgpph1K17nRB4Ybn6r2zpU9pgkY7tJL37za2OU39QLE9SRZAF0NTER0LJAWrU+nUtCnoZxW09CzNKX9zOsMATsXQI69vlPvKhq2TDgR93LSPafGqEIkZ3SLeqIbs4JnkcklqdsxLb26TWhigVu03D3FIMJWyyuRJF1qGU/9ranZ5VrS2+KyCXgj5iqJgaImey8Io6b44FV4GDROWF5KOLmySFOg0EuW1xE0shtxY8O9Rw== 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" Change from nr_pages variable to vms.nr_accounted for the charged pages calculation. This is necessary for a future patch. This also avoids checking security_vm_enough_memory_mm() if the amount of memory won't change. Signed-off-by: Liam R. Howlett Cc: Kees Cook Reviewed-by: Kees Cook --- mm/mmap.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/mm/mmap.c b/mm/mmap.c index f3edabf83975..adb0bb5ea344 100644 --- a/mm/mmap.c +++ b/mm/mmap.c @@ -2970,6 +2970,7 @@ unsigned long mmap_region(struct file *file, unsigned long addr, } else { /* Minimal setup of vms */ vms.nr_pages = 0; + vms.nr_accounted = 0; next = vma_next(&vmi); prev = vma_prev(&vmi); if (prev) @@ -2981,9 +2982,10 @@ unsigned long mmap_region(struct file *file, unsigned long addr, */ if (accountable_mapping(file, vm_flags)) { charged = pglen; - charged -= nr_accounted; - if (security_vm_enough_memory_mm(mm, charged)) + charged -= vms.nr_accounted; + if (charged && security_vm_enough_memory_mm(mm, charged)) goto abort_munmap; + vms.nr_accounted = 0; vm_flags |= VM_ACCOUNT; }