From patchwork Tue Feb 15 14:43:14 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Liam R. Howlett" X-Patchwork-Id: 12747171 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 9595CC433EF for ; Tue, 15 Feb 2022 14:44:02 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id E71596B009C; Tue, 15 Feb 2022 09:43:59 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id D82466B009D; Tue, 15 Feb 2022 09:43:59 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id BD4136B009E; Tue, 15 Feb 2022 09:43:59 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0042.hostedemail.com [216.40.44.42]) by kanga.kvack.org (Postfix) with ESMTP id AE0386B009C for ; Tue, 15 Feb 2022 09:43:59 -0500 (EST) Received: from smtpin06.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay02.hostedemail.com (Postfix) with ESMTP id 71CD285D4E for ; Tue, 15 Feb 2022 14:43:59 +0000 (UTC) X-FDA: 79145283798.06.10D4562 Received: from mx0b-00069f02.pphosted.com (mx0b-00069f02.pphosted.com [205.220.177.32]) by imf29.hostedemail.com (Postfix) with ESMTP id C5581120005 for ; Tue, 15 Feb 2022 14:43:58 +0000 (UTC) Received: from pps.filterd (m0246631.ppops.net [127.0.0.1]) by mx0b-00069f02.pphosted.com (8.16.1.2/8.16.1.2) with SMTP id 21FEhvWi022181; Tue, 15 Feb 2022 14:43:58 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oracle.com; h=from : to : subject : date : message-id : references : in-reply-to : content-type : content-transfer-encoding : mime-version; s=corp-2021-07-09; bh=KlqGb/2gZGefgjedBtlFVgbW8qoxehagNGkNmpiTOns=; b=euEHGqOMnrXr7p6uMqGTpsHcd795+6OYSNEZHYaFM+ORGT1hTIIfzA46bP4QZ4uv1DQx Tey2hXZTF8xAF1M5IBUsdSFkQg4dOpM4skd/vxHfx/sRUd3FmlD8/0r9SE0MdOesuURL mk2K/Niv//qfZL/vb9SxpBg2u9qsC0NP8wTm7BoQ06eYdvV/TnohAAiN1HTnMNL6eNtt egi9BUbGY8njvgjproAeWa+NL5mgm01m64Rx4B8N6N0kpCjz+Fu6GL511FpJSiJghQaI v0Q4yUoxUEcSHEVcOhbno8o4l0Ko8kAfFplBqCYCrKRHPbl2nhS+1m9hX2VWyej3zRkL Gg== Received: from aserp3030.oracle.com (aserp3030.oracle.com [141.146.126.71]) by mx0b-00069f02.pphosted.com with ESMTP id 3e884r97h1-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Tue, 15 Feb 2022 14:43:57 +0000 Received: from pps.filterd (aserp3030.oracle.com [127.0.0.1]) by aserp3030.oracle.com (8.16.1.2/8.16.1.2) with SMTP id 21FEeT4A145723; Tue, 15 Feb 2022 14:43:52 GMT Received: from nam04-bn8-obe.outbound.protection.outlook.com (mail-bn8nam08lp2042.outbound.protection.outlook.com [104.47.74.42]) by aserp3030.oracle.com with ESMTP id 3e62xeqfex-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Tue, 15 Feb 2022 14:43:52 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=Qio+2OpF5NTK4ytflIRsBkFRd/QI8ruTO/fD7tvXPAwpnw7CI2uPK4Y87SrIu6aHlTRpIZvOsiO/BHVDbg+T4hxPbfHJwNdeDEspIsDHC/4ohSX7ehCo3kNewkiZZfpOM3AvVZ+XjTtG4Ha6v0dQuzOoajZusPpoToApO7RBD1L4szuoGU7AT6sNESYaOTAJxjfzCXoSPJApZumvrQByVlzzU8/kLc5XpEc3iWJQ+wHFJ0QeotvTbbB7COKcx5Ab4vIScT3GH5n5DtZRhdU66jKxDEpsiNeHKbm8Ifppq8jR1S6OUQ6/V6aSaGozbqmZjETA+/STx2hR3YkBDDxB6w== 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=KlqGb/2gZGefgjedBtlFVgbW8qoxehagNGkNmpiTOns=; b=GQrArBDphFrNJ+l1M6VrLoCxZ184YPIYm5n7Z3Nkew/BZapryM3Hv339rY6Y92T0Pa/I1i9XcbMffcYdmmaOs681X9YiJ0oUHKMyR5VFucfzDxdsaAD7T1ImlsuWIoH4DfCRpp4E+qtcVhsrPxIqxLPFqGJZ2kuZnfczFKe0rN/l0RC90Q/PWuCoOCJqamjTSsVwZd0lXXN8mwfeHrqm4uV0rDmMp22+zx5uojxHhiL+FMl/8FvndEgEsMJ6fpHs2bsu1yZzD6wWi52MwSzh0z42UnwTX7+w74SyC4Xe3Hiv0PuLw+D0IB3wo+Lfs7MViJlFTJKY/jz3QM8OuNto3g== 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=KlqGb/2gZGefgjedBtlFVgbW8qoxehagNGkNmpiTOns=; b=rHC+dVUiez6g4B7rRG6FxEa0uxs9P0F2BaIu1U7jekpNfM88UdnTLC34qWomXn7IerktV6sKmWJ5G2BOTP6nY8tmxfsAtOOF8cFI8Rmiuq1S3fcuRT/RABnYhvUQFMJaCHhxYUN6NMnHKkCrit72/L93znHDaCH9WUlH+HbwPM0= Received: from SN6PR10MB3022.namprd10.prod.outlook.com (2603:10b6:805:d8::25) by PH0PR10MB5578.namprd10.prod.outlook.com (2603:10b6:510:f1::16) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4995.14; Tue, 15 Feb 2022 14:43:50 +0000 Received: from SN6PR10MB3022.namprd10.prod.outlook.com ([fe80::899e:951a:8129:8ef1]) by SN6PR10MB3022.namprd10.prod.outlook.com ([fe80::899e:951a:8129:8ef1%4]) with mapi id 15.20.4975.019; Tue, 15 Feb 2022 14:43:50 +0000 From: Liam Howlett To: "maple-tree@lists.infradead.org" , "linux-mm@kvack.org" , "linux-kernel@vger.kernel.org" , Andrew Morton Subject: [PATCH v6 31/71] mm/mmap: Change do_brk_munmap() to use do_mas_align_munmap() Thread-Topic: [PATCH v6 31/71] mm/mmap: Change do_brk_munmap() to use do_mas_align_munmap() Thread-Index: AQHYInpcxqTO7xqB502HGR4hKcEz7g== Date: Tue, 15 Feb 2022 14:43:14 +0000 Message-ID: <20220215144241.3812052-31-Liam.Howlett@oracle.com> References: <20220215143728.3810954-1-Liam.Howlett@oracle.com> <20220215144241.3812052-1-Liam.Howlett@oracle.com> In-Reply-To: <20220215144241.3812052-1-Liam.Howlett@oracle.com> Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-mailer: git-send-email 2.34.1 x-ms-publictraffictype: Email x-ms-office365-filtering-correlation-id: f6ce1d7e-cb85-4d58-8347-08d9f09194c2 x-ms-traffictypediagnostic: PH0PR10MB5578:EE_ x-microsoft-antispam-prvs: x-ms-oob-tlc-oobclassifiers: OLM:2331; x-ms-exchange-senderadcheck: 1 x-ms-exchange-antispam-relay: 0 x-microsoft-antispam: BCL:0; x-microsoft-antispam-message-info: vqlxtwl7l8LJRz3dp4UqpXO4UO6htQR0XttTwpx8i+7n1XNxV0Jvtp6gc6anFU/1MIXgblaHIz85tl27ssA6VQpMdM6wyKwMBv6ISfolvFUaylD5yKDMdkmlThjI0Ho4f9qZTTP2JIgW/FP6SfxjNPmZHt0Jmjkre0fJcX5lVfMFTxpWDOGuRzKs8hYp/903tsQqLyGzx0AC6Jb6ewDcD4AGhl0fs07xRaL8/Gg7tBFaQyv7isyOZUI5LNSBS1rj5oFXuv+0BE0s9ef+aVqdh4Oih2VeZO8fzpQOWWSruo2piGqFD3zBcAWgqo77CArOdLsWHeLm3aaG5+Yh+4iycSlkiu/nIOt5bkcziYaGqGW1NVBe/Jkoi0Ic+e8B+O0X1olkqzmUl+n7BDaQAiJnmPatpliClrGh+77BNZoWpNoDBsXYWrz3uS+esbgnTjcECSZLBuERzLbsqFo7kPO9HaZEyYit0DPOvjZ2/B2+7HNiBW2h0Z9//2TRBPqv1JIpFAvYXXc7XBg5kQ+N8zGMHPmLrg2apXMHOCoECrOt/mR0oYMj7DYoKh84QIQrEJjuJZwqxLj+teVOipyP7jkMsqmfEM0Ud4vMPXxetD2yU1t0ZFDWUUx6DoFxLsUcsuBoQAtLv4zxotuCAqHS9Vt6ZSJndhGmhVR0kjLwrO3QhhEvbHxAklRy5drUXvKA4pEY3x4xQPKkccbAuySB3sA0Yw== x-forefront-antispam-report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:SN6PR10MB3022.namprd10.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230001)(366004)(316002)(2906002)(6486002)(83380400001)(38100700002)(110136005)(508600001)(91956017)(64756008)(66556008)(66476007)(66446008)(5660300002)(66946007)(76116006)(8676002)(71200400001)(38070700005)(44832011)(86362001)(2616005)(1076003)(122000001)(6506007)(4744005)(186003)(6666004)(6512007)(26005)(8936002)(36756003);DIR:OUT;SFP:1101; x-ms-exchange-antispam-messagedata-chunkcount: 1 x-ms-ex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lfzXYt0187ws7pUgqGGxwvniQayQCqjyL5SqJf4Xe+?= =?iso-8859-1?q?9YHhn7OerRuEkuxdftCRZgX2yTf+dakND3hPVEyr54fhyFENQSlhfcAIsOm1?= =?iso-8859-1?q?Au/nSgTqvr5nZhMHP5mcrs4qpQGOZufjeoPnn80tOkckTvxiZGGAYepitPE2?= =?iso-8859-1?q?YeP1oXhe8ey5pBiHClwLcqeNI1+2TF1BvtstV83wYkU/DING+5Spd7yA4gcV?= =?iso-8859-1?q?lFMarUJal0vIq9cj/qAtjZiqiaxxCsaw5EfltpzC6YKJKDGrdOuBwd3bc3dV?= =?iso-8859-1?q?RBOHgVmQD3rlLyj9JKZhgtVTx8Ugj4bCdrVVtja5MzaLEi/TzpvPzyk3joB5?= =?iso-8859-1?q?AYER5r1tPwxgLtvqST6B2Sv2BU4eNVFtvSa8iwSs8aYh9rvXsawmbRZ0pcow?= =?iso-8859-1?q?GNerzrDnXlePW/Y+9RufiJFMOgmJbd5wmgCErYMoRcSOklWCk5Kezk4idmIc?= =?iso-8859-1?q?4etiZAcilRoch/1+qlj1I1TfYBAttX3CicI4ygaqxpvzsTA6J8iB729TzvIF?= =?iso-8859-1?q?G3/sIR3CLvHjewW94Maf/bkeeWgBrIGvcCutcgak1hUTRYTtIEF0NONJfnxo?= =?iso-8859-1?q?cQRQk5AcDF9Osrxp6mt575NxPZYNFX7Q/lcsMLNfYXmi4gDJact/F4HtB+Db?= =?iso-8859-1?q?XfjEAlzmnWh2k53SLGcKDbcS8IaokIDFHFZQoWtK9D1ot47lPrpFD08JLnh9?= =?iso-8859-1?q?H0xhmwWUJrvp+7gCTqpN9U/NIxF4YTVGO6WWv9oz+Vj8MdDu/R8+xds0grfB?= =?iso-8859-1?q?kBfp0VEVZXHH98enLGhsrEukQbG5siRN4rYC/mt6aLnpDBVgl+1Lo6xRd3v8?= =?iso-8859-1?q?=3D?= MIME-Version: 1.0 X-OriginatorOrg: oracle.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-AuthSource: SN6PR10MB3022.namprd10.prod.outlook.com X-MS-Exchange-CrossTenant-Network-Message-Id: f6ce1d7e-cb85-4d58-8347-08d9f09194c2 X-MS-Exchange-CrossTenant-originalarrivaltime: 15 Feb 2022 14:43:14.4328 (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: FM3973+1ibw2KWgJLtO1h2tr5wTQVUUctitNddohjr+x4sHj4kp9ol/ENGj6L2UFwe/SNfvNl5KC0mQy7Zltxw== X-MS-Exchange-Transport-CrossTenantHeadersStamped: PH0PR10MB5578 X-Proofpoint-Virus-Version: vendor=nai engine=6300 definitions=10258 signatures=673431 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 suspectscore=0 phishscore=0 bulkscore=0 malwarescore=0 adultscore=0 spamscore=0 mlxlogscore=999 mlxscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2201110000 definitions=main-2202150085 X-Proofpoint-GUID: 5n5fbcpxizQjhqmNpg931UCxC9NvNQ4u X-Proofpoint-ORIG-GUID: 5n5fbcpxizQjhqmNpg931UCxC9NvNQ4u X-Rspamd-Queue-Id: C5581120005 X-Rspam-User: Authentication-Results: imf29.hostedemail.com; dkim=pass header.d=oracle.com header.s=corp-2021-07-09 header.b=euEHGqOM; dkim=pass header.d=oracle.onmicrosoft.com header.s=selector2-oracle-onmicrosoft-com header.b=rHC+dVUi; spf=none (imf29.hostedemail.com: domain of liam.howlett@oracle.com has no SPF policy when checking 205.220.177.32) smtp.mailfrom=liam.howlett@oracle.com; dmarc=pass (policy=none) header.from=oracle.com X-Stat-Signature: py8ck6dw96u5f1ar5um1pbokqmphmrer X-Rspamd-Server: rspam03 X-HE-Tag: 1644936238-411118 X-Bogosity: Ham, tests=bogofilter, spamicity=0.000075, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: From: "Liam R. Howlett" do_brk_munmap() has already aligned the address and has a maple tree state to be used. Use the new do_mas_align_munmap() to avoid unnecessary alignment and error checks. Signed-off-by: Liam R. Howlett --- mm/mmap.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/mm/mmap.c b/mm/mmap.c index e321ad27baf1..ae2b67296a06 100644 --- a/mm/mmap.c +++ b/mm/mmap.c @@ -2975,14 +2975,15 @@ static int do_brk_munmap(struct ma_state *mas, struct vm_area_struct *vma, struct mm_struct *mm = vma->vm_mm; struct vm_area_struct unmap; unsigned long unmap_pages; - int ret = 1; + int ret; arch_unmap(mm, newbrk, oldbrk); if (likely((vma->vm_end < oldbrk) || ((vma->vm_start == newbrk) && (vma->vm_end == oldbrk)))) { /* remove entire mapping(s) */ - ret = do_mas_munmap(mas, mm, newbrk, oldbrk-newbrk, uf, true); + ret = do_mas_align_munmap(mas, vma, mm, newbrk, oldbrk, uf, + true); goto munmap_full_vma; }