Message ID | 20221129164352.3374638-33-Liam.Howlett@oracle.com |
---|---|
State | New |
Headers |
Return-Path: <linux-kernel-owner@vger.kernel.org> Delivered-To: ouuuleilei@gmail.com Received: by 2002:adf:f944:0:0:0:0:0 with SMTP id q4csp453799wrr; Tue, 29 Nov 2022 08:56:28 -0800 (PST) X-Google-Smtp-Source: AA0mqf4KtugckGgV+96nsG/B//dcAMRvz9mwtAWIFrGFKrU1H9rLaCrY6qmAENaaovOs9QFZkSuv X-Received: by 2002:a17:906:810:b0:7ad:d7f9:1f96 with SMTP id e16-20020a170906081000b007add7f91f96mr32712832ejd.384.1669740987841; Tue, 29 Nov 2022 08:56:27 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1669740987; cv=pass; d=google.com; s=arc-20160816; b=JDS11AsZx8YHiued9vctKwMStwNew6bFGXXVSVyzbBlMO1blS0juKpLcEtyouLDss4 cmy3md9UtqscYl5qikaUEzgLr324lkO4epKqFulA4EGJiA28gHgXoj0naeDqpW+zdzzN JKgCyKVWKfM4IVpAB2wDEomu611sFUIoDxmkg5Y0A8o8bVIjFlQG0KuodsKLOopQalBS eN4m4NpmcXh50DTUHty41l55ppBIH46A+K+/KtQt9JaHqcpivrLUTwvqhA5YSgBiCvXf hZrb6g3ccgyIF2SSXXEOHRlU0DBbW6loPt2uihvIy9x2amqra/V51+pllxPebqe0t6nR Kgzw== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:mime-version:content-transfer-encoding :content-language:accept-language:in-reply-to:references:message-id :date:thread-index:thread-topic:subject:cc:to:from:dkim-signature :dkim-signature; bh=XGmyq3cB/rLlWYlRNysOM7VIOIrvlGoPMWL5Np8VGjE=; b=fSs3D/GBH/VodXvHUu/nr54PED4cHaQ3v5CkjacD3g9oKJELLOl7kjkSvlmvtbjF7J UDc0YjbaTv8DwPg7uQWX7QMOQo2Gw/xxSc8rrnL/WoiB8cE2pp3x7UWCaXtOf6lNQq9b IpkKMgMMS0/y9sZkqsblpmv1+PY7tyqpKwFAgIRAh183MIQHgFORLsO7JjQP079rb8yP KexnjobdP1SgXXWXLtfyI4xIisUEg2WNI+nHd6U07MLCPZ7dL8auNcCTRl0VnC3OtZsh iIYD8wqO3JcHl9maJlQ9CQCz4f36pqv9uj4C8IRew7Z7zpdBSOHnJLtYaDGv503sCadC t4YA== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@oracle.com header.s=corp-2022-7-12 header.b=Uv3z7awa; dkim=pass header.i=@oracle.onmicrosoft.com header.s=selector2-oracle-onmicrosoft-com header.b=pGJo9oRU; arc=pass (i=1 spf=pass spfdomain=oracle.com dkim=pass dkdomain=oracle.com dmarc=pass fromdomain=oracle.com); spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=oracle.com Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id ne3-20020a1709077b8300b007ad6a0afbc6si13013684ejc.7.2022.11.29.08.56.04; Tue, 29 Nov 2022 08:56:27 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@oracle.com header.s=corp-2022-7-12 header.b=Uv3z7awa; dkim=pass header.i=@oracle.onmicrosoft.com header.s=selector2-oracle-onmicrosoft-com header.b=pGJo9oRU; arc=pass (i=1 spf=pass spfdomain=oracle.com dkim=pass dkdomain=oracle.com dmarc=pass fromdomain=oracle.com); spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=oracle.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S236361AbiK2QsS (ORCPT <rfc822;rbbytesnap@gmail.com> + 99 others); Tue, 29 Nov 2022 11:48:18 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:42238 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S236226AbiK2QrW (ORCPT <rfc822;linux-kernel@vger.kernel.org>); Tue, 29 Nov 2022 11:47:22 -0500 Received: from mx0b-00069f02.pphosted.com (mx0b-00069f02.pphosted.com [205.220.177.32]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id EBDF26C73C for <linux-kernel@vger.kernel.org>; Tue, 29 Nov 2022 08:45:22 -0800 (PST) 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 2ATGOeuf005604; Tue, 29 Nov 2022 16:45:11 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oracle.com; h=from : to : cc : subject : date : message-id : references : in-reply-to : content-type : content-transfer-encoding : mime-version; s=corp-2022-7-12; bh=XGmyq3cB/rLlWYlRNysOM7VIOIrvlGoPMWL5Np8VGjE=; b=Uv3z7awaUEQv+2NTZXNcxjDOyrbi6zwI8HgOjJNOkn0wCJM0SxlZqmg3L7uFMFS1KPTQ AHb6hiPKU5sNBK7TrviQ+ee1uuX6YD2bTMcBFMtUHJldMsElUY5TvVilpa9iR4bIm6eZ 2wKi+KNdjIVeUM39AlLbgvgDqv3bTF6L0fFBCjQkCYGa2H2zYq130fLkmxXL5jTj7Bd1 FBSDoeRKKTl4N2i0Bed3uh6pGQK1QJRhgY90UwJwsCfalhq5MYjAYr86V5q084Hy5i0p pEScVsIDGsqf9xuUS/yyBlPWaTwhRyAAYvIeVNjyGqvNf1FtdqcD519Iv4UK/fKo6eJe RQ== Received: from iadpaimrmta02.imrmtpd1.prodappiadaev1.oraclevcn.com (iadpaimrmta02.appoci.oracle.com [147.154.18.20]) by mx0b-00069f02.pphosted.com (PPS) with ESMTPS id 3m39k2qfcn-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Tue, 29 Nov 2022 16:45:10 +0000 Received: from pps.filterd (iadpaimrmta02.imrmtpd1.prodappiadaev1.oraclevcn.com [127.0.0.1]) by iadpaimrmta02.imrmtpd1.prodappiadaev1.oraclevcn.com (8.17.1.5/8.17.1.5) with ESMTP id 2ATFkaTx026698; Tue, 29 Nov 2022 16:45:10 GMT Received: from nam12-mw2-obe.outbound.protection.outlook.com (mail-mw2nam12lp2040.outbound.protection.outlook.com [104.47.66.40]) by iadpaimrmta02.imrmtpd1.prodappiadaev1.oraclevcn.com (PPS) with ESMTPS id 3m3c1vkkp0-3 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Tue, 29 Nov 2022 16:45:09 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=iuXQLIbWupqVyaR/7Q4EFgXnqleQ/a+tQDraGp3FkagldRaFBD2DraRIXfDJXUz2NbpJp47DHKDd5q/EOw//vORh7aii8dMjIizkCiVZjQoxOabZL4qkcGe6cWOIgfm0x9bgNiYSd1icE+kwurNokDrJHfua3jSZ4AHV5YVDS+PmprhX9eOoyGSdTz3eUehYaEgpxGLP+6F+rvrH1lnOliTIu4rK4r9h7T+0ZYNjCCQjWhcUGKeTBDNRVbAljhq0TnNMHcaI5YNwL093osk2eU8sAmUTpAkaH7YfLOdiY/EgfJxNnvQg5aDympMElxbEj0wFJYW/rwJMPFoQF+YUzA== 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=XGmyq3cB/rLlWYlRNysOM7VIOIrvlGoPMWL5Np8VGjE=; b=mRXxIsCORvOcAyJKYRf08lYwqS8+aKAw/phezbcwzPJvtrgI55KY5Eoo9Vr97qicsG3B9ofB7/gQtOies1avOuIQVVxh829LWebVRAxnUEcQnkJ/GS5H0w/Ml9yr9IWTMtBH6q7cw5J1oYL5nHSJ2SIAdLBXe517gQGR/j4hNa0dW2k4ZaNN2ApLS9T8CxXjOPMWoJhgdYgDuHcwKXeal5ifbD4ghzzt/xaNkNTxQKr75lZNOk2cV+OAVZHUGkhDDMwvcqqo1IA/DjCkKdsFRvuZpEXd5yza3vabfa7M8vBIIfyDhoyTSJGrV65qQcCGtxmX8uKljl3zBQx/3XRkag== 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=XGmyq3cB/rLlWYlRNysOM7VIOIrvlGoPMWL5Np8VGjE=; b=pGJo9oRUzKkvZSWQMpKr8fZ/WTHi39mONblzEo6UiecSrVc1ghBDz1hJ9mk1MGPWn2wT4UGxpj5F9QLVMTpm+MzAsNt2riPdVEYZQEmkrRPXDE+9ynnPcKJR0o5P8mW+KZkUpasfyNFt1bxy/EI0k2/xWLJ0uw6ayJcPolOTySI= Received: from SN6PR10MB3022.namprd10.prod.outlook.com (2603:10b6:805:d8::25) by PH0PR10MB4792.namprd10.prod.outlook.com (2603:10b6:510:3d::15) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5857.23; Tue, 29 Nov 2022 16:45:08 +0000 Received: from SN6PR10MB3022.namprd10.prod.outlook.com ([fe80::a02:2ac8:ee3e:682]) by SN6PR10MB3022.namprd10.prod.outlook.com ([fe80::a02:2ac8:ee3e:682%4]) with mapi id 15.20.5857.022; Tue, 29 Nov 2022 16:45:08 +0000 From: Liam Howlett <liam.howlett@oracle.com> To: "maple-tree@lists.infradead.org" <maple-tree@lists.infradead.org>, "linux-mm@kvack.org" <linux-mm@kvack.org>, "linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>, Andrew Morton <akpm@linux-foundation.org> CC: Liam Howlett <liam.howlett@oracle.com>, Li Zetao <lizetao1@huawei.com>, Liam Howlett <liam.howlett@oracle.com> Subject: [PATCH 32/43] mmap: Clean up mmap_region() unrolling Thread-Topic: [PATCH 32/43] mmap: Clean up mmap_region() unrolling Thread-Index: AQHZBBHcwoih5czY/UCS4h9Cleh56w== Date: Tue, 29 Nov 2022 16:44:34 +0000 Message-ID: <20221129164352.3374638-33-Liam.Howlett@oracle.com> References: <20221129164352.3374638-1-Liam.Howlett@oracle.com> In-Reply-To: <20221129164352.3374638-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.35.1 x-ms-publictraffictype: Email x-ms-traffictypediagnostic: SN6PR10MB3022:EE_|PH0PR10MB4792:EE_ x-ms-office365-filtering-correlation-id: 64dabe37-894d-42f4-cc5a-08dad229130e x-ms-exchange-senderadcheck: 1 x-ms-exchange-antispam-relay: 0 x-microsoft-antispam: BCL:0; x-microsoft-antispam-message-info: 9JXqyakU7fFFabESP1BhDPfaP9L0GMFERNbKdCvKieR5VWFmILpQ7ZtjQW+4jN7Lf4PugjqSxLP3OmYNzBOtioEXT66/5PYnJpd0RZUWVmu3pekWuwwfIyeAGGdbZ4n59D5DOQXwWuvu1opqQ51LRlYPNXNzySi4nH1jCEHL+Yx+5La0V9WPiu2LqQ4Ny6uWAi6xoBpWdx+w1K5GK74edSNNu3Iw3anFugnvyJ1yLGWZDwayDL/d49jBDnoN8o6BeSDlZl5UkQDb7pjpCgAyBBbblk9LTq7n9ZK6c2h1jgNWOEKtNBnE7MPYjWyCkBS8gzZAPiifAjsxvlwu9WF4CZa5QGGgcZvlmE91nRyrH6kGrSejAiYskXOb/JZ6yNzzfYQvn2Xg5uQYN7ovrPbJLJBFTdNVqzNss/089u3GII+mfmqmJfH1ZEaGOPfvyvqupE19uHKO8y0lOFJnfWN66E7kG4oC0mhzUruyZA9vUhYAZDLMJEmq52SK0tnFIplTXmssDI6GiLmaYzsL/2AeuOuOkyYJynJ6tBrYBhe6kFrm3gDkLN4tZ4wkaigX+3uEEHz7HXYvjh6Z51rR5g8C3PskUksf2+gfbuh7lsyqMKOGrwQLfd2Y6e53e31P3v44ZjT0BW7FCXx5JCmT4BGu/npdyKlhqIq7i5OrKxfC4EK7jPuc+HV2I8qJbeLOBU7CwQamcBy7KwaJajqHRt//7g== 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:(13230022)(396003)(136003)(366004)(346002)(376002)(39860400002)(451199015)(38070700005)(2906002)(36756003)(86362001)(6666004)(6486002)(71200400001)(107886003)(478600001)(44832011)(41300700001)(316002)(76116006)(66556008)(66946007)(91956017)(5660300002)(66476007)(26005)(110136005)(66446008)(4326008)(54906003)(8936002)(8676002)(64756008)(6506007)(6512007)(186003)(122000001)(2616005)(38100700002)(1076003)(83380400001);DIR:OUT;SFP:1101; x-ms-exchange-antispam-messagedata-chunkcount: 1 x-ms-exchange-antispam-messagedata-0: =?iso-8859-1?q?usnnlj476qc2QXoxVGATX1h?= =?iso-8859-1?q?ipZgOtAQrzZqqeQIEW5K3fiVefYrgGbQ4gQ/rAQCmp/gcRVYJ4oE0jAPIysI?= =?iso-8859-1?q?mxvnF2LcS1y3/m7/t4ZnIInKBEY5VkQbTqMC/vaTxZ6wvoZIpdDPg8uN1Sd9?= =?iso-8859-1?q?hFTwPHxV0JS43VYPJ0aRHep4b1HN/P+xrmEZz8NXjkPkvfWrSI1cc7jOhax5?= =?iso-8859-1?q?oh8p0kbQb6JarQ2sWSR51fmc6U6g1arWLaOeBt6DOyjN3HROR+NEy5hUp/R4?= =?iso-8859-1?q?etGM3h+uHjjoe7N7jteRHkPxbAaAnqODAUb39i8KjVuV8Jl94HUsfiUhkwQo?= =?iso-8859-1?q?XmXIubu+yGZgN0DhMIqFIFDd2G3yhjkMKGSDWOAvLXMvrBNVOdmAiesGKWrn?= =?iso-8859-1?q?WlXeIMY++ihB0m6NCGekAJnV9oQ4O1DJG39pVvwHMuWUJtdVFERjucZHo5CF?= =?iso-8859-1?q?AVsPW1VeHQYDa4XFYwsuwhscX8XnwPj78M3vfM3kLgOsDyKNrKjT3UDBWjeN?= =?iso-8859-1?q?B4IypYAiExcFrrZUXBvlFNvR8GkerXHpZfujej4hZnOjjjZ7cYLJkOW5iarN?= =?iso-8859-1?q?Xos5rhBJXii8u3IY4R9ddAtMJ9rZvlQt/hV4X1cbgMdSLKRvcgV1ZIV7L8/X?= =?iso-8859-1?q?RIANHtK7F+bvYnZ9VHuMabA8rDTW2zyLyPg6Ugk03koyFEk6H1mZmlt3yK7L?= =?iso-8859-1?q?RO3EqaIprLGOS9N8+kZB05XinwSLqDiPIYy3FWFV9P3VEZGe+1DO+fWqcQWQ?= =?iso-8859-1?q?UgE0XuYv3CtpV5nQNMFhqikYYroiH3KtF5SDw6NB/RVvVQNuE5QFGth8Gx0y?= =?iso-8859-1?q?fZLqzydokQCixVXXoEHUhn0JHIQMrWRmjOQQYDCwRppMw1B3XLbhXMMfg+BV?= =?iso-8859-1?q?lWYQvNIqCrKrkuF0uGOd6aQshJvJtc4k86AfbsHnSiFgi8U4F9RFSAW7I6TJ?= =?iso-8859-1?q?8EsFeiwuMBlbelICxsp1TnJQveI20cD0nM/GzzbbXMwd+rBJJQgPOZi3Dz+E?= =?iso-8859-1?q?fwhXwsQX/eroH1BBkbdzko+89dfLpYz8HCpd1JvDOvDyQMT9jVPgcgOlTSGN?= =?iso-8859-1?q?9271vFLM2G8ILpOrb31moEvDkj3/024nadIjD46vhJmhQbuRAqPVmcn7nXTg?= =?iso-8859-1?q?1GcjGn29pB4WH79iPLCtU8NlFyoe766bPZSudJd+W2RaeICOyaCoDn+JAgz8?= =?iso-8859-1?q?/Xm92mMpFfCFs+FpYQnVCUj1IUsHd/CeOGtF2G5fkkq5p5MiO0193cacx02a?= =?iso-8859-1?q?KpX6Ek8J+CvIsHXLasWW46RYcU0/1nh59aYYP/wklsR2Xn7mruvqvpEfWLVF?= =?iso-8859-1?q?hHn8jlqxDwrmL/QFzD82O+f2P999HMqgCiXeIT7OOgIn9erLc1FSTTsML+t7?= =?iso-8859-1?q?QmSf1aW06cVFCOQAo9+hVK88lNBslGr8EGGu/dXXMd/wKgNJ1BN9Gcz16cIS?= =?iso-8859-1?q?1mfcHMQytQiOW3/16qjZi5dsvjUkyEdIGtZCr1MTZtFOYKFJd+7adokE6dEp?= =?iso-8859-1?q?MMQvsnboejHtOmh7L44SPg2qddZxd9kBB9xMfD1Kd056hk2Ya6nPPwjOI6/x?= =?iso-8859-1?q?mHXZofgKLp4Fy9EN/l2vyXTfjKKiF0m5OM2DCf4Bz7+GATx4IH5RtUC98+cT?= =?iso-8859-1?q?OnXVoqSTyCLH6KtwnLJaTOKak2zLgKOiCuHwdBw=3D=3D?= Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 X-MS-Exchange-AntiSpam-ExternalHop-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-ExternalHop-MessageData-0: kUUiTvEheQ3j7M0bbE5edT4AYGkVUQAjDXHLgexS74igO0WAh9cbtxHacssXpoynGgoADCY62WbeEXe5CLQIOOaacTlxtY5hZcUIDbqXB6vzCqm3q6o2AjEVLUfd4nG4RcA+vtbfmjFLaXAWb0rWc8hoKcTYN4UcDoS3y90KvfYLK+5X0+ZJ8jl7WAzfjBmk9mtped7JjTolMrOYLSenXvAqUN++goesnNhVIt7X5ME9nzhfuNQQhokl2oZaIWLK7o5k6OnpkiezI75VzHKSRuw1CBeLHrbhc5yalNsT4ofA6DhxCd+Pa5gilxpOu7zcAG9A2WJ8b+YljQHqY9uk9kF6XlM9+wojELRISTugXmBsxB/eBfuuyqasBhPBTAwLwodH+qOO54T83ukL+4qPhvE8W32ABTL1hPWSLnvqxy6nbztjjhDQvkzeMl4iA/8+KQsoV5tWnJSLrsBCguVeB3UarwkGdL5STzbd0QEapF7MvLIM6/mnHfQJqGHK6B2oHogH76t4IK7Q1BuuTD9Lb2FKDkJNW0ZL9aCfpBB3EnU/L4GflKtle6DMjF2yz0LzzKjKOpXJwKy2ITC0ENsIvRgg9pYk7Qo3E71KLHo5NWS+01nDhvACUKzJVKjnxmfKyiApENaXlH1wQjPwEQHCuneZpofWUvLbNIdfBNfCYDFGoFUITVLZZfbzfHx75heRKlZfaifw6WMWeA4xb+KPxv8GIY/wCe3DUb8g5FEFvdCvnfnamv4497K3noZYDICwQawI1UPgATfDxAMWKowsd9SfAEbnn/tTl48gNKCnu37sFQa/PHYkK2rBuDP0YrJLf9nfw+aB0SIe3E7bi2ywShitsgOqZITnmmbwg/dpxnnYBojGws6RENHkMpUIxxymtSPMqkKFKAsheqhIpu3omXLhdTEAf3LMKWq6bDPoewg= 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: 64dabe37-894d-42f4-cc5a-08dad229130e X-MS-Exchange-CrossTenant-originalarrivaltime: 29 Nov 2022 16:44:34.4723 (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: utYxDYz+mrsR0Iu7HR464uAQNN79l+gA4/a8y6xjO1QldmtE7tBKpccR6YX5YvPTNXZyhv3wUC3ssivYaL35Og== X-MS-Exchange-Transport-CrossTenantHeadersStamped: PH0PR10MB4792 X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.219,Aquarius:18.0.895,Hydra:6.0.545,FMLib:17.11.122.1 definitions=2022-11-29_11,2022-11-29_01,2022-06-22_01 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 spamscore=0 phishscore=0 suspectscore=0 bulkscore=0 adultscore=0 mlxlogscore=781 malwarescore=0 mlxscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2210170000 definitions=main-2211290093 X-Proofpoint-GUID: 12fzLJIFI-E5w8L4VZimEcp_HIreA-Hm X-Proofpoint-ORIG-GUID: 12fzLJIFI-E5w8L4VZimEcp_HIreA-Hm X-Spam-Status: No, score=-2.8 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_LOW, RCVD_IN_MSPIKE_H2,SPF_HELO_NONE,SPF_NONE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: <linux-kernel.vger.kernel.org> X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1750850325894281872?= X-GMAIL-MSGID: =?utf-8?q?1750850325894281872?= |
Series |
VMA type safety through VMA iterator
|
|
Commit Message
Liam R. Howlett
Nov. 29, 2022, 4:44 p.m. UTC
From: "Liam R. Howlett" <Liam.Howlett@Oracle.com> Move logic of unrolling to the error path as apposed to duplicating it within the function body. This reduces the potential of missing an update to one path when making changes. Cc: Li Zetao <lizetao1@huawei.com> Signed-off-by: Liam R. Howlett <Liam.Howlett@oracle.com> --- mm/mmap.c | 45 ++++++++++++++++++--------------------------- 1 file changed, 18 insertions(+), 27 deletions(-)
diff --git a/mm/mmap.c b/mm/mmap.c index 6b05e1dbf705..af611f805776 100644 --- a/mm/mmap.c +++ b/mm/mmap.c @@ -2660,12 +2660,11 @@ unsigned long mmap_region(struct file *file, unsigned long addr, * Expansion is handled above, merging is handled below. * Drivers should not alter the address of the VMA. */ - if (WARN_ON((addr != vma->vm_start))) { - error = -EINVAL; + error = -EINVAL; + if (WARN_ON((addr != vma->vm_start))) goto close_and_free_vma; - } - vma_iter_set(&vmi, addr); + vma_iter_set(&vmi, addr); /* * If vm_flags changed after call_mmap(), we should try merge * vma again as we may succeed this time. @@ -2702,25 +2701,13 @@ unsigned long mmap_region(struct file *file, unsigned long addr, } /* Allow architectures to sanity-check the vm_flags */ - if (!arch_validate_flags(vma->vm_flags)) { - error = -EINVAL; - if (file) - goto close_and_free_vma; - else if (vma->vm_file) - goto unmap_and_free_vma; - else - goto free_vma; - } + error = -EINVAL; + if (!arch_validate_flags(vma->vm_flags)) + goto close_and_free_vma; - if (vma_iter_prealloc(&vmi, vma)) { - error = -ENOMEM; - if (file) - goto close_and_free_vma; - else if (vma->vm_file) - goto unmap_and_free_vma; - else - goto free_vma; - } + error = -ENOMEM; + if (vma_iter_prealloc(&vmi, vma)) + goto close_and_free_vma; if (vma->vm_file) i_mmap_lock_write(vma->vm_file->f_mapping); @@ -2779,14 +2766,18 @@ unsigned long mmap_region(struct file *file, unsigned long addr, return addr; close_and_free_vma: - if (vma->vm_ops && vma->vm_ops->close) + if (file && vma->vm_ops && vma->vm_ops->close) vma->vm_ops->close(vma); + + if (file || vma->vm_file) { unmap_and_free_vma: - fput(vma->vm_file); - vma->vm_file = NULL; + fput(vma->vm_file); + vma->vm_file = NULL; - /* Undo any partial mapping done by a device driver. */ - unmap_region(mm, &mm->mm_mt, vma, prev, next, vma->vm_start, vma->vm_end); + /* Undo any partial mapping done by a device driver. */ + unmap_region(mm, &mm->mm_mt, vma, prev, next, vma->vm_start, + vma->vm_end); + } if (file && (vm_flags & VM_SHARED)) mapping_unmap_writable(file->f_mapping); free_vma: