From patchwork Thu Jun 1 02:15:52 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Liam R. Howlett" X-Patchwork-Id: 101643 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:994d:0:b0:3d9:f83d:47d9 with SMTP id k13csp5193vqr; Wed, 31 May 2023 19:18:08 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ6hKavav9ZBQnSuBeGrEnvaBr09xvQO3u1rWk3Ce79DQPqklCSJqpCN5BOGDoiL7iKzieNK X-Received: by 2002:a05:6a00:2351:b0:643:9e7c:3829 with SMTP id j17-20020a056a00235100b006439e7c3829mr10345481pfj.12.1685585888414; Wed, 31 May 2023 19:18:08 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1685585888; cv=pass; d=google.com; s=arc-20160816; b=ksdzbi1Gyhnfj/2QnwowypFL16bdE4umgXeGFxh9KyXG4pREkwck+9439P770ACeQu DlwamP3q7w9U/w8plBx4LFTENAjs+eCFlrihv4LfbpBEv+FwiDqq3QRb5FPT2aI0MwhQ Nn5GMOFt5vIYQX93WYkE5u8SDZGEOYHM4UQSzkKw2B6gk4iuzoO9jSNQbiOMmJfE7xot wv7hhMjSBbRMfnj8fBJ/rj7WNeE8TLDBta3/E0x5t7WosxDqxeDwp5jXby4ilGNw+Tws Q+DrDz0D6lNx4eng6jlllyMB9wvMRiduQ/8hD8ahd7Lv2XfCz9Yd+elqeQvcoM+J1Ufv FrUQ== 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 :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature:dkim-signature; bh=hNNPNCDvHhDl4WRLh9/7Z8qWAAWKO6ttK4dq+KZRwuk=; b=jUwP7m+Z5Rbi9Iq8z4oed6OXNq36jYVb/Ov6meWZ08iv5Iokvkl2L7lfn2yrhl/FDv InYjqfagla/D4yTl6/N7qc1UP82p//JLvinq3ywlUdhvPrqQwIHwjZ7EH01BSi45SzKv c5LTP2966+u7BSOz6SxpN5YRgSCQfeEWoIPC7NS38gs496WyL0CXsJ5fVkhYFwPyeE/8 k3afRiXfy7StghjkA8j1XFR8gwCD7uGE+Mzydux4i6E+nA3u+/Q9N7osYo3NLMep5VVj CYXh+JVzdDW0vAx7uzuAXs2b7irTJeeTU2H4AC42Ig00xak9kuRiSSb1fWG7XhgEFd/A 15Xg== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@oracle.com header.s=corp-2023-03-30 header.b=Wl44DzIM; dkim=pass header.i=@oracle.onmicrosoft.com header.s=selector2-oracle-onmicrosoft-com header.b=cT6l5As4; 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 t64-20020a625f43000000b006453ad4ff39si4011839pfb.147.2023.05.31.19.17.56; Wed, 31 May 2023 19:18:08 -0700 (PDT) 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-2023-03-30 header.b=Wl44DzIM; dkim=pass header.i=@oracle.onmicrosoft.com header.s=selector2-oracle-onmicrosoft-com header.b=cT6l5As4; 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 S230509AbjFACQr (ORCPT + 99 others); Wed, 31 May 2023 22:16:47 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:50902 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230473AbjFACQl (ORCPT ); Wed, 31 May 2023 22:16:41 -0400 Received: from mx0a-00069f02.pphosted.com (mx0a-00069f02.pphosted.com [205.220.165.32]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 3B6A618B for ; Wed, 31 May 2023 19:16:38 -0700 (PDT) Received: from pps.filterd (m0333521.ppops.net [127.0.0.1]) by mx0b-00069f02.pphosted.com (8.17.1.19/8.17.1.19) with ESMTP id 34VJt9tc020026; Thu, 1 Jun 2023 02:16:31 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-03-30; bh=hNNPNCDvHhDl4WRLh9/7Z8qWAAWKO6ttK4dq+KZRwuk=; b=Wl44DzIMGCvGjeCfHa7f8zMkFqwaZSFKHevccsxOj+hoVdlVWFvUqc/7W6rN0OHGIjM3 uf8W2wdhrki/cfV8/yt5rHoIaMu1oaInVAHPBpfAqPdAg5i8xkoemI/Ry63OmcsfI4Gh FY+U1L64fvJwz0cE3QruovRAj3iSMmPtK2LoG6kgcoFC23h5bxQYt6v30OdXTi1pPN17 0Ndvzgpwu5nrxd/nIRRyjbN86hwfQ/uxu4/fy/IEseir4s4pnxuBkVYoakSfab8mE7YX C4F3iXVEpmWn0V9HT3o8rG4mrKgtqMHelDxNKuNWcgsZZw764sJk2+1iUgvBHIFHU7zz VA== Received: from phxpaimrmta01.imrmtpd1.prodappphxaev1.oraclevcn.com (phxpaimrmta01.appoci.oracle.com [138.1.114.2]) by mx0b-00069f02.pphosted.com (PPS) with ESMTPS id 3qvhjh7hb0-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Thu, 01 Jun 2023 02:16:31 +0000 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 3510E5VY014631; Thu, 1 Jun 2023 02:16:30 GMT Received: from nam10-dm6-obe.outbound.protection.outlook.com (mail-dm6nam10lp2101.outbound.protection.outlook.com [104.47.58.101]) by phxpaimrmta01.imrmtpd1.prodappphxaev1.oraclevcn.com (PPS) with ESMTPS id 3qu8a6gr6q-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Thu, 01 Jun 2023 02:16:30 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=e0BumRofVVkgtYj148LE39NaTPTU/euKc5qywBm8QBQh4gYVMfzn8xRZWB/UgqVL5MeHE7/xxmuIXTH0wOG/hp9dU6ECxnuF+52I0qDlATdaJzPXbTUPQ8bQgI2l7JoybSVJ1AS9B+PKSMp0zygUHcNNa8y1JKGvxQU0uk9S6Gh2IDKbi3m3dHzxi7sC7E0D3wLgq4dyeRu76NJgjORYTuYDdRgpGyKhqvZZvJfR6BMvSUWj7AvqK3G4SLB6NWItxZgrggf+KhXA76r+QIH4A+dB/ZpyN9L2Bq19BbCVrsYlYWVo39TS6HHovawvsYUs+K8YeQk/WCncX9RmjzkKrQ== 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=hNNPNCDvHhDl4WRLh9/7Z8qWAAWKO6ttK4dq+KZRwuk=; b=P0/NI6+COntkDg6p9tzbhsOUDJFvJ+HMLb+Eo1ckzGCYTBn6Yi/OFGTA358kvEnixF6hy72ZFRu4JUdj0PTPjBWoomCwuqhLbFaB0hoWe/5gDmlca8veqxPGBZm8iCqe8iIgqPxpkeN7QkSGSzCwkJlAcR3z9pNnxyw/gRK4G95RUiafXkfd4dG95dVcpugq5C6Si+7UhpNizIqSU+Qo2RLGMqG1hrxL3DMZId8XmOREffbieft0stZy33lStqOfoFznX/Eu0NmHJuk0mRW127GeWVl+GyGo332QHnS2K7Gi9MV6i6GR5iqmrHa3vaNuV0d8vtVo6npKSdiL2J9wgw== 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=hNNPNCDvHhDl4WRLh9/7Z8qWAAWKO6ttK4dq+KZRwuk=; b=cT6l5As4e/mIS3e82hFW2iUEdlld5paPqWcwVboq03FIdmH1rsZpdcGGa22m7nejlkHKbdILpvNEzP/qjtDOBuRsnlCRCtG/aPxEw0mh2YOybNs4iS996bIQyfqtcgjfLogMoYnOkB0VbXedHoNHCV6Ehsr932qLmvkpCr4u4Xc= Received: from SN6PR10MB3022.namprd10.prod.outlook.com (2603:10b6:805:d8::25) by SJ0PR10MB4687.namprd10.prod.outlook.com (2603:10b6:a03:2d8::12) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6455.23; Thu, 1 Jun 2023 02:16:19 +0000 Received: from SN6PR10MB3022.namprd10.prod.outlook.com ([fe80::998f:d221:5fb6:c67d]) by SN6PR10MB3022.namprd10.prod.outlook.com ([fe80::998f:d221:5fb6:c67d%7]) with mapi id 15.20.6433.024; Thu, 1 Jun 2023 02:16:19 +0000 From: "Liam R. Howlett" To: Andrew Morton Cc: maple-tree@lists.infradead.org, linux-mm@kvack.org, linux-kernel@vger.kernel.org, "Liam R. Howlett" Subject: [PATCH 01/14] maple_tree: Add benchmarking for mas_for_each Date: Wed, 31 May 2023 22:15:52 -0400 Message-Id: <20230601021605.2823123-2-Liam.Howlett@oracle.com> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20230601021605.2823123-1-Liam.Howlett@oracle.com> References: <20230601021605.2823123-1-Liam.Howlett@oracle.com> X-ClientProxiedBy: YT4PR01CA0339.CANPRD01.PROD.OUTLOOK.COM (2603:10b6:b01:fc::22) To SN6PR10MB3022.namprd10.prod.outlook.com (2603:10b6:805:d8::25) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: SN6PR10MB3022:EE_|SJ0PR10MB4687:EE_ X-MS-Office365-Filtering-Correlation-Id: 21388493-825e-42de-318a-08db62462faa X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: UtGOTpr6zFlGqyFII+6yRqbd9Ij8/9J4f4CwHpTcNpL/5+c0X361irVimr1Ep0JGZKxY3199mqW9eP2U720d40DlelB5pNQPaZ3O5i2LabmvGFM1X2KdJMTWi5sBO9XWQQJ1sYcUyzBRxiz4LRfclFdsiKEk5Eki7jbz+2ZbG1togz2lcBmKmlrdgREI+tvEHuF0h3Vi564pNrWzzRNTz07nWFItcFlodFbiVLQaLQ7yx9lz1eqnpFCxLGrc3HVadYSZhCtPQ0tOVZLcRwnUKBtRviHzqADdretn/DtpMB0MXG7cRb9JGZgjAOXEsNp9Gdu4XG6WPoUTibU7NaOgDGSsqcYZnXtp103UnINtd5OsCJ6REFgc0LXLti8PQ6XzdWrs3Q0XNUJQaCqEsB4AEIJmLf3ZuAv8SoF0cpxdQFoTFGqHjQqk1UYLzPzIHA3YIrX+PKlYr8yDImqogl3+JMkZp1FX4XFHd7WKWXez1q1fWsG/cOwsxjA+dLP1brXfksFKML+IofUBXXSzxEQ05qRlREI98Z2uuge7pC5wzurF/5K2ydBrNr8Eqn96hIXt 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:(13230028)(396003)(39860400002)(136003)(346002)(376002)(366004)(451199021)(36756003)(38100700002)(86362001)(8936002)(8676002)(41300700001)(107886003)(5660300002)(26005)(1076003)(6506007)(6512007)(2906002)(186003)(2616005)(83380400001)(6666004)(6486002)(66556008)(66476007)(66946007)(316002)(478600001)(6916009)(4326008);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: BHSEWj66j8mV+uDESMp/8VFkbYO+MV44bevas5Ha0mu9/iZqS2jHCJyEw7pNG539ZHooJIvfwF7Jma+1GMhAytMZMiiUV3H/WRVuGZmOKM9g35d/iRzTiKK5K4lK2RjR3CB6pDEiCVHTLPfBWvXee1aTRszuuFQBQlkZOdXjRgBAlF1aVODksv7xCycTkQ7EOSS6jeWSVa7gTC/aCEXwI6OSm86Zj7vl5GRLlclKiWIBZ7GSCsPDs3xF33sQSsB9cA3NrBY0i0h23/mWrWIK95tfuVMx3hh1CPSLGS4TxeLBbQsBf2u8GDcPVv6kOPXWf2jN/TM/ngI4i+rjDXLtgYxMkE8K7czhJCLR4grhRFW+xnicc7jHrfiofWhAxUXcv/aFhB+G2XBL6tNRDMc5XcvLJlQJUzQJqDn0UEOgoaGRhVrI3XG7jTP5HJlhSQ8cNIl9Pg/IbMyCfkGoKiccsGLQ0YzwolMGxUpyAOKXAUCRUDjOKd46bfjShxH/1MrsxAE34YtxleiF8hloUnMa2Gl3JIYw+oOO4Hzn0IMBaOyTtIqzb1zwlm2ZsOIUzGS+eIJuyLfgby6/cjXJ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S-Exchange-AntiSpam-ExternalHop-MessageData-0: QeAagsZEiM0IDX1uQVxoNzeYmhgpxKG2STo4+DCvagDC4B8rlUuefPfKlzhdlohAiKcrfImbk9iMWz+19zZ5iLswIYpYV3YMSNsu9W8pymO1IishavyZ2DFJRvznNErk98k20UN1ndrM1A8Y57QmrOsXykEspXiGQG/TFz2cORe0vV9lHKseil03ueN2Jctbc0OyDVCjVDCsPmjnwS6y6v4HDZAQnmoR3YN5QgTmuGVmgwWAHajreopHp7RxsStgDyG6SvTH6Sh85ETUmS1H5eNLfzF1pZhyE8VIxADpSCSD/tOM7w8MikJuAoL7WmTK+61SAuIo1ksiPx3WNrhpbnuAec4NZ4BGNkLmE/T/QpXQs+B3GYaciihr0V/FmkqeYaTra7dPO2UkRRW6mUDRpIjTljSJqOrDLD6BhFGo/0bvRdwR+mvjrh7/sFUQy+6CK/XbODREC0wokXViO1FKBkVff/mLufyHAlJr9co1zNv9eLjOy5EVNgCDp7CLYdCH/K8KNek2GrDZkFLoKCQXKvQkMol+tG6fOHZSln1sjcJjovzOGvpCVKl+5jrhVMEL7toNmSyhAFlo15uhaUKhWfgA4r4FzZSu20i5gY+PHvSBEYHLPgjm6w8C6l7vIe3hssPTIj0Ha8RxmbUB8ZVaKAx301/kbmN8jxPVEKaXOPgsD6XZ3EEgVNUpXtAzqoSdzsaUVrAIkQFcpa7MGjGyYpPF2sYDSOmoQoltVYjU5kYhT/+SCQqPRQZVI1wCQLJRTzlzZU1F/sUA1zedqShiaq9H67Akj1YNNoNwKLPE+CzyNfDHKp+eaQ1uFqJUw7kCsxNpv8qtfjz0X9WUO5ynz8DmtKBmDjyLqG7SE2b1rZjomMtJF1ab+H9M6KeYcG8IHRFxzE9M7AJv1RyNTjsTcg== X-OriginatorOrg: oracle.com X-MS-Exchange-CrossTenant-Network-Message-Id: 21388493-825e-42de-318a-08db62462faa X-MS-Exchange-CrossTenant-AuthSource: SN6PR10MB3022.namprd10.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 01 Jun 2023 02:16:19.1550 (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: DzrGHif99CZjSZUb65ZQ6wrh3HUuA9OtTd/84ewcUJqg+EKyNtpwMp5Mm7m9012+ot8sqoG23iYuBOvjEovKeg== X-MS-Exchange-Transport-CrossTenantHeadersStamped: SJ0PR10MB4687 X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.254,Aquarius:18.0.957,Hydra:6.0.573,FMLib:17.11.176.26 definitions=2023-05-31_18,2023-05-31_03,2023-05-22_02 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 suspectscore=0 adultscore=0 spamscore=0 phishscore=0 malwarescore=0 mlxlogscore=999 mlxscore=0 bulkscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2304280000 definitions=main-2306010016 X-Proofpoint-GUID: -Uc8XSWebcAtuRfKkCAt5pLCsuA9bRo1 X-Proofpoint-ORIG-GUID: -Uc8XSWebcAtuRfKkCAt5pLCsuA9bRo1 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_H5,RCVD_IN_MSPIKE_WL,SPF_HELO_NONE,SPF_NONE, T_SCC_BODY_TEXT_LINE 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: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1767464908861584234?= X-GMAIL-MSGID: =?utf-8?q?1767464908861584234?= Add a way to test the speed of mas_for_each() to the testing code. Signed-off-by: Liam R. Howlett --- lib/test_maple_tree.c | 38 ++++++++++++++++++++++++++++++++++++++ 1 file changed, 38 insertions(+) diff --git a/lib/test_maple_tree.c b/lib/test_maple_tree.c index 9939be34e516..3dbf99c3f2b1 100644 --- a/lib/test_maple_tree.c +++ b/lib/test_maple_tree.c @@ -44,6 +44,7 @@ atomic_t maple_tree_tests_passed; /* #define BENCH_WALK */ /* #define BENCH_MT_FOR_EACH */ /* #define BENCH_FORK */ +/* #define BENCH_MAS_FOR_EACH */ #ifdef __KERNEL__ #define mt_set_non_kernel(x) do {} while (0) @@ -1705,6 +1706,36 @@ static noinline void __init bench_mt_for_each(struct maple_tree *mt) } #endif +#if defined(BENCH_MAS_FOR_EACH) +static noinline void __init bench_mas_for_each(struct maple_tree *mt) +{ + int i, count = 1000000; + unsigned long max = 2500; + void *entry; + MA_STATE(mas, mt, 0, 0); + + for (i = 0; i < max; i += 5) { + int gap = 4; + if (i % 30 == 0) + gap = 3; + mtree_store_range(mt, i, i + gap, xa_mk_value(i), GFP_KERNEL); + } + + rcu_read_lock(); + for (i = 0; i < count; i++) { + unsigned long j = 0; + + mas_for_each(&mas, entry, max) { + MT_BUG_ON(mt, entry != xa_mk_value(j)); + j += 5; + } + mas_set(&mas, 0); + } + rcu_read_unlock(); + +} +#endif + /* check_forking - simulate the kernel forking sequence with the tree. */ static noinline void __init check_forking(struct maple_tree *mt) { @@ -3430,6 +3461,13 @@ static int __init maple_tree_seed(void) mtree_destroy(&tree); goto skip; #endif +#if defined(BENCH_MAS_FOR_EACH) +#define BENCH + mt_init_flags(&tree, MT_FLAGS_ALLOC_RANGE); + bench_mas_for_each(&tree); + mtree_destroy(&tree); + goto skip; +#endif mt_init_flags(&tree, MT_FLAGS_ALLOC_RANGE); check_iteration(&tree); From patchwork Thu Jun 1 02:15:53 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Liam R. Howlett" X-Patchwork-Id: 101644 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:994d:0:b0:3d9:f83d:47d9 with SMTP id k13csp5196vqr; Wed, 31 May 2023 19:18:10 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ7qM0pLoQWCoZk++RfQsyD115jbikDaXe7kYM1v3lvRtc4b1WPpBXu+rgD7x/fvSNF8tsKp X-Received: by 2002:a05:6a20:1447:b0:10a:e9ff:808d with SMTP id a7-20020a056a20144700b0010ae9ff808dmr9312382pzi.0.1685585890438; Wed, 31 May 2023 19:18:10 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1685585890; cv=pass; d=google.com; s=arc-20160816; b=LEba7zNRVj3/aPdhnHE1pnfyi1B7yPX1Al7REBTDyCVVw3z4i5pwUGE1aTG7/ovAOm UNQPkD8gfvjyExvdhWw7w33FIfHtfbw7wOoIjGvf80gND/qReV8pELzZVXkMdMQ72+uT 2hlUamtwjdIQ/yfKog+E7UX2Dmug3faxU9JvbDkxlFD5cOxUpjgMq8SSK1lJGYraFC74 S8TAlRLcgJ0L6O3lTrA5Jx7dDEdcJ2ZkyQl+3Vhi9QEvFRLVhUE9VAOa6vSRC+4b5ACl 7QsLwFGyzE98LMuQyS5EH+8erjRWHIgHMZNoYv85l9BV6yqnxIC7qpXi8uw83io6yad8 s6Kg== 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 :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature:dkim-signature; bh=wU14PBuTjC9Yf1nsufmd8IeOziKTsVC4KgDaYYEL8V0=; b=CrQjmabbBcmSIgYBxHJ7axShFUDWqDObP/95+TMeXRN7+VzWqLudOb3d+Imq9nPC0r 1TK9I2QUTqHrbefCF8+e+jlCpeiVLgzyanCVoEuj+4Ef3mNPpb9VY01mwkf4LwZmjMvN pDjhmbjxb36m7DCHNLrx3pDMQF3+gRC0ZeCyLue0Ozo9P1e0m5OhKsN7beA30Nftkie0 5uFAdi8KH5VWeCORLmmcjB5CmUAMXtA9MdCWtasRR7Xt3hhe9ORY2XNK43uKIePE/lu8 otklfWioT9P3YRcVaSvgPGe3tGvO7tUeFcWl6WSd7BrC5kscG8GJSrOJhDLIV7IoOI2Z KAoQ== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@oracle.com header.s=corp-2023-03-30 header.b=asrujIQQ; dkim=pass header.i=@oracle.onmicrosoft.com header.s=selector2-oracle-onmicrosoft-com header.b=QLMRCCOE; 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 s17-20020a632c11000000b005369f4111b1si2024480pgs.658.2023.05.31.19.17.58; Wed, 31 May 2023 19:18:10 -0700 (PDT) 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-2023-03-30 header.b=asrujIQQ; dkim=pass header.i=@oracle.onmicrosoft.com header.s=selector2-oracle-onmicrosoft-com header.b=QLMRCCOE; 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 S230493AbjFACQv (ORCPT + 99 others); Wed, 31 May 2023 22:16:51 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:51014 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230483AbjFACQm (ORCPT ); Wed, 31 May 2023 22:16:42 -0400 Received: from mx0a-00069f02.pphosted.com (mx0a-00069f02.pphosted.com [205.220.165.32]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 631D0195 for ; Wed, 31 May 2023 19:16:39 -0700 (PDT) Received: from pps.filterd (m0246629.ppops.net [127.0.0.1]) by mx0b-00069f02.pphosted.com (8.17.1.19/8.17.1.19) with ESMTP id 34VKXv0m032525; Thu, 1 Jun 2023 02:16:32 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-03-30; bh=wU14PBuTjC9Yf1nsufmd8IeOziKTsVC4KgDaYYEL8V0=; b=asrujIQQ/aPJPtpiR/ujC6htyjUqgeyaL5naVHDmLOrlayBBc5hJQwV6L/0m8Dmcu525 WFFAKHZE1f6DMrhjRaQI7gbiRjDbmiPTYeSey+cUnBqXPXvkdm3XSv3Nv7RqEfFjTBjk qHd2LYul1TfHMokdzQiJX3DNA1ZbSmofiuheAd0Wl9cUPhiwtaXdCGCzO7E3zOGEzUtv Po+3Skm+4xzaz9iY8Pvj3N4UG+5VTUHG6a7ahqYC9Z7nuqBFD4hKMe00dud51GUaNnkT 6VDb5kaccvROMNKXx8e70Ki4qUBhqi4BPi1e2OWOrSTWIBTAnA8+3aJD8CxGPezH+oX3 Nw== Received: from phxpaimrmta01.imrmtpd1.prodappphxaev1.oraclevcn.com (phxpaimrmta01.appoci.oracle.com [138.1.114.2]) by mx0b-00069f02.pphosted.com (PPS) with ESMTPS id 3qvhb97hv4-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Thu, 01 Jun 2023 02:16:31 +0000 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 3510E5VZ014631; Thu, 1 Jun 2023 02:16:31 GMT Received: from nam10-dm6-obe.outbound.protection.outlook.com (mail-dm6nam10lp2101.outbound.protection.outlook.com [104.47.58.101]) by phxpaimrmta01.imrmtpd1.prodappphxaev1.oraclevcn.com (PPS) with ESMTPS id 3qu8a6gr6q-2 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Thu, 01 Jun 2023 02:16:31 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=PcFwpI44CtimFOFwH/QhRUHdHmfa9o17BljAfL4NV5313Hxf1e1PoJRrpq8JNmwLYWiKHt8DCR1xjQxAmhv0aYGGBrm53oSI8q2EuD+/HXjUKalcxVsbvJuF3AkD3otUfKqEmCH51T9ZnMIW4MnDiADiHntvNJGkdnrJHXDnYppd9aZAb4iK1UjUVD16rppT8V6Dmr62x66Td0Fo8cynwNlr77MUBWlcm8hgjpTnmkMkAv3wDndWI7IimAK0o+vcsPLYtgcIdC/3tXtSs2Q9/MDP7J7T9/P/0FSXoHzqaoSD0GWaxZxzIAxFnfri7UT3lbNMAHsZtabK44LijGkwRA== 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=wU14PBuTjC9Yf1nsufmd8IeOziKTsVC4KgDaYYEL8V0=; b=DDXUHLU5YE6pxtaG42+4y5uAXmSq7NGPEWHre9onJz5D6Wk6O1EFbxFAFu1fpg/mD4Ma2L3DRJJZNRR4rcVZCBQ+RaYn+EbFMr7Z4ggJK+AofZEWLJ54450eZx+n/ZviBfrmAID+szRFgDSxDlYdzwRpsVMGZnK8A0RM1mutWO7UH912HCAdwvmt1ssfmsJIc0ThKzFsgKC/+WqriNiOnm8yjLkT+wQVwojGP503usc4TCNr1kZFoLy0DDQgxGX+/Ea2UnEo2rJ5z3LQsE2iykDeEbHak3gfiiNkS+gaj6l1wlVU6S9X9WlRoCFD551b3+0mPNBH2V0OxucvMZ/7lA== 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=wU14PBuTjC9Yf1nsufmd8IeOziKTsVC4KgDaYYEL8V0=; b=QLMRCCOEqVRqKi/upUToE+kOCNBRh2L729+NYEh+g0upp+ByzNsdKNIlT737doWoAvg5kdxqOm7MHx8SVNitgi/qgUeRiNCdIGF+kltMj9dWLD3imPfZf5kRvcYPwUP8Twrqb1vhjqeWe1Eo7xgv19xZcjJ7N2u2Kfo4SCF6kiY= Received: from SN6PR10MB3022.namprd10.prod.outlook.com (2603:10b6:805:d8::25) by SJ0PR10MB4687.namprd10.prod.outlook.com (2603:10b6:a03:2d8::12) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6455.23; Thu, 1 Jun 2023 02:16:21 +0000 Received: from SN6PR10MB3022.namprd10.prod.outlook.com ([fe80::998f:d221:5fb6:c67d]) by SN6PR10MB3022.namprd10.prod.outlook.com ([fe80::998f:d221:5fb6:c67d%7]) with mapi id 15.20.6433.024; Thu, 1 Jun 2023 02:16:21 +0000 From: "Liam R. Howlett" To: Andrew Morton Cc: maple-tree@lists.infradead.org, linux-mm@kvack.org, linux-kernel@vger.kernel.org, "Liam R. Howlett" Subject: [PATCH 02/14] maple_tree: Add benchmarking for mas_prev() Date: Wed, 31 May 2023 22:15:53 -0400 Message-Id: <20230601021605.2823123-3-Liam.Howlett@oracle.com> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20230601021605.2823123-1-Liam.Howlett@oracle.com> References: <20230601021605.2823123-1-Liam.Howlett@oracle.com> X-ClientProxiedBy: YTBP288CA0018.CANP288.PROD.OUTLOOK.COM (2603:10b6:b01:14::31) To SN6PR10MB3022.namprd10.prod.outlook.com (2603:10b6:805:d8::25) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: SN6PR10MB3022:EE_|SJ0PR10MB4687:EE_ X-MS-Office365-Filtering-Correlation-Id: b81ed707-260f-44b9-42f7-08db62463106 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: PZ11cKNM6CcmAYoduajLYnC5f3uQKhe3OJcuqKBR0y83jsKSHIDO9VTZtOW53cLaCxd/eIOb18+7p2NyBLRzFq7wKPIjrbu1fjEXqFiJSDmA2EqVQ0ngbC3ykYhNLHryc386+F4C9KykTxZw+JhD5iQ/3rg21EM/QVS56bbdku1CgSgeqJqS1kc6TLQhioeya+i4J/67uL2AwqiCFeLGlDIbpMvfyr32NcRa7dFWHULLo1TQKYCcsKHQDL3P3B96a9pv0mXQD+qwDgiNUoc3aNkvG70vG4drUOHLMPsNzGYdg/Aii+tMVXfrLkzsBJK9iIRgApwxo0gOiAXoUzBdbS9VLO0H7T9G0ornTYtpJrolH2DT8RJDf90MRkOHN1EFtCHyU1Xbf5FJwFQ63WuovPbeM9cmgJlMBaezqruB3FswHqSD8xSFR45OCAjof8UGawrSNOGVZCFAlWDZqaYnWd1D3lMa4dydpWqNnvm/gMuGzxQY0GYJMLSWTfkM4fm9OabrZv+jb2zqegxd/HCA2jcGpdLuAskduJZdcilenNke+r8Cew2//eRyMfjMufr3 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:(13230028)(396003)(39860400002)(136003)(346002)(376002)(366004)(451199021)(36756003)(38100700002)(86362001)(8936002)(8676002)(41300700001)(107886003)(5660300002)(26005)(1076003)(6506007)(6512007)(2906002)(186003)(2616005)(83380400001)(6666004)(6486002)(66556008)(66476007)(66946007)(316002)(478600001)(6916009)(4326008);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: sIK3dSqnxTcUzFKrJWYu5+gRCteGE8JwrlHJpFqUWZciw9bkavpZ+4EVv56f5PYNX47dYnUpops+/mthf6D4UvGxVzucUaF0VHJVjsEt9VHdkxCiAvA9KuFAMx/Txz4VyEO6q9KAOjHI5hnQ4z5cvbR+B4d4DfYEoHcm+Fj4O8LF6uA4PTnlI1lomJ+IuN5E60wV0lXOwjiLogPCTBz1/C0XTFsHtbrRUDpPqqbENjY1umsMwmAKCs2w+vWK0hyLH7eP3ofhNxjqirlMElGKBgXxIzD4WzImLRBY/3C/1KP6dKOLSIXbC5UXpSx4b+g82eBJ1YJ07T4/xuxnHZiIvVBwqvZIlP+2E73K8wmaeaeWKOu5MH8dcBAS9pLoB7dWZoZCnDImrcpUUN3Iahi26mQmcJ4ll7J85WCC//v450TBU20ANgzixPqLsZtNH273smLTIoN+FmdlTLuLwLul4LLPAiDp8SFYdHT7NX/+SrSKNmQ048VOMHoFGxnXeWYwQXpSU+/pkFegIFrg9Ocqu8PExWxvg8psPbg5ozMGST0aiMYIpWhixeTkcse+7NdfwJbx1MWpXSQqDd0AbLMC/XWZCBCDiK9sr+FpKXc7UV6DsD+WD1NXj5V8milzyxOoml0dx93ZPao7FT8652qeIN/0AXINKKDoDnAPYnx1voEuswEAzeWAKApeK05CO0W0vEY+7r2UwK2dujEvD/qhN/38Ac3vuGZW1CjTEp/d2cWWzHikuKj7LzhNutNsGP8ingi466KkmAjLkMTOTioWwI41kTAAndHEzsypdUyWIwgSk778mJU2R2U9MCsz2S4JlglE11RIPt//AkphHiv3ITVHevHGNYHujIJ9Ukc8AXYVtG+j+bneDb0fxsQ2OEMXp0PIyHLRKGgKEmd8EoBgON4kyxh1NZ6mRsIdsDOM3htJ/gfY33N3iY59wJBq8H7Z2Siq028AY1kF/twWLS8YZ8t4BCa/+YvtdXJIKe2Gp+VY6YvT3OhOLxr8BYwsUW0ZUuo73qZaQAc32/WM2W6n16m4X0p24IboZbutanBoyYCCupZtT7RdyBj8b8Bkz3aDLkyEOngNENES5KjEGvm7QDdmhI81Luq0/X0wmS+hJdLpTNXCw1Z62HBxVzwARJwE0UEIaMt2aUoNNtuQUxr1wiwQoA6FhYRCTa/fOylr8fDGB37ZrBjuqVPsuQYKH8xspCIJKlLGWy5todikuUfCdwHaLrAFq9IK0ZJPV/prF8KeEbMqGUuKhniapPmxB25jWKJE7/KPTfVF+2zr+NrPO4H34pUvfMsm3zjClowDbsyUGXHVuNynhb5XZNHMCL9v4Q5x4oD0jINtQ9lDsFYWqPEgsnnyukEDFBocM+t4sVWlUa8rimLTL4Ck8tWJrju832KhvbGgJpvcBxNc8FqAWreY5Cl8TCcuGl0B4JzKT8EQUbVP+ttq5oLIpHhILOQnjZRCoWT8PHoUjtIVR/cdzvg2Y5sqP4W6EBU3qmcBtg/QXtD5K50iT+HRdpIAHxcJunGto0/+oguUj4OnpDWwWRZwmqRttRKU45eKmNSdi0rHved6N4yZ792Z1Xr1G986pDKvEW6H72T6bRJ+QiNVyA== X-MS-Exchange-AntiSpam-ExternalHop-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-ExternalHop-MessageData-0: BXqogGFQIO3UbyPLgbjQfwyzUWmYk2XMtefLFbrh1RqUVFTeviJx4lp8287qiTeNZIBD+TjSaYAD6TPfyPasWNHanoqRrdxQ4B2qBdzomCLX5c3XY41sGVs7O8IUSidO8a/Wb0jW1hiWmc2OwuI7EZP70mH5JGEjJvlfBrT3u44zze2FThJqNCTw/3L4yiwk0np7QkUTHR+d99KkO/RiQ4uZ/eLllJRX4K4a2NhpMXgDV0OhM/q9i+OrFD0itbvlUThxyd9GPNUEY3whEw7WWoxZY/HSyDf/Y4C3dP/SG5cD5DSHnIrwvXLUJTwvRhdQpSZRD5+nqgwrlvaJBguJ0kiDjwA+O2g/Tw7lOMgZrGFChEgi3RwV1DuU8cXnanYjAJKv8/lSaUSVcGiQJNz/8XYLBv4RUEn/o4pUy75v31Y/3ruxJiAq63neTg5he88j9jG7bmi203wEh4kM+7JMFBMfocBWni0I0RWRk7RL0+sg9cNr2LtWKdMk5naSM1QsX8NgYCq8Jh1vZTb5FPUNZSHlz5ZfiHGOWRhgIIIKspM5MZbEnZp9IQHEdw7ekIn4fW1UgjhakSSewAMVl0x+c3KtXwkQKF6/J0TABPjS4fu4dsyCuSz+/wQRuCO3TQYRCzDT+8I1ZetslWHnB25uKCouFbzsBvybivl9e/w9lVuR1GOhdK7TdeV5gTpJDp0bUXSfHu3l5K0vUP3MkaRg2RlnpTfzvl5GnA7739KT7QX0ruZqKhwuWCGCEbyqR/LW4rt0KoqrbZekyyn3kDGzv5s/QeJ5f4PIdDD0sVQ4aaxuOz8k/qc/8ApGhBnffrWZKzifkUrW622rp3Hb9feNFzJB0c6ko+EeTqcdxsS1wQG983ELxRKMJ63FBH4fneiYwNM4QYm5EK1Tm6pnfvuSEA== X-OriginatorOrg: oracle.com X-MS-Exchange-CrossTenant-Network-Message-Id: b81ed707-260f-44b9-42f7-08db62463106 X-MS-Exchange-CrossTenant-AuthSource: SN6PR10MB3022.namprd10.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 01 Jun 2023 02:16:21.4090 (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: 7BFVPNrLG8CzLS9nul12DZJNoG2iYcCQ9SE7n86r2D2lCdT52GiMSUMq+0rzJnFgKIRcXnJhcejxshBaIilbaw== X-MS-Exchange-Transport-CrossTenantHeadersStamped: SJ0PR10MB4687 X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.254,Aquarius:18.0.957,Hydra:6.0.573,FMLib:17.11.176.26 definitions=2023-05-31_18,2023-05-31_03,2023-05-22_02 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 suspectscore=0 adultscore=0 spamscore=0 phishscore=0 malwarescore=0 mlxlogscore=999 mlxscore=0 bulkscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2304280000 definitions=main-2306010016 X-Proofpoint-GUID: aDNZbnOv52S6_uTnPGkmds4wTCBOHyi9 X-Proofpoint-ORIG-GUID: aDNZbnOv52S6_uTnPGkmds4wTCBOHyi9 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_H5,RCVD_IN_MSPIKE_WL,SPF_HELO_NONE,SPF_NONE, T_SCC_BODY_TEXT_LINE 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: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1767464910969160272?= X-GMAIL-MSGID: =?utf-8?q?1767464910969160272?= Signed-off-by: Liam R. Howlett --- lib/test_maple_tree.c | 36 ++++++++++++++++++++++++++++++++++++ 1 file changed, 36 insertions(+) diff --git a/lib/test_maple_tree.c b/lib/test_maple_tree.c index 3dbf99c3f2b1..15d7b7bce7d6 100644 --- a/lib/test_maple_tree.c +++ b/lib/test_maple_tree.c @@ -45,6 +45,7 @@ atomic_t maple_tree_tests_passed; /* #define BENCH_MT_FOR_EACH */ /* #define BENCH_FORK */ /* #define BENCH_MAS_FOR_EACH */ +/* #define BENCH_MAS_PREV */ #ifdef __KERNEL__ #define mt_set_non_kernel(x) do {} while (0) @@ -1735,7 +1736,35 @@ static noinline void __init bench_mas_for_each(struct maple_tree *mt) } #endif +#if defined(BENCH_MAS_PREV) +static noinline void __init bench_mas_prev(struct maple_tree *mt) +{ + int i, count = 1000000; + unsigned long max = 2500; + void *entry; + MA_STATE(mas, mt, 0, 0); + + for (i = 0; i < max; i += 5) { + int gap = 4; + if (i % 30 == 0) + gap = 3; + mtree_store_range(mt, i, i + gap, xa_mk_value(i), GFP_KERNEL); + } + rcu_read_lock(); + for (i = 0; i < count; i++) { + unsigned long j = 2495; + + mas_set(&mas, ULONG_MAX); + while ((entry = mas_prev(&mas, 0)) != NULL) { + MT_BUG_ON(mt, entry != xa_mk_value(j)); + j -= 5; + } + } + rcu_read_unlock(); + +} +#endif /* check_forking - simulate the kernel forking sequence with the tree. */ static noinline void __init check_forking(struct maple_tree *mt) { @@ -3468,6 +3497,13 @@ static int __init maple_tree_seed(void) mtree_destroy(&tree); goto skip; #endif +#if defined(BENCH_MAS_PREV) +#define BENCH + mt_init_flags(&tree, MT_FLAGS_ALLOC_RANGE); + bench_mas_prev(&tree); + mtree_destroy(&tree); + goto skip; +#endif mt_init_flags(&tree, MT_FLAGS_ALLOC_RANGE); check_iteration(&tree); From patchwork Thu Jun 1 02:15:54 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Liam R. Howlett" X-Patchwork-Id: 101645 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:994d:0:b0:3d9:f83d:47d9 with SMTP id k13csp5199vqr; Wed, 31 May 2023 19:18:12 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ7J2a8j0SXESUYVjMyPUs7dtjKueMBJq2JsZsQK2stbrrJz+VaKbGqih+XJt+AX15VBdIJ0 X-Received: by 2002:a17:902:e80b:b0:1b0:3cda:635b with SMTP id u11-20020a170902e80b00b001b03cda635bmr8679306plg.0.1685585892619; Wed, 31 May 2023 19:18:12 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1685585892; cv=pass; d=google.com; s=arc-20160816; b=PRGvCgjrAq8U/+GuvCAx6kdmC7v1Xbwcmmuqwhqf8A4RbVKp9N9BSyXDTBed/pHoA7 ZuN4CHTzx3NJCE/Rxsmp3HO1DxIrCcEPFuA2IPqHu/zt5dqObVUFGDqPFugDOOejjEt5 9ge32Gacjh2qRqM6cHJkaPt/owcP3NoxwFatRzUuC021gOc273qvOmQjR6I1I+XDmKGY 6uYbt9D2t0EOSGBVSYYwzabXWr7VJj1l/sYrgyh4wnHAGdre0FWoOhjsYkD39dQovu9D 88laht1tMcmZ6C0fRPejD1NsFiSpMbkyGVXnKcgIRWe4TOjw3z4rfEDp4G4HKX3IOMdu cYIQ== 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 :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature:dkim-signature; bh=j9omlzefsXQ1zzAnkg/pmDvba27GUm7hHo77v9ASBEM=; b=FzuqZisVmuhvGJX37MaHr6aDnWlYkxrUKuXok/SetsJ3/1R05l9O4U05LaOhl8Z52t YVP0M9ndyxEzywd69/aBW7wgnwYh3zzgmbKKMYBY+/w1cqGf877Z9g5OCOcfClUJS22Q KOHIi+qiiDjbWM5CAt91DbKHJM8/LfIwzqLunEL/1mqGQCD6boX1S3BAag28O/LqWsTa 43TU85lMVvH2H7Eh5XVfipo9Yjryq7tOY2+ED43eQsQzUKuORuGziACJrfzAYZtQSUha ZMdOWLvWFWMgqB5jqGlVzvGtD86wBkgzA8PC1xUwQ3uoy/VzlTaN3XtJPf+/RTx+pfJ0 1+UQ== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@oracle.com header.s=corp-2023-03-30 header.b=iFuOmajn; dkim=pass header.i=@oracle.onmicrosoft.com header.s=selector2-oracle-onmicrosoft-com header.b=kvUiye00; 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 x21-20020a17090300d500b001b186709e7asi1550062plc.40.2023.05.31.19.18.01; Wed, 31 May 2023 19:18:12 -0700 (PDT) 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-2023-03-30 header.b=iFuOmajn; dkim=pass header.i=@oracle.onmicrosoft.com header.s=selector2-oracle-onmicrosoft-com header.b=kvUiye00; 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 S230515AbjFACQz (ORCPT + 99 others); Wed, 31 May 2023 22:16:55 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:50894 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230465AbjFACQo (ORCPT ); Wed, 31 May 2023 22:16:44 -0400 Received: from mx0b-00069f02.pphosted.com (mx0b-00069f02.pphosted.com [205.220.177.32]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 2AC5F19B for ; Wed, 31 May 2023 19:16:40 -0700 (PDT) Received: from pps.filterd (m0246632.ppops.net [127.0.0.1]) by mx0b-00069f02.pphosted.com (8.17.1.19/8.17.1.19) with ESMTP id 34VKT4XJ016257; Thu, 1 Jun 2023 02:16:32 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-03-30; bh=j9omlzefsXQ1zzAnkg/pmDvba27GUm7hHo77v9ASBEM=; b=iFuOmajnv8UAboeRSWaci9Eo2kjzOvaz2Sz4LG6DuKfD4ZY9gGLIyWjFXJu5mrGiLZD5 BWmZwXsS5HT4kQ+1F96Imovst6p7YUCh1oeHb5C2lJ0sP1NRRdS/zfZhjZg7A1n39Vaj QJwPg/ue7Nan5LbHpIHvmaLGlikRj5Pqzx1CLoC1PcsWkkcdHuLjXSFkf2g4TgT97RLN vt8EBR53myCm0lJG7DG5MIrt/UIjUjxjCWq3zOKYhfEs76nevTsDE2NYFy7IpA3ZYJYz bUgzjeagjuHh11/ywmV1+o7B2snPWVk98EsK1Cwcx4Y8KgMXkRqIT0baoVyhm+0VpdTR 2w== Received: from phxpaimrmta01.imrmtpd1.prodappphxaev1.oraclevcn.com (phxpaimrmta01.appoci.oracle.com [138.1.114.2]) by mx0b-00069f02.pphosted.com (PPS) with ESMTPS id 3qvhmeqhq7-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Thu, 01 Jun 2023 02:16:32 +0000 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 3510E5Va014631; Thu, 1 Jun 2023 02:16:31 GMT Received: from nam10-dm6-obe.outbound.protection.outlook.com (mail-dm6nam10lp2101.outbound.protection.outlook.com [104.47.58.101]) by phxpaimrmta01.imrmtpd1.prodappphxaev1.oraclevcn.com (PPS) with ESMTPS id 3qu8a6gr6q-3 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Thu, 01 Jun 2023 02:16:31 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=Flhyh8DVZw1ZNx/tZxrfnWXWATcY5o0IpeaXiGYCAUXn+83hDe8FbGG/jCeqwgQnlbfAVgwTnYoALL0BUemn/uVTixOy5A9nvhQ8r6nd6G8JOLRUMHcTqPghenACLpLUIzhzDxHhPxPTvt2l4IYx0B80aaYWQwac+78xj1clEvD/hz/XfsGCtrlV+24ENIzzae3e4ohsHH+NA+OS3CuNiSVyN6eID7JwNLgTWqWVegnoxffDNy58ELhCXL7eM149QgVtsXndfGm41FefcBxmFINPvihhMSoBpaa7mqtICnJ/j4GHFhLdXbkMnOGMdLig8RPGKl+XE5g4c9h38gB//A== 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=j9omlzefsXQ1zzAnkg/pmDvba27GUm7hHo77v9ASBEM=; b=UkPSl9ztEo06ediUcQ4ydn1no43AEf041rltmLZQDe16SWohItL7+YZ4fN1/yZVZ41w72JGxRBzpbT0p/2mujMTY3VEYX6Ff6Lis20tSwPvBjCICcGVjDzNaSTHT1lM0zW51Wr9ZvaNbtqxijSzyHGjpa6eMSGBuMbugkGcnz7Zjrs+e2Q/CGEqouKdHRbWfhfp0Ehazhi/defH1NLg03JUjJocIPWgnnxV+KvuRxoWHz3lCBclSpZvkkH+P1n15A0GXy3JZFjI8uFLNahSMvhgzKhR8mLIwKZhO5toR8lOb9eLnJWG06L5hKqP0V5w0oBidjxsaOrzImxQ1QjEJdQ== 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=j9omlzefsXQ1zzAnkg/pmDvba27GUm7hHo77v9ASBEM=; b=kvUiye00mchYg6HGEyWp8IbS0LJjadR3UYOwcRqz5S68gpk9XB/V0t7Cf5qtFwx4tU5xkO8+iZlojOwyNPsVSaKJhREKtXyb7Fk8TplGI+zQb2vdLR4DfZWOBdt9rqnFjogZRlkHJ5NBx+kF9U+7qRjtKCuH5/pgO3k9kHgL2Dk= Received: from SN6PR10MB3022.namprd10.prod.outlook.com (2603:10b6:805:d8::25) by SJ0PR10MB4687.namprd10.prod.outlook.com (2603:10b6:a03:2d8::12) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6455.23; Thu, 1 Jun 2023 02:16:23 +0000 Received: from SN6PR10MB3022.namprd10.prod.outlook.com ([fe80::998f:d221:5fb6:c67d]) by SN6PR10MB3022.namprd10.prod.outlook.com ([fe80::998f:d221:5fb6:c67d%7]) with mapi id 15.20.6433.024; Thu, 1 Jun 2023 02:16:23 +0000 From: "Liam R. Howlett" To: Andrew Morton Cc: maple-tree@lists.infradead.org, linux-mm@kvack.org, linux-kernel@vger.kernel.org, "Liam R. Howlett" Subject: [PATCH 03/14] mm: Move unmap_vmas() declaration to internal header Date: Wed, 31 May 2023 22:15:54 -0400 Message-Id: <20230601021605.2823123-4-Liam.Howlett@oracle.com> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20230601021605.2823123-1-Liam.Howlett@oracle.com> References: <20230601021605.2823123-1-Liam.Howlett@oracle.com> X-ClientProxiedBy: YT4P288CA0068.CANP288.PROD.OUTLOOK.COM (2603:10b6:b01:d2::26) To SN6PR10MB3022.namprd10.prod.outlook.com (2603:10b6:805:d8::25) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: SN6PR10MB3022:EE_|SJ0PR10MB4687:EE_ X-MS-Office365-Filtering-Correlation-Id: ddbb63d8-de62-454d-526d-08db62463281 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: zqPQ0tYTmE8/vRftZYnh5oWsmLBdtSf/+ee1LWiy0xZiQcy0keAkaGFzTxfno0lbkLrNORUdyw1Oq19kcpgwtVfMpmXIU6hspD5do9Trd4B4j6E21hjgQagdvOije8OJJV6Y/4zWpVPI2ls8vduK/mRFlpeqVf/7vRbfuq7Jt6n7S6aYVnQO4yPVUmKmKOW1i1OkSg4+krk3hsjfJv1Bj/yAX4G9j0L+FyJeTwj0qM/ltKqa//Nd5wIvobOwUhBqe1HFqAFBSqzi3frwe0LPYfrnCNPpfqOp1QwH7MtRECHBRi9dloav7Mc3Zu3QkPZxZvTUj254FSBrhPLPMcb4NJhd9ZorGmFJHWSb3tViWQ53jRdXiC0mR/gFBkepKYkN/+gEmtWtuLycSl4xLoRFeV8xjcbMXXUtETsjmPnVMPPbdIyd4LrZyig7mk8F9F9N1sIGe7T50Ia8/eRw1bzrdCYsrH36gNm9MG6jY8Yg0Z300zQ5oSNgIP+ClHXXdtq+KnGS33iGmxEEd2Ml9qByEl1PHv1xIecHWzjiEI4BcWFeFu8k9AAd8L572DIYWv4H 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:(13230028)(396003)(39860400002)(136003)(346002)(376002)(366004)(451199021)(36756003)(38100700002)(86362001)(8936002)(8676002)(41300700001)(107886003)(5660300002)(26005)(1076003)(6506007)(6512007)(2906002)(186003)(2616005)(83380400001)(6666004)(6486002)(66556008)(66476007)(66946007)(316002)(478600001)(6916009)(4326008);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: koyd5joR1jD71wAomel3Y9GMH/HID5GfLW4pvHUVouuT80yzCqc5+2HcgOZUCXR3p6a9PinhcX2FV/9I7pugvTNNWtn9zWKR3ODkyKMeKTeqULJTSw9bnCG0gic7V5N7Hxrr8Qjh0z1Mx8//nMDEbQJOkRs88+D/Em9XLKDRrRttiWGf7Fmvjg2yPK/zt9rrsQTFaZdhtXZuJrbsMaWRwSnAWehDlHo5RQZ+nE3pCCW5pTVuqXMgn1KUJ9OebGOVkin6rBlaxD3aTlr0Wclrovfijgu/DLwP7x4lU9Sw5m8LffMHIrZkbuPMjreCrGASrtCZND9fkppeSDAsAat7aoUGRsc0iFp4J5ir1ZmN5nZ1MgVp8KjskJXF/tAO2dtQ1Pg03PRzu/7OFknMJH6+ES4O2d0hNaDePa6HEzcrLFJHbnS5x0+GjKDBtqfOUJ8vMdm9BaLgkrLBRMX/2TpNjKf0fyhji1iBX/RBNv7uakrpVKunuL/seqv/vmAONg+iBSQomzijxcy04D7IfqabuKgVIIqOrHMqFCbPAt1+JQ/JZKTtjX0I1KUafR/9qIapE4ZjGHBQ3kEnCYPG9AjuLnBVECPl2kGm5rwxpskNYsZW64uA/CNjt69Z0fXdcWwJCGRd/12DTzWyB11pB9A4jGhOXRx4G8OEV1th3MjyBXecASpTgoHqrNF+o6cGUA9AZjh12INffugKSWACvIY8g54dq+FOl9t1aouDpym2cNGXjW7JOUBCYuw9DbaHuu3XbkfwrK2sEcmmNK7VSQMTEmr+Od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VDq4nfs7n7nsMi9dS0d6NDG3YYZCSPDgXFZXArA+WA1cEWfn+6CoKcVpWpVdNdNzPI4CFffOUSr5sTxy0abWltQBQfw2BLXSvMu43sYx0uCOCybzahQwHG72unDru8aMqgs+53PlWpVsipNoZC8A6zVarMTlLjs4+d8fv8VxDNA+0A4F1oS9erKNO9x6tXiMBGIVmhDuPNmUs1sfVOV1hMa0Itfh55LExt6bGRBXSLDAQeQejqKy6+pdYyfuFhWgOtFfFJDCUmDBL9liHaI959ofW6ihYxM8YaHHdxcx6GNvgaCOSTR6rVJKOmGHm7rPd5sItWO4wix9BfVQDmGgFCeylpdvhJ5iNEvmBs/xbb0nrxQm1oMfGxEklMYrJ4HKtYxVsOnEBvXBSJgdBSvJIpBnAMr6cojSD26IgwbLVyiBCzmgLBSmjDGcEp9M9Ej02MODm6APptAdXyUdbdnWUQfdDPlpdpizBR+qj02ArY8vLyu4PnrQTLEba9KUOT2dK2RVbs4356D8GQ0E+yKJSNFwGo9Ismgrf9JBOPKw9E2rQUY4U/k90PCY3PO77Wn+pxSi9G5uG/coBKHlWTVeW4gXu+Kg4xBuALejeA1e2JXTrd/1HTLwTbPaId6Vs4hqQ69z+HEUr47YKojvEmX34pfB+c9fpbIMh9ztDiywUHQduC1vE2Y7T3U5Po6x2Hx1BCYo5pBemrLH1ZTQIxkI91AB6DlO6SXaw== X-OriginatorOrg: oracle.com X-MS-Exchange-CrossTenant-Network-Message-Id: ddbb63d8-de62-454d-526d-08db62463281 X-MS-Exchange-CrossTenant-AuthSource: SN6PR10MB3022.namprd10.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 01 Jun 2023 02:16:23.8566 (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: rkbdyKui1AnP+WK98Qw+louorvWjy/clSfyXH0W6H9zpa/bY3Px00aEFrPjh2sD6zasiJxxqpfo8GezQ9EslZw== X-MS-Exchange-Transport-CrossTenantHeadersStamped: SJ0PR10MB4687 X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.254,Aquarius:18.0.957,Hydra:6.0.573,FMLib:17.11.176.26 definitions=2023-05-31_18,2023-05-31_03,2023-05-22_02 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 suspectscore=0 adultscore=0 spamscore=0 phishscore=0 malwarescore=0 mlxlogscore=999 mlxscore=0 bulkscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2304280000 definitions=main-2306010016 X-Proofpoint-ORIG-GUID: FVTkB-9gU_mKY0H02-5wKplNjgSiujYN X-Proofpoint-GUID: FVTkB-9gU_mKY0H02-5wKplNjgSiujYN 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_H5,RCVD_IN_MSPIKE_WL,SPF_HELO_NONE,SPF_NONE, T_SCC_BODY_TEXT_LINE 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: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1767464913049512209?= X-GMAIL-MSGID: =?utf-8?q?1767464913049512209?= unmap_vmas() is not used outside of the core mm code. Move the definition to mm/internal.h Signed-off-by: Liam R. Howlett --- include/linux/mm.h | 4 ---- mm/internal.h | 4 ++++ 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/include/linux/mm.h b/include/linux/mm.h index 66032f0d515c..209fe13dc8a2 100644 --- a/include/linux/mm.h +++ b/include/linux/mm.h @@ -2302,10 +2302,6 @@ static inline void zap_vma_pages(struct vm_area_struct *vma) zap_page_range_single(vma, vma->vm_start, vma->vm_end - vma->vm_start, NULL); } -void unmap_vmas(struct mmu_gather *tlb, struct maple_tree *mt, - struct vm_area_struct *start_vma, unsigned long start, - unsigned long end, bool mm_wr_locked); - struct mmu_notifier_range; void free_pgd_range(struct mmu_gather *tlb, unsigned long addr, diff --git a/mm/internal.h b/mm/internal.h index f45f5eb4514f..9b665c4e5fc0 100644 --- a/mm/internal.h +++ b/mm/internal.h @@ -1099,6 +1099,10 @@ static inline int vma_iter_store_gfp(struct vma_iterator *vmi, return 0; } +void unmap_vmas(struct mmu_gather *tlb, struct maple_tree *mt, + struct vm_area_struct *vma, unsigned long start_addr, + unsigned long end_addr, bool mm_wr_locked); + /* * VMA lock generalization */ From patchwork Thu Jun 1 02:15:55 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Liam R. Howlett" X-Patchwork-Id: 101651 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:994d:0:b0:3d9:f83d:47d9 with SMTP id k13csp6660vqr; Wed, 31 May 2023 19:26:15 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ6i3MW3XDeZWNf2Gg0fOfp0kt6v2sHucVVeWyr6BZn3KWmouVmAaMNWLARacBT1htajQOZs X-Received: by 2002:a17:90a:e602:b0:23f:81c0:eadd with SMTP id j2-20020a17090ae60200b0023f81c0eaddmr7459022pjy.47.1685586375195; Wed, 31 May 2023 19:26:15 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1685586375; cv=pass; d=google.com; s=arc-20160816; b=St062ocHtMV6jG8J7xV1GHKolxjTkAAjjr6hGNZjflWRyOSNzp8AU0XkGCi+CPYBFX V7vzKNxpywXYsQJhZ8mNFQM0YeF4lHoOyBpnppru561jBcq7+jPyYUjvDF1S3SrjzO3v juh9+k2hZaQsIxNQJD7DP4NNJHJeWGL9Ap/Cy918pNJnSC+jdtyA26phB6OskPRLX7hQ 38ZeghbrtTM8MuppfCdUkdh2c1SzLO2RR9WmVwrDWmGGvgjBdLQAxtgcAuFF00tcVc7W 0APbZGHBJM7icvToFpOQ7eCwopnMkhCmz1zBiaxduxav4cYDmRduPCGedmJxL8/jBgqf McmQ== 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 :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature:dkim-signature; bh=pESqsIiJAkTxZZ5yDpeG3vcCyyDMibUrXt5NMbaAT4g=; b=QyE7oamWOAzkFcwLF+VoSQUteGzS7nlGtsx1vTKyxL/KXy56B/27cPRPq+G+5tFXhL qhZshWr0TjNATeuDu57OUS6Q0MH+ZHqfo6Fv1Jpmf3kJ9hGRpoS6is2WA3sstW5PhdhE U2DVW7WbwdPiccOi9fUnQ+csqCfTRjv05cGywMJMW2NV5QrbeP62ItuIbwol6hiZOK0G PSMpVCcCeMij6uC297izlmofm0SArSUcQmk6czAiI1y6sT/eH1UV5XSDwLLYhkZDItKL 7nFK2rSLMBz8y/yVbJykmihwK2VOOxmC/UdWdjlZLPcI0eW/2FdS5Kafnznq/C67/1zg YEXA== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@oracle.com header.s=corp-2023-03-30 header.b=E6BhjPIO; dkim=pass header.i=@oracle.onmicrosoft.com header.s=selector2-oracle-onmicrosoft-com header.b=OhoYky6F; 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 o3-20020a17090a4e8300b0023def94be5esi359379pjh.20.2023.05.31.19.26.00; Wed, 31 May 2023 19:26:15 -0700 (PDT) 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-2023-03-30 header.b=E6BhjPIO; dkim=pass header.i=@oracle.onmicrosoft.com header.s=selector2-oracle-onmicrosoft-com header.b=OhoYky6F; 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 S231134AbjFACRC (ORCPT + 99 others); Wed, 31 May 2023 22:17:02 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:50902 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230492AbjFACQq (ORCPT ); Wed, 31 May 2023 22:16:46 -0400 Received: from mx0a-00069f02.pphosted.com (mx0a-00069f02.pphosted.com [205.220.165.32]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 52A051A5 for ; Wed, 31 May 2023 19:16:41 -0700 (PDT) Received: from pps.filterd (m0333521.ppops.net [127.0.0.1]) by mx0b-00069f02.pphosted.com (8.17.1.19/8.17.1.19) with ESMTP id 34VKlVlo020034; Thu, 1 Jun 2023 02:16:33 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-03-30; bh=pESqsIiJAkTxZZ5yDpeG3vcCyyDMibUrXt5NMbaAT4g=; b=E6BhjPIO/S52ZpP5QOBZsk3QqpmDjwOPnwba3bUCyVk9JE8INVr7Bh/UQyW7DBLte3Z1 NpF8TgDjok9DP31pSeOCmAkt9AJ+8bHuIpIdGRBUi+rdcpNaahl18yqmNzEV/ksGfJ6y 20RfWQbaZNXxokNqNZBAmwB75snl9TkYd9hslQPmOHhzSLzDkIGlX9GCkDL0u329oKGE 6uKdtIiCzK2eMiaOTXqfuZDtbh0ovDTIDhx2PVYCgzFOzeDwbiwQGly5vrvTKZYkQ4d+ 5haRQBBua8THc3elTMiPDAwGvaHnhPh6coykmtACzsYdAJ4IXC51JipD9AADNVrIlpPW 3A== Received: from phxpaimrmta01.imrmtpd1.prodappphxaev1.oraclevcn.com (phxpaimrmta01.appoci.oracle.com [138.1.114.2]) by mx0b-00069f02.pphosted.com (PPS) with ESMTPS id 3qvhjh7hb2-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Thu, 01 Jun 2023 02:16:33 +0000 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 3510E5Vb014631; Thu, 1 Jun 2023 02:16:32 GMT Received: from nam10-dm6-obe.outbound.protection.outlook.com (mail-dm6nam10lp2101.outbound.protection.outlook.com [104.47.58.101]) by phxpaimrmta01.imrmtpd1.prodappphxaev1.oraclevcn.com (PPS) with ESMTPS id 3qu8a6gr6q-4 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Thu, 01 Jun 2023 02:16:32 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=f/rckNNAjZCW8/Ozm1KFrsqqqeZBWwAJ9vlLx2AhM9p9gVEgWVd70iseFoZZVW47kFhbmz9LmksLvAOT9V8j6P/wR3tGEOXZZM45EEtYN6VcArBybQoUmeMzGTkIC5rNyYvb118dfTJTtNxu8ghk/ZU6zRQsSR+/eXeODeq+xWW6yFWdsememiHEOnVUtXq3QPyEB6qtthu9aZuc3agwvQ1d7Xt381xFsMBGhACjgCsCo1rlkSZceNIW8dpIWIcCdIJGXgJ9ooRO8sLjIRQFhoYv+FilRsj5CS0x9gedOmM/mlGl8Jxs6+6iQ1ZaxyI3zWbQag+mBaCEwJltld7Tmw== 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=pESqsIiJAkTxZZ5yDpeG3vcCyyDMibUrXt5NMbaAT4g=; b=VTz75tMEQtgIrN53BUmSTu7NiUiJpreFTo68QmbgStogd0eHvwOOo0MMHOYl3SgHV9SeK1hsu6gIm26uKquFM37/HXu+aXCFG7mgVrJq3RYsd7LIOHKowG888bhcb8LWDUaKTLx1ORc8JI6UVcr8g3ZUOTfUV0SLglojPMJ2biTXUtFC7psAwbtZWZTMfA8Kq72YSRMC+fyzWaRebXLoomECO7D1cCGrrYffmT6EMT2mXsEN0mARXWdiU8X/3OOj1KqxULfg8wdRFum2Iuyqha3JxJt2yQbDSKfpL4FKqEAVtyNmiVJVWZpx9v9hNhTpOsrf+EhfLoYrUVgTjiRudg== 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=pESqsIiJAkTxZZ5yDpeG3vcCyyDMibUrXt5NMbaAT4g=; b=OhoYky6FLr6OEPE34CoNgbswyDceet+N9pp3EWkh2+keQrXdBAS7eAQM9Ytb82lTNh48J5cifL9Nugrk70NP5fg5DldavKuQlKGHZQV4MjFf6gwQkjb6L7DpfhdPN0xuGZ562zfkuYdMow2iTaFjQzV+qyFPTVAqBjMWRI0PhO0= Received: from SN6PR10MB3022.namprd10.prod.outlook.com (2603:10b6:805:d8::25) by SJ0PR10MB4687.namprd10.prod.outlook.com (2603:10b6:a03:2d8::12) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6455.23; Thu, 1 Jun 2023 02:16:26 +0000 Received: from SN6PR10MB3022.namprd10.prod.outlook.com ([fe80::998f:d221:5fb6:c67d]) by SN6PR10MB3022.namprd10.prod.outlook.com ([fe80::998f:d221:5fb6:c67d%7]) with mapi id 15.20.6433.024; Thu, 1 Jun 2023 02:16:26 +0000 From: "Liam R. Howlett" To: Andrew Morton Cc: maple-tree@lists.infradead.org, linux-mm@kvack.org, linux-kernel@vger.kernel.org, "Liam R. Howlett" Subject: [PATCH 04/14] mm: Change do_vmi_align_munmap() side tree index Date: Wed, 31 May 2023 22:15:55 -0400 Message-Id: <20230601021605.2823123-5-Liam.Howlett@oracle.com> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20230601021605.2823123-1-Liam.Howlett@oracle.com> References: <20230601021605.2823123-1-Liam.Howlett@oracle.com> X-ClientProxiedBy: YT4P288CA0061.CANP288.PROD.OUTLOOK.COM (2603:10b6:b01:d2::15) To SN6PR10MB3022.namprd10.prod.outlook.com (2603:10b6:805:d8::25) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: SN6PR10MB3022:EE_|SJ0PR10MB4687:EE_ X-MS-Office365-Filtering-Correlation-Id: 4a223105-c74a-4d83-ed1e-08db624633e6 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: x9j2OQW3mjLaA0VUNpIU6UDdMuyGcNfJsS17oTA3iB/Aa2csKBeNValMxclOoQpjMxp4S4nxu4wu9k4XtBmBHe34VgPC+pPko35BEL5LecnsJPEIvQODFX/ft20YmrJSO5KkwRP/Vq4SJtYF5h+hPEvT6849u4RS8zuDtlUQ5sGTkTh6o1a3JwJABHKJ4AOyR+im92YPa807qohsA42BcAGFifysREPmOU2vUoGf7gX1ne/Qzkdy/N7kt2AXG9two1jVVI1xgei1plEsIw4KuMctwNJCTzDOiJ3IxsGb8b1puaFHQfde4EKm5sJFAPKQv/aKatGcXXkTOPVk2duztVX6K/kju3sFo8BkdcCrlk/7RGH56T33cGf03VRMvKuJWkfPAuLaaeyeC71ET3nKrlL3EaPNLT+VpXPJbp8ltDfcxy933ikqOTYOzzh9i7AqSRVFeuIvcAgpvD/spY6PRQPNU1tn6iRPRExCVx+v8ihyVc0LezR5ISVcx6FPKd3FyhUx+qSAgIwn5LMxamUc6+vNcZPpQOgdh2z3uguoK4rjbvWNBELtNb6in2vsH8SU 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:(13230028)(396003)(39860400002)(136003)(346002)(376002)(366004)(451199021)(36756003)(38100700002)(86362001)(8936002)(8676002)(41300700001)(107886003)(5660300002)(26005)(1076003)(6506007)(6512007)(2906002)(186003)(2616005)(83380400001)(6666004)(6486002)(66556008)(66476007)(66946007)(316002)(478600001)(6916009)(4326008);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: omc8ROJsA/MNNS8Uk00fT8LR7/9syPwoxqcoL5D1QhGJ+NeXHGGdF0HLTpsXQ/vPEZFabxAdqJurf/Ppf/qVtxttBFpz30kxDd/u0oAv/uK9gnGUMq6fHO3/VAloI3hQhp/Y4E4hc73yMbeCBOXoUNSqtXD+4JjeTZNrNfhPEDEj/1Jv6XhYzI+OCyYdqD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G1jT+h+EZFV50j4XR4kkOmBhgY1mB9kkyDyJe0kY0CnQURkN/UmdxHAAHregKYA+ZtJJOtPD7Y+7CWUITI1wFVGfBa+dEIfe5ctcjv/8oocDtbzBb981frvWCzvn/cU/A6EVBx7+vlMu5JEk9So6JjeBrZ3qPmUeoTWi/C8yqUhL0B3NEI6pxOUhqVAFxQzJT4Mr0Xmti0k3Hgk8hi5fcMvT3ByKyDKUwBltWnY/Jw6DaSWqGB1fg2RdcQ7sOsDv14lkv0PWw== X-OriginatorOrg: oracle.com X-MS-Exchange-CrossTenant-Network-Message-Id: 4a223105-c74a-4d83-ed1e-08db624633e6 X-MS-Exchange-CrossTenant-AuthSource: SN6PR10MB3022.namprd10.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 01 Jun 2023 02:16:26.2677 (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: jGka2kKz8cM1j/OTtuTC2hTS05k8CdsSOqvYFGg+WlK0gFPgxU5aTWS3atwsS/cloMIatT1Xght2RFT4uv9dyA== X-MS-Exchange-Transport-CrossTenantHeadersStamped: SJ0PR10MB4687 X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.254,Aquarius:18.0.957,Hydra:6.0.573,FMLib:17.11.176.26 definitions=2023-05-31_18,2023-05-31_03,2023-05-22_02 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 suspectscore=0 adultscore=0 spamscore=0 phishscore=0 malwarescore=0 mlxlogscore=999 mlxscore=0 bulkscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2304280000 definitions=main-2306010016 X-Proofpoint-GUID: 3GXuOFaYAgYbKSG7Mw3u7w936KSpvCTP X-Proofpoint-ORIG-GUID: 3GXuOFaYAgYbKSG7Mw3u7w936KSpvCTP 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_H5,RCVD_IN_MSPIKE_WL,SPF_HELO_NONE,SPF_NONE, T_SCC_BODY_TEXT_LINE 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: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1767465419354312090?= X-GMAIL-MSGID: =?utf-8?q?1767465419354312090?= The majority of the calls to munmap a VMA is for a single vma. The maple tree is able to store a single entry at 0, with a size of 1 as a pointer and avoid any allocations. Change do_vmi_align_munmap() to store the VMAs being munmap()'ed into a tree indexed by the count. This will leverage the ability to store the first entry without a node allocation. Storing the entries into a tree by the count and not the vma start and end means changing the functions which iterate over the entries. Update unmap_vmas() and free_pgtables() to take a maple state and a tree end address to support this functionality. Passing through the same maple state to unmap_vmas() and free_pgtables() means the state needs to be reset between calls. This happens in the static unmap_region() and exit_mmap(). Signed-off-by: Liam R. Howlett --- mm/internal.h | 8 ++++---- mm/memory.c | 16 +++++++--------- mm/mmap.c | 41 ++++++++++++++++++++++++----------------- 3 files changed, 35 insertions(+), 30 deletions(-) diff --git a/mm/internal.h b/mm/internal.h index 9b665c4e5fc0..24437f11d3c2 100644 --- a/mm/internal.h +++ b/mm/internal.h @@ -103,7 +103,7 @@ bool __folio_end_writeback(struct folio *folio); void deactivate_file_folio(struct folio *folio); void folio_activate(struct folio *folio); -void free_pgtables(struct mmu_gather *tlb, struct maple_tree *mt, +void free_pgtables(struct mmu_gather *tlb, struct ma_state *mas, struct vm_area_struct *start_vma, unsigned long floor, unsigned long ceiling, bool mm_wr_locked); void pmd_install(struct mm_struct *mm, pmd_t *pmd, pgtable_t *pte); @@ -1099,9 +1099,9 @@ static inline int vma_iter_store_gfp(struct vma_iterator *vmi, return 0; } -void unmap_vmas(struct mmu_gather *tlb, struct maple_tree *mt, - struct vm_area_struct *vma, unsigned long start_addr, - unsigned long end_addr, bool mm_wr_locked); +void unmap_vmas(struct mmu_gather *tlb, struct ma_state *mas, + struct vm_area_struct *start_vma, unsigned long start, + unsigned long end, unsigned long tree_end, bool mm_wr_locked); /* * VMA lock generalization diff --git a/mm/memory.c b/mm/memory.c index 8358f3b853f2..6737263e17e3 100644 --- a/mm/memory.c +++ b/mm/memory.c @@ -360,12 +360,10 @@ void free_pgd_range(struct mmu_gather *tlb, } while (pgd++, addr = next, addr != end); } -void free_pgtables(struct mmu_gather *tlb, struct maple_tree *mt, +void free_pgtables(struct mmu_gather *tlb, struct ma_state *mas, struct vm_area_struct *vma, unsigned long floor, unsigned long ceiling, bool mm_wr_locked) { - MA_STATE(mas, mt, vma->vm_end, vma->vm_end); - do { unsigned long addr = vma->vm_start; struct vm_area_struct *next; @@ -374,7 +372,7 @@ void free_pgtables(struct mmu_gather *tlb, struct maple_tree *mt, * Note: USER_PGTABLES_CEILING may be passed as ceiling and may * be 0. This will underflow and is okay. */ - next = mas_find(&mas, ceiling - 1); + next = mas_find(mas, ceiling - 1); /* * Hide vma from rmap and truncate_pagecache before freeing @@ -395,7 +393,7 @@ void free_pgtables(struct mmu_gather *tlb, struct maple_tree *mt, while (next && next->vm_start <= vma->vm_end + PMD_SIZE && !is_vm_hugetlb_page(next)) { vma = next; - next = mas_find(&mas, ceiling - 1); + next = mas_find(mas, ceiling - 1); if (mm_wr_locked) vma_start_write(vma); unlink_anon_vmas(vma); @@ -1700,9 +1698,10 @@ static void unmap_single_vma(struct mmu_gather *tlb, * ensure that any thus-far unmapped pages are flushed before unmap_vmas() * drops the lock and schedules. */ -void unmap_vmas(struct mmu_gather *tlb, struct maple_tree *mt, +void unmap_vmas(struct mmu_gather *tlb, struct ma_state *mas, struct vm_area_struct *vma, unsigned long start_addr, - unsigned long end_addr, bool mm_wr_locked) + unsigned long end_addr, unsigned long tree_end, + bool mm_wr_locked) { struct mmu_notifier_range range; struct zap_details details = { @@ -1710,7 +1709,6 @@ void unmap_vmas(struct mmu_gather *tlb, struct maple_tree *mt, /* Careful - we need to zap private pages too! */ .even_cows = true, }; - MA_STATE(mas, mt, vma->vm_end, vma->vm_end); mmu_notifier_range_init(&range, MMU_NOTIFY_UNMAP, 0, vma->vm_mm, start_addr, end_addr); @@ -1718,7 +1716,7 @@ void unmap_vmas(struct mmu_gather *tlb, struct maple_tree *mt, do { unmap_single_vma(tlb, vma, start_addr, end_addr, &details, mm_wr_locked); - } while ((vma = mas_find(&mas, end_addr - 1)) != NULL); + } while ((vma = mas_find(mas, tree_end - 1)) != NULL); mmu_notifier_invalidate_range_end(&range); } diff --git a/mm/mmap.c b/mm/mmap.c index 1503a7bdb192..8e5563668b18 100644 --- a/mm/mmap.c +++ b/mm/mmap.c @@ -76,10 +76,10 @@ int mmap_rnd_compat_bits __read_mostly = CONFIG_ARCH_MMAP_RND_COMPAT_BITS; static bool ignore_rlimit_data; core_param(ignore_rlimit_data, ignore_rlimit_data, bool, 0644); -static void unmap_region(struct mm_struct *mm, struct maple_tree *mt, +static void unmap_region(struct mm_struct *mm, struct ma_state *mas, struct vm_area_struct *vma, struct vm_area_struct *prev, struct vm_area_struct *next, unsigned long start, - unsigned long end, bool mm_wr_locked); + unsigned long end, unsigned long tree_end, bool mm_wr_locked); static pgprot_t vm_pgprot_modify(pgprot_t oldprot, unsigned long vm_flags) { @@ -2221,18 +2221,20 @@ static inline void remove_mt(struct mm_struct *mm, struct ma_state *mas) * * Called with the mm semaphore held. */ -static void unmap_region(struct mm_struct *mm, struct maple_tree *mt, +static void unmap_region(struct mm_struct *mm, struct ma_state *mas, struct vm_area_struct *vma, struct vm_area_struct *prev, - struct vm_area_struct *next, - unsigned long start, unsigned long end, bool mm_wr_locked) + struct vm_area_struct *next, unsigned long start, + unsigned long end, unsigned long tree_end, bool mm_wr_locked) { struct mmu_gather tlb; + unsigned long mt_start = mas->index; lru_add_drain(); tlb_gather_mmu(&tlb, mm); update_hiwater_rss(mm); - unmap_vmas(&tlb, mt, vma, start, end, mm_wr_locked); - free_pgtables(&tlb, mt, vma, prev ? prev->vm_end : FIRST_USER_ADDRESS, + unmap_vmas(&tlb, mas, vma, start, end, tree_end, mm_wr_locked); + mas_set(mas, mt_start); + free_pgtables(&tlb, mas, vma, prev ? prev->vm_end : FIRST_USER_ADDRESS, next ? next->vm_start : USER_PGTABLES_CEILING, mm_wr_locked); tlb_finish_mmu(&tlb); @@ -2338,7 +2340,6 @@ static inline int munmap_sidetree(struct vm_area_struct *vma, struct ma_state *mas_detach) { vma_start_write(vma); - mas_set_range(mas_detach, vma->vm_start, vma->vm_end - 1); if (mas_store_gfp(mas_detach, vma, GFP_KERNEL)) return -ENOMEM; @@ -2415,6 +2416,7 @@ do_vmi_align_munmap(struct vma_iterator *vmi, struct vm_area_struct *vma, if (error) goto end_split_failed; } + mas_set(&mas_detach, count); error = munmap_sidetree(next, &mas_detach); if (error) goto munmap_sidetree_failed; @@ -2450,17 +2452,17 @@ do_vmi_align_munmap(struct vma_iterator *vmi, struct vm_area_struct *vma, #if defined(CONFIG_DEBUG_VM_MAPLE_TREE) /* Make sure no VMAs are about to be lost. */ { - MA_STATE(test, &mt_detach, start, end - 1); + MA_STATE(test, &mt_detach, 0, 0); struct vm_area_struct *vma_mas, *vma_test; int test_count = 0; vma_iter_set(vmi, start); rcu_read_lock(); - vma_test = mas_find(&test, end - 1); + vma_test = mas_find(&test, count - 1); for_each_vma_range(*vmi, vma_mas, end) { BUG_ON(vma_mas != vma_test); test_count++; - vma_test = mas_next(&test, end - 1); + vma_test = mas_next(&test, count - 1); } rcu_read_unlock(); BUG_ON(count != test_count); @@ -2490,9 +2492,11 @@ do_vmi_align_munmap(struct vma_iterator *vmi, struct vm_area_struct *vma, * We can free page tables without write-locking mmap_lock because VMAs * were isolated before we downgraded mmap_lock. */ - unmap_region(mm, &mt_detach, vma, prev, next, start, end, !downgrade); + mas_set(&mas_detach, 1); + unmap_region(mm, &mas_detach, vma, prev, next, start, end, count, + !downgrade); /* Statistics and freeing VMAs */ - mas_set(&mas_detach, start); + mas_set(&mas_detach, 0); remove_mt(mm, &mas_detach); __mt_destroy(&mt_detach); @@ -2800,9 +2804,10 @@ unsigned long mmap_region(struct file *file, unsigned long addr, fput(vma->vm_file); vma->vm_file = NULL; + vma_iter_set(&vmi, 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, true); + unmap_region(mm, &vmi.mas, vma, prev, next, vma->vm_start, + vma->vm_end, vma->vm_end, true); } if (file && (vm_flags & VM_SHARED)) mapping_unmap_writable(file->f_mapping); @@ -3131,7 +3136,7 @@ void exit_mmap(struct mm_struct *mm) tlb_gather_mmu_fullmm(&tlb, mm); /* update_hiwater_rss(mm) here? but nobody should be looking */ /* Use ULONG_MAX here to ensure all VMAs in the mm are unmapped */ - unmap_vmas(&tlb, &mm->mm_mt, vma, 0, ULONG_MAX, false); + unmap_vmas(&tlb, &mas, vma, 0, ULONG_MAX, ULONG_MAX, false); mmap_read_unlock(mm); /* @@ -3141,7 +3146,8 @@ void exit_mmap(struct mm_struct *mm) set_bit(MMF_OOM_SKIP, &mm->flags); mmap_write_lock(mm); mt_clear_in_rcu(&mm->mm_mt); - free_pgtables(&tlb, &mm->mm_mt, vma, FIRST_USER_ADDRESS, + mas_set(&mas, vma->vm_end); + free_pgtables(&tlb, &mas, vma, FIRST_USER_ADDRESS, USER_PGTABLES_CEILING, true); tlb_finish_mmu(&tlb); @@ -3150,6 +3156,7 @@ void exit_mmap(struct mm_struct *mm) * enabled, without holding any MM locks besides the unreachable * mmap_write_lock. */ + mas_set(&mas, vma->vm_end); do { if (vma->vm_flags & VM_ACCOUNT) nr_accounted += vma_pages(vma); From patchwork Thu Jun 1 02:15:56 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Liam R. Howlett" X-Patchwork-Id: 101650 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:994d:0:b0:3d9:f83d:47d9 with SMTP id k13csp6659vqr; Wed, 31 May 2023 19:26:14 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ5O5NIl7g94cFNYNhsReCknQt7hPoboJa5oW/LBlX0MjSZR+kXp+cD8HeKnu3pvBNqIT8Bm X-Received: by 2002:a81:5357:0:b0:561:c5c3:9d79 with SMTP id h84-20020a815357000000b00561c5c39d79mr8557056ywb.45.1685586374327; Wed, 31 May 2023 19:26:14 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1685586374; cv=pass; d=google.com; s=arc-20160816; b=pWgOb2m/FBHXgeomz6sXMcp6SckJM1yUrMAM1lX3VMO0Gc1lgW+ZQN3UovJEy6uXY5 5p2Tp0w7bYuq5t4Gdstx2ibA/jiHfxITBUHgkZxciO/qEOw5FNL54CVHDkbmPoNERFEo XdxLvOuLtXbJnf5thwyZTEYOHNQwcJiO2owg2XJRKTW+mSztWqltvsx1EVawFrQ1deDj 6uuzjZaSxkPqzoQWvv0TUFauv0Ym1ZFfPoYV98GdwGqhOxuyaUXafQh1JCVP47s5olje iy7WNQP6wua2Oa5Zdp73H+uNFTxm5kDF0P/7wRWgUeyzTSkvL6ypqBoU2MipdtBg7RbW NxWg== 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 :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature:dkim-signature; bh=0xbWsBeaPIGtK6mfcigFaEI5C+wIlDGWBRAKirJxgb4=; b=hidnn4/7a11WHNRIouY5tqmhBFT7IvV7Pz1eAPu1oQEnTsCAXUoEJsTI3exZqut1sI hV+BrXxDFIZicBXvuyvw7Qh9DVq7cJ3609OMmXEhESMSx3m3vs987Amnj/N2Tp+ACXV9 PgB7i8gjo/httTukUyJ6v6mEEggaA1oYS0x/qS21WVXodhXFvt1A1Cl/S0DA1NkdNg/N gfaJlmoldU0WFgyemZafvvjOgTFieGsTqU91hXmQ+WTde0oqojFl8OhlIsnnVRimB49k GVeinTa9GRDMEP+HCKxj3uI5uw7mvnNVjDPF1Va5m8oHFLvl/n9yvqDNLzata7swwTkK xQVA== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@oracle.com header.s=corp-2023-03-30 header.b=aYYPoy71; dkim=pass header.i=@oracle.onmicrosoft.com header.s=selector2-oracle-onmicrosoft-com header.b="aayX/QjQ"; 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 o26-20020aa7979a000000b006434a04f2fcsi4455188pfp.297.2023.05.31.19.25.59; Wed, 31 May 2023 19:26:14 -0700 (PDT) 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-2023-03-30 header.b=aYYPoy71; dkim=pass header.i=@oracle.onmicrosoft.com header.s=selector2-oracle-onmicrosoft-com header.b="aayX/QjQ"; 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 S230526AbjFACQ6 (ORCPT + 99 others); Wed, 31 May 2023 22:16:58 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:50900 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230474AbjFACQo (ORCPT ); Wed, 31 May 2023 22:16:44 -0400 Received: from mx0a-00069f02.pphosted.com (mx0a-00069f02.pphosted.com [205.220.165.32]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 8C7DE19D for ; Wed, 31 May 2023 19:16:40 -0700 (PDT) Received: from pps.filterd (m0333521.ppops.net [127.0.0.1]) by mx0b-00069f02.pphosted.com (8.17.1.19/8.17.1.19) with ESMTP id 34VKBH38020019; Thu, 1 Jun 2023 02:16:33 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-03-30; bh=0xbWsBeaPIGtK6mfcigFaEI5C+wIlDGWBRAKirJxgb4=; b=aYYPoy71jl3rkQ+hBf4FHxUvrSdjM7HLzqw5TkemWedw8yduX7VHPxL6aNAgwEzbMuoC ySeYkXaCvjgU6pHLx6N5WZPEgJdhHFiAYwioV8sIFWJhe+8WVnvIa2+AloCpw6LwkVJx Bpol2tjZAm/x4tWDgcYs6JyBTljAZwL8QLGemig9yCxzQqEi2ec24tO2Z9xCIXfGDQT4 9CVmEySRindttbPg7RDncDWk7LpOueYJOA8NQme2Tu1Gym9SJ8pn4jomp5dfgmVLCvEj 0IT/6gpUtGYY2rJDVeeyimMq3MeMD64NV49uLgUbjUwpaqFAuJBKKLtcAY9xKehwf7bX Fg== Received: from phxpaimrmta01.imrmtpd1.prodappphxaev1.oraclevcn.com (phxpaimrmta01.appoci.oracle.com [138.1.114.2]) by mx0b-00069f02.pphosted.com (PPS) with ESMTPS id 3qvhjh7hb1-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Thu, 01 Jun 2023 02:16:33 +0000 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 3510E5Vc014631; Thu, 1 Jun 2023 02:16:32 GMT Received: from nam10-dm6-obe.outbound.protection.outlook.com (mail-dm6nam10lp2101.outbound.protection.outlook.com [104.47.58.101]) by phxpaimrmta01.imrmtpd1.prodappphxaev1.oraclevcn.com (PPS) with ESMTPS id 3qu8a6gr6q-5 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Thu, 01 Jun 2023 02:16:32 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=GTE91UXFdpS6Ao6bVRNUSDn8gs7sQUFJpIM3Frl5LM+0QQVX13DwnggFNrx6MytO49MCJbN6+vznc288eiF/Trnsp+rRgumk2X6FURuPqt7WrQBS1zAEkrnzBi8Bq8DS72r2sWsLdzXp+KO92EGGlmShXdK6nIpdgP0uanbQlS3gy7fs+WNFOD2KVMBzYT55dBHteHb1odqGartY67yaYOuMlDWmq/21uJZ3yMon1m2C55dv7O4TmkLWfUg9ZGDpssJOQRiGcAdP2gOQK+ZA6zs1h5lMpaG+GQx01zI1kbVWD6K7yDYlVCqWgColltvOKcNxLY8gY86o4z2N0fsLUg== 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=0xbWsBeaPIGtK6mfcigFaEI5C+wIlDGWBRAKirJxgb4=; b=h5G7BCer7T800vn1TsHcHsaq823NUyJUz3GMHfp1lCN6U6aPvKryF1l+YsYqgkKJZdMuT68iJlMx+eBeQCoEE3WanqgbbJWXaA7P1cIrlH3H2BoDqOvlDPHg97betsvUYCQoPI4h4cQmX4DTkNo5VPJbd+McEEuADAwXW1XMNzsmHB/mUulRVuy3+7O7ZOhmeyBp4YSDGsUOwliehHJYRdQnM921BcVDYyr7p/h9h3N/q0+btBpAngRX7z5e4Feg0ib/3zLk02yo57c1/2sCeu2t/ZMJPyVosspr4qFlkmhZeJqhLS4CcBYT89wZPQ7Kx9IGk1NPWqPaSloUxjJWkg== 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=0xbWsBeaPIGtK6mfcigFaEI5C+wIlDGWBRAKirJxgb4=; b=aayX/QjQZWeGt/cq7QwUqu++773E9u+rihJgzzX9vfYE9fxKKOT4aMwVEz0rWt0T26nqYa4AT3Cna7IrHlG9ExAytIWNuGqtxZUDaBl/T4n7nHcfEpSJO3MfWXhcc/xVt8VcKHk+YfnPtdjcQIJ79Vigcd4/U59ub440a5sMNg0= Received: from SN6PR10MB3022.namprd10.prod.outlook.com (2603:10b6:805:d8::25) by SJ0PR10MB4687.namprd10.prod.outlook.com (2603:10b6:a03:2d8::12) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6455.23; Thu, 1 Jun 2023 02:16:29 +0000 Received: from SN6PR10MB3022.namprd10.prod.outlook.com ([fe80::998f:d221:5fb6:c67d]) by SN6PR10MB3022.namprd10.prod.outlook.com ([fe80::998f:d221:5fb6:c67d%7]) with mapi id 15.20.6433.024; Thu, 1 Jun 2023 02:16:29 +0000 From: "Liam R. Howlett" To: Andrew Morton Cc: maple-tree@lists.infradead.org, linux-mm@kvack.org, linux-kernel@vger.kernel.org, "Liam R. Howlett" Subject: [PATCH 05/14] mm: Remove prev check from do_vmi_align_munmap() Date: Wed, 31 May 2023 22:15:56 -0400 Message-Id: <20230601021605.2823123-6-Liam.Howlett@oracle.com> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20230601021605.2823123-1-Liam.Howlett@oracle.com> References: <20230601021605.2823123-1-Liam.Howlett@oracle.com> X-ClientProxiedBy: YT3PR01CA0084.CANPRD01.PROD.OUTLOOK.COM (2603:10b6:b01:84::8) To SN6PR10MB3022.namprd10.prod.outlook.com (2603:10b6:805:d8::25) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: SN6PR10MB3022:EE_|SJ0PR10MB4687:EE_ X-MS-Office365-Filtering-Correlation-Id: 3557919e-b46a-4179-2196-08db62463588 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: Xwk+yKWb4FbkJKarlqQvrSKzSRfyEWzrPysR2FaZUcL6ktaUXovbOXc27pjuU/U3rPk1yA12A/gl/8tUh6fkLzXqFjIoZDYOlziX82L3zxGM8SuKH6BD5C4pQhr1lvHue6b111nuvIF/7dF6ewwF7ezmbMY8X/Lc4pIkukISdrdxuETyZipgduC8xjO0yK5RByS+YY7/0HsMlWRbFVCdDHofpKxMr3v4m7jU/JNK9qEEpHgHRtrjoLtxug4wkZQb5nfNo6dft1qts8K2aNETjxBa+HOm49HyBd6I8O42zpjXb7xg8s8JdJ2a3kigKAZti0DGf0ZHIZgrAeVIXN4Sl9PpXSMSiM6An2nbeMzfDrYDQLT11DAEz0/+Guf/OD+gKEkENz1I68NBhfPKjKd25YC/rZsWJAU6v7Fqz96/Q9fdJ6qycnOBTfgEv7hTu1OTObqMGmi4hIyDXpX6DXMdshBh/ajiuib2pkYa53+B6tFHeQLCZSOY/pca5GNjlkJLlx73qUB238LOMNSSWqpTa3mWO77+U96PirEKfChJkRl7tC5fbQ2NsTxWAJJxu6rs 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:(13230028)(396003)(39860400002)(136003)(346002)(376002)(366004)(451199021)(36756003)(38100700002)(86362001)(8936002)(8676002)(41300700001)(107886003)(5660300002)(26005)(1076003)(6506007)(6512007)(4744005)(2906002)(186003)(2616005)(83380400001)(6666004)(6486002)(66556008)(66476007)(66946007)(316002)(478600001)(6916009)(4326008);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: eh5yV5gFOHKBexFeqXkSCc9jpeT7tWf8eVll3pNH6cZL3yIrR7TBSV68UP0ZN4if7QxDFrlippfAos4c9VFmqJw2+0v3AzJqxaXtfgbKUcLhaE0p1b6McXzsn8lje3EWsyk2I0uy9/k5LYz/wod8jeSe0IjYiUuuuQQ7RavUf/UncCol5MvksyrYMTc3Oyw0IBgtMacQRpw/nTChtlrtWOzob31vHIdPej5rRAb5h0be8O30FBXEkeBKfsXnnr8NGkGAcDkPwHzRakZOgUQRYWQM9wFSpUvEWy2I9Kcu7sR1OCB92328dBGbYT1+LRpzhGiOxnKVXeI//H/tNYNb3lH1rgZY+Uk2B/a0urPeGUeoH6K7nFrhevw/sSk1LMww7hlh8aBi6SRoY8jzEWKw/dAEzWvl/TeTUr0fYZTjjBv6z4+rdkP7aM/kxXNTrhan6p+fueVC0JUS+tTUGC4xhLrjGKFVCy/L57WLeGXqnKXrp8otAxAFump7XdAJFHtlZuFmh81blBD1mm9zhZ7Zd8sNMJt8o+9wI8GjyycGKjISNhl72GLT4jhikCmNcKLHnJjNNr+l0XzjPPO6qYbD/lD4wHiKvLXx8b+lOkRwk22NN7m77gMdZwYMR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sHTPUpSPx29ikvYpfnE2lqiTJxlRfFk8FDEEWx+DEm3TzMgDHsAcr5n6wXkloqtH+eyh3bFPjaUp0+bMI1v3hv26tcKv8SCM8GnTQoPLYDhrZVG51+E8QytkR6V2e/bgq7dnMrYTyilw6Pdvz2+H+aGnBfLJCTG+NvNiMfiN0eRvSVUAnWVRfaACOb7KhNoBASAv6b4wOQHHnh7abASlPwQYMd1WnjIi8VF3VqD9pnz5itP0pr9jqnKYoHXxGSlESe5rKwfeqopckBiFSKha84g717xefMcmwUZXJoXTU0bFErrbqs0yTzFIkKdAWiFS9UyTUy7s0/+0xN8AF5ftaxmpDzFxbTZScLi6+d+rb86BVHZOG9OQ9Lw46Xzd6wcox0wnhc0WsJi8LPZFJPe+BfMhSJYR2OXyyRlHCRlQ5pb7zQ5wGs/hhLGof0hEAXJ7sK55a6BLtcuIS7m6aKMaoQptOCKdZsqC/6XiZZO7acm18TYFD92WO/yJEIIYGuvjdnnPCLNaBtjAqmj/rQzAZ19JLeZOkPs8yjfq+F+McamBq4h3G7lx5vOsbVjwwuZUjTKfLKK1CaBUYgOWLj10wK8Lm03O7OmncoCvkLiAlXTOCFESz5ssyPJkVS8oOfpRi9Byp4Skihh3HuNEsZDuXWcSXwPKcR3mJu/FsrXQBE5Vkk0CN3rBf14YC0qH4JHP+O3EQ6vVHt/9s4k4UrccSVk/txFP+abXX9wJtGVYYXhXXN2Xkh6qhNoWWQKwMvNDLPn7AeWRjeEPVmJCeIW8HxsKYKTosowt1MnwS8CAPlF1cH4wwkl6/3Hvvy5pz+ZkO6nfkhljC4rS+/3FligiBBjcsItqqFRDDvJjuYI0dMnyrp08zCbWPRa8FxjikSR5dBTt0GkU/XzBuP+kQ== X-OriginatorOrg: oracle.com X-MS-Exchange-CrossTenant-Network-Message-Id: 3557919e-b46a-4179-2196-08db62463588 X-MS-Exchange-CrossTenant-AuthSource: SN6PR10MB3022.namprd10.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 01 Jun 2023 02:16:28.9566 (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: Onw/kGxGBwHwdxUxCWzHQPLAOKqmEzf1/L6f4d3CiaPLzxGAK7d+xU0mAeZQov3/MeS8qTCuZdYCkP644cI4BQ== X-MS-Exchange-Transport-CrossTenantHeadersStamped: SJ0PR10MB4687 X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.254,Aquarius:18.0.957,Hydra:6.0.573,FMLib:17.11.176.26 definitions=2023-05-31_18,2023-05-31_03,2023-05-22_02 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 suspectscore=0 adultscore=0 spamscore=0 phishscore=0 malwarescore=0 mlxlogscore=999 mlxscore=0 bulkscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2304280000 definitions=main-2306010016 X-Proofpoint-GUID: k-KmwOXQGCkhC9tsrmjO1TemiYXr_d9K X-Proofpoint-ORIG-GUID: k-KmwOXQGCkhC9tsrmjO1TemiYXr_d9K 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_H5,RCVD_IN_MSPIKE_WL,SPF_HELO_NONE,SPF_NONE, T_SCC_BODY_TEXT_LINE 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: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1767465418070255151?= X-GMAIL-MSGID: =?utf-8?q?1767465418070255151?= If the prev does not exist, the vma iterator will be set to MAS_NONE, which will be treated as a MAS_START when the mas_next or mas_find is used. In this case, the next caller will be the vma iterator, which uses mas_find() under the hood and will now do what the user expects. Signed-off-by: Liam R. Howlett --- mm/mmap.c | 2 -- 1 file changed, 2 deletions(-) diff --git a/mm/mmap.c b/mm/mmap.c index 8e5563668b18..fd3f505b40cc 100644 --- a/mm/mmap.c +++ b/mm/mmap.c @@ -2402,8 +2402,6 @@ do_vmi_align_munmap(struct vma_iterator *vmi, struct vm_area_struct *vma, } prev = vma_prev(vmi); - if (unlikely((!prev))) - vma_iter_set(vmi, start); /* * Detach a range of VMAs from the mm. Using next as a temp variable as From patchwork Thu Jun 1 02:15:57 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Liam R. Howlett" X-Patchwork-Id: 101642 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:994d:0:b0:3d9:f83d:47d9 with SMTP id k13csp5187vqr; Wed, 31 May 2023 19:18:07 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ5hpxW4ENWXKPXXB3etj7QgZDkfBLgC3ZZurPipbLIMJ4aYsCdDfTYKPIlvZ9O2vY2eMhZY X-Received: by 2002:a05:620a:2718:b0:75b:23a1:461 with SMTP id b24-20020a05620a271800b0075b23a10461mr8099466qkp.39.1685585886840; Wed, 31 May 2023 19:18:06 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1685585886; cv=pass; d=google.com; s=arc-20160816; b=xEFAjg0paqst/5EL9Mj+tyobh1MVLUTYvTWmz4TujtjdwR6hSA2SULyfU+TW6SQ75J zdkStqf0kJ0nJbrIzXhX3vGvXEYDbKIcJvWb8gRolNmglBan9u4HRWRLo40avSS3TlY7 npU2MRRQ3QRlwbEbeBC99uCyxIqdHXpQHWrQ9Z7AHXHu97nI4IcN9wWVf0Z2Z2ks3QoC 288uCxT4rRymZ45qtjU2Qkl1bzgn6o479TpCbruE8WDC6OqeI+7p1soODgwzCPjaXx9X cpns5AWWtApP/hVBHsTxWWJr0nbE0mq1Tp+SbuD4LncLtMahHbIuZ0e5WcdHYCOA/kv5 ZswQ== 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 :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature:dkim-signature; bh=1prjPOCurqnWH4L6WzWAHY38RL29aaMdFp7clnJuEH4=; b=tMN4H8asTN2YDDaMjfiSPyXyu28eTI/MFZNTc8a72QSZx+K72XTtx/51RzlxkOrbrK 6XsI7uh2G379tUUo9POxmx16u6WymkERgOo6431CX/f40mt1gyL9llDwH4ah0cpze9Qz Sb2BZ1PoZsVIBVdWFChSGd9AKePveU1OuejAuG8pWF5abS09ek/Ai4uW5MrwcSWYQA+2 axf/cIxZE15HHFSSlrzIuTgvP+7JCTQhM4RhOr8CCZZCneI4s3OkQyw/RYQoSIvoACLj j7bQ2t6EJNVQ9pPjOuC49bElBZwxnlxFYNwkjmSXN7fOeXe+ehL3+U8RRo1muOjXX/6G p9wg== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@oracle.com header.s=corp-2023-03-30 header.b=H1gLBfze; dkim=pass header.i=@oracle.onmicrosoft.com header.s=selector2-oracle-onmicrosoft-com header.b=roJFJtww; 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 z28-20020a63b91c000000b0051942a23eefsi2011939pge.533.2023.05.31.19.17.55; Wed, 31 May 2023 19:18:06 -0700 (PDT) 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-2023-03-30 header.b=H1gLBfze; dkim=pass header.i=@oracle.onmicrosoft.com header.s=selector2-oracle-onmicrosoft-com header.b=roJFJtww; 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 S229672AbjFACQp (ORCPT + 99 others); Wed, 31 May 2023 22:16:45 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:50896 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230471AbjFACQl (ORCPT ); Wed, 31 May 2023 22:16:41 -0400 Received: from mx0a-00069f02.pphosted.com (mx0a-00069f02.pphosted.com [205.220.165.32]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 153E6188 for ; Wed, 31 May 2023 19:16:37 -0700 (PDT) Received: from pps.filterd (m0246627.ppops.net [127.0.0.1]) by mx0b-00069f02.pphosted.com (8.17.1.19/8.17.1.19) with ESMTP id 34VJkDWo009444; Thu, 1 Jun 2023 02:16:34 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-03-30; bh=1prjPOCurqnWH4L6WzWAHY38RL29aaMdFp7clnJuEH4=; b=H1gLBfzet3/HjANoit9cpUcxCDUhY2O+KMNTgDR5zSEnO0pVQzr5TM5/vdI/IkdLE9FU 6KcdEzLYFznxRGZy/tHc9LhXMeG50xCu+fdBOX6rlRCDo7Hbota/OQbnE50O6U0fFSJp H8hkRw4lDRDcTBfAxSgz9luo/9EX9u/IHLrbN/x5HAi4L1AHomDBfRj8IWgfXeH4mwmK hThMpU+NFbPn81RlqIeibusg6V4KeNMZn+Fce9Cy7THQ7iMlcNzqRsn4w/3v8CCJ1ILc SVBhrU26e18STP5iL6mYv94A/+8NaFdwwoZT8OLE3NGoA97n4uJJRQ/zU/yRyc1SlDcP ng== Received: from phxpaimrmta01.imrmtpd1.prodappphxaev1.oraclevcn.com (phxpaimrmta01.appoci.oracle.com [138.1.114.2]) by mx0b-00069f02.pphosted.com (PPS) with ESMTPS id 3qvhjkqjr3-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Thu, 01 Jun 2023 02:16:33 +0000 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 3510E5Vd014631; Thu, 1 Jun 2023 02:16:33 GMT Received: from nam10-dm6-obe.outbound.protection.outlook.com (mail-dm6nam10lp2101.outbound.protection.outlook.com [104.47.58.101]) by phxpaimrmta01.imrmtpd1.prodappphxaev1.oraclevcn.com (PPS) with ESMTPS id 3qu8a6gr6q-6 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Thu, 01 Jun 2023 02:16:33 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=UY8EXKM22eahcHthmR+YXWlF4/pyi/yCdd2cq4X6gioNbDPZnDBejKdpIWFuJvDKw5eUwLBb+iPB+dcMom6o5z1OyWKwRbTVfykMbOorqy+OQBbKEEw6uYZaWNSEuJMJocvokDwkVp1oXFG4cMyixZ/s98bim9p6GsMFPfRXN/N+azl1JXeUAyGuWYHMKEzlyGmTv/0tezcEdsY/qhzpaBeCadcvZbE/rsqxKRCE0nf9yMeclkwtQPu2ce6YaapYEmWXUbVtKuBd7+3YwZT3Ryc9RyTLvRJShRw//oDMOTrrYtMwaZ/2UXfn1ZUfi3ph4m8fN7wu6QqJyXX/+764Lg== 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=1prjPOCurqnWH4L6WzWAHY38RL29aaMdFp7clnJuEH4=; b=daU4vgZHK5NDe9vEW6E6vPy1BXhcsUkHDDQ8im58Fz9WCWZdkU79maJ0vPj7lglCQe3LpckQ/n8ieQotUTWXaHK6bQEmDC0WEsLfvoWnrxFnjJzoL7fgxi4DW7HgOwLERYDYOAPbFwA8EuuhgQVuXklSs9B8zFhzV7dd3m26zMWF1/RNiMQu0dFbDATggiZOOHgGZvgU6XhgQy1gwIbGLrjLSJK4B+njVjX6prdiw5iICmfkFB6zNtboZfmn2S1QYr2EFc+TwIoV+kPn2qsVYdF3w0fNnEHpUSynSsQpumNj1e/+Hx2hZBzAJd27XEKy/g8SauvUcxcamgRHx6Lp2A== 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=1prjPOCurqnWH4L6WzWAHY38RL29aaMdFp7clnJuEH4=; b=roJFJtwwgLYLJEeFrgzoavIzsX2H6l0c9QgU7LOyw3rmxR0TrqRipLfrFh77+wWmUeUKopUXGvz7B+4w50F9rBDWYB3mHPFtiCv5B9VjqfmfV6OXo7KApVzY4eISwHINY1a6xoChdiDgcKqVlaT4oD8nkP6wQ3xLmUJCJlgiVOQ= Received: from SN6PR10MB3022.namprd10.prod.outlook.com (2603:10b6:805:d8::25) by SJ0PR10MB4687.namprd10.prod.outlook.com (2603:10b6:a03:2d8::12) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6455.23; Thu, 1 Jun 2023 02:16:31 +0000 Received: from SN6PR10MB3022.namprd10.prod.outlook.com ([fe80::998f:d221:5fb6:c67d]) by SN6PR10MB3022.namprd10.prod.outlook.com ([fe80::998f:d221:5fb6:c67d%7]) with mapi id 15.20.6433.024; Thu, 1 Jun 2023 02:16:31 +0000 From: "Liam R. Howlett" To: Andrew Morton Cc: maple-tree@lists.infradead.org, linux-mm@kvack.org, linux-kernel@vger.kernel.org, "Liam R. Howlett" Subject: [PATCH 06/14] maple_tree: Introduce __mas_set_range() Date: Wed, 31 May 2023 22:15:57 -0400 Message-Id: <20230601021605.2823123-7-Liam.Howlett@oracle.com> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20230601021605.2823123-1-Liam.Howlett@oracle.com> References: <20230601021605.2823123-1-Liam.Howlett@oracle.com> X-ClientProxiedBy: YT3PR01CA0078.CANPRD01.PROD.OUTLOOK.COM (2603:10b6:b01:84::9) To SN6PR10MB3022.namprd10.prod.outlook.com (2603:10b6:805:d8::25) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: SN6PR10MB3022:EE_|SJ0PR10MB4687:EE_ X-MS-Office365-Filtering-Correlation-Id: 782a978f-7a23-4a19-cecb-08db62463700 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: py0oU9qCVFh7z8SX+2hQ5A8fXOLsQOppAf2Mh8VNa9LImNv9HksWr4OKP+Om9q+6OABLpl/ANNv7sG1BxDdtsiXe/dV1acBE2C7uoOMYmcu6QwA4UJpZi1Eb0a1WNVn82DsWbVxD2BM4nvtR5lE52b8iPYV2e0tDUBC5V6/21mAp9XgfRZHlPkWksX4TMnz/282IweXxhrsPXPTOUuFuFh0kyC2vwtn3RX3IJ31nixDxXDvHRhfh1BVTD0iNTlaQ+YWxW9XT6wZy9KDsvVGT1u8jsL/ZaLnYqDZa52iXqDwhGKx37H2PGAF3dnyEVdJgik7l/tiNqcYK+pEh1GBY7tOk8B++PjcDu/3zAf4X1EpRH85MkMVFRvAtBSb/4sJU3DMHPex6mwl3XjhbjZMMYLPX5kBYpvdEv2+igBKeeS90uIpc0BGFCgZ3TYfOqc0vq9U6mZD+brTdfJoCKKZYTjpGQXsvoavngAtHjipKbD2+ld8gnrc/0baMWnV/HEsc12T0U1qQzHk3OWNn1QRQIA0aQhS+NWiBdH7uNXP5vGFQXijkDnxdJ1t73TfAkoVV 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:(13230028)(396003)(39860400002)(136003)(346002)(376002)(366004)(451199021)(36756003)(38100700002)(86362001)(8936002)(8676002)(41300700001)(107886003)(5660300002)(26005)(1076003)(6506007)(6512007)(2906002)(186003)(2616005)(83380400001)(6666004)(6486002)(66556008)(66476007)(66946007)(316002)(478600001)(6916009)(4326008);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: z7VBLwXiAs7THPPHUptWOkNagWQbYoqXfVQyVdndSfBn5np+qe3bG7oRE3QgrDlv0JQ1ZYQVVO1paxc+DdDtRPkliBWrXLVsXjmGu/cxVutYr2mYsWORtjK3rCqWTTHe38IjQdtTfmX6TFGey/xllh+VmJpeLmHDe67JdJFm6kXfnd4uL/QrNx1ZXm3O7pSWHbtjc5LsibTlukWZp8eOYO83uUwBrqf7S0+FRarStNlJC5G2K8oLOin0mM5QCylxtctUk/oN0AftPnmAU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vbd1H82+kwQcb3A9XStAUWgZBAH2SEAzhhHNX4nURQptwQMdLfOMbPq6jbDRjVSbGRRs+bgMsBnFIiumyx5ZE7875IP7or3JFkcz1xoXzBoqZUOBKZUbMh7ODjPzp3i5RjBBQcJHSTCdHxyr2T+nJ4Lc+EoKcf6POoCCa2/xEaSe5cWGEIXj8lPyAxuoiRRyxEtqz8/VA== X-OriginatorOrg: oracle.com X-MS-Exchange-CrossTenant-Network-Message-Id: 782a978f-7a23-4a19-cecb-08db62463700 X-MS-Exchange-CrossTenant-AuthSource: SN6PR10MB3022.namprd10.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 01 Jun 2023 02:16:31.4496 (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: ySJKx9n8d1cmi0zt1Zi1x6YaQBDboGnqrpN2D28BVB6Eff/hWmBcF1HMPW71irhJ0qEoCV3vYbBhHlirU6sK/A== X-MS-Exchange-Transport-CrossTenantHeadersStamped: SJ0PR10MB4687 X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.254,Aquarius:18.0.957,Hydra:6.0.573,FMLib:17.11.176.26 definitions=2023-05-31_18,2023-05-31_03,2023-05-22_02 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 suspectscore=0 adultscore=0 spamscore=0 phishscore=0 malwarescore=0 mlxlogscore=999 mlxscore=0 bulkscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2304280000 definitions=main-2306010016 X-Proofpoint-ORIG-GUID: GABSCyd5LAz6YkP_IBOwTFah-VR4goXr X-Proofpoint-GUID: GABSCyd5LAz6YkP_IBOwTFah-VR4goXr 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_H5,RCVD_IN_MSPIKE_WL,SPF_HELO_NONE,SPF_NONE, T_SCC_BODY_TEXT_LINE 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: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1767464906909800055?= X-GMAIL-MSGID: =?utf-8?q?1767464906909800055?= mas_set_range() resets the node to MAS_START, which will cause a re-walk of the tree to the range. This is unnecessary when the maple state is already at the correct location of the write. Add a function that only sets the range to avoid unnecessary re-walking of the tree. Signed-off-by: Liam R. Howlett --- include/linux/maple_tree.h | 21 ++++++++++++++++++--- 1 file changed, 18 insertions(+), 3 deletions(-) diff --git a/include/linux/maple_tree.h b/include/linux/maple_tree.h index 295548cca8b3..ed50d8f459e6 100644 --- a/include/linux/maple_tree.h +++ b/include/linux/maple_tree.h @@ -531,6 +531,22 @@ static inline void mas_reset(struct ma_state *mas) */ #define mas_for_each(__mas, __entry, __max) \ while (((__entry) = mas_find((__mas), (__max))) != NULL) +/** + * __mas_set_range() - Set up Maple Tree operation state to a sub-range of the + * current location. + * @mas: Maple Tree operation state. + * @start: New start of range in the Maple Tree. + * @last: New end of range in the Maple Tree. + * + * set the internal maple state values to a sub-range. + * Please use mas_set_range() if you do not know where you are in the tree. + */ +static inline void __mas_set_range(struct ma_state *mas, unsigned long start, + unsigned long last) +{ + mas->index = start; + mas->last = last; +} /** * mas_set_range() - Set up Maple Tree operation state for a different index. @@ -545,9 +561,8 @@ static inline void mas_reset(struct ma_state *mas) static inline void mas_set_range(struct ma_state *mas, unsigned long start, unsigned long last) { - mas->index = start; - mas->last = last; - mas->node = MAS_START; + __mas_set_range(mas, start, last); + mas->node = MAS_START; } /** From patchwork Thu Jun 1 02:15:58 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Liam R. Howlett" X-Patchwork-Id: 101649 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:994d:0:b0:3d9:f83d:47d9 with SMTP id k13csp6426vqr; Wed, 31 May 2023 19:24:57 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ4ZQcMj6oB2YxKiRNNs+GgXMOfelJs8m4OLhQhqlpUnTNofMD8uCs73E2HgnOJUKXsN0PDj X-Received: by 2002:a05:6870:343:b0:1a2:7432:c78d with SMTP id n3-20020a056870034300b001a27432c78dmr923805oaf.34.1685586297288; Wed, 31 May 2023 19:24:57 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1685586297; cv=pass; d=google.com; s=arc-20160816; b=kRFXuVKf/UwPiZS0xV6Pk2RI/oND+xREvEeU03aZKkpL+Ao1ch3O+DaO97AU5iegHw QOKvfdXtlaatRHEeH+FBo+Rc8tkYh4F771H6ACP4Ug4KYQE6scTaKhGIKuo+hExmfe+f Zc6A/ofK/CP7dKeLVHl2rULokcBXl81DtCcL+hH0K3aNvWRks5cQdhdmhunxezewqngD 2LKiBGQxLQ3f7gz8K2OsVtqjTPGSugU0v4ZraOKYNNhqxm0srnx+UhngG+wT9u7f3uwr uxTX44WyMxoFjX2sjFxuX8MGfj0Ugira4VMHD3nNr2s/prBHWg2VsDqDDIfu4RGbMfQb PaIQ== 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 :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature:dkim-signature; bh=0QsGUeSC8PoHDvjhcOgTqj5kZeGqMxkW78nbUd0JW7g=; b=RkU+25nhf+K+mdj/OCvyae7wsWCkc24Ddw55rP3OwitK6KZERRcdrOUCIZz/Tbv4q7 cP7s0XbEySq7/PwScNmF2gGQV3T+qqYGzD1TXB2/LdZgnuou5Ie13BCjaMC8GU/gOP5y +xn+85/Pm7NYMVSxQTb1OxinuJwh7FjFCD7yxmtL+/CkDo7V36rFc+EOx35ghECJAaCX zofa5Aql4goTX/kNo5dqSidq0l7W9yR0KMyVLgsWveWFDDiAsCxGrVyM03HKPipQRH6y afSIqlpe9LX4JBKFMaHpFA4hQIn4BOJG5JDej5/WiV7rv86iq+t11+NOzZz06sBGBpBt rszA== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@oracle.com header.s=corp-2023-03-30 header.b=q1UTECjx; dkim=pass header.i=@oracle.onmicrosoft.com header.s=selector2-oracle-onmicrosoft-com header.b=oRIKA1CM; 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 c19-20020a637253000000b00533ffeaca3dsi2075448pgn.40.2023.05.31.19.24.41; Wed, 31 May 2023 19:24:57 -0700 (PDT) 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-2023-03-30 header.b=q1UTECjx; dkim=pass header.i=@oracle.onmicrosoft.com header.s=selector2-oracle-onmicrosoft-com header.b=oRIKA1CM; 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 S230492AbjFACRE (ORCPT + 99 others); Wed, 31 May 2023 22:17:04 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:50902 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230499AbjFACQq (ORCPT ); Wed, 31 May 2023 22:16:46 -0400 Received: from mx0b-00069f02.pphosted.com (mx0b-00069f02.pphosted.com [205.220.177.32]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 3DDE3138 for ; Wed, 31 May 2023 19:16:44 -0700 (PDT) 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 34VKGtB7031560; Thu, 1 Jun 2023 02:16:37 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-03-30; bh=0QsGUeSC8PoHDvjhcOgTqj5kZeGqMxkW78nbUd0JW7g=; b=q1UTECjxTpcHTNNfj20XDQOUL47FyCdtDzR9+Znq8LhPilw2c5ER92UgPDJvlag42mWJ cugsR453y2QLfGBSb/shYH9/usZ5J4TU64rdjD4jv2n0Ystua4MFWwtD5su0JDF2EYz8 lHuC+ThdxNSewDwmola1jU7jsZi7WWwVtTGIR+ujm5DtTd9Fqfxu/D8D1OFnBYs7UzFN jEc5+BPYF/sNmAneDWDpic3zyHeHpFV4bLf0sVY6L9ZyBRETCyIAlFcHlzp36t4OA8dD RJNSWtZH9cMmhyieYsaBGkSPJAv6K7E+1/L7Z9RIqZdmy6i/195NxM4MD3MqgOY1PzoJ Zw== Received: from iadpaimrmta01.imrmtpd1.prodappiadaev1.oraclevcn.com (iadpaimrmta01.appoci.oracle.com [130.35.100.223]) by mx0b-00069f02.pphosted.com (PPS) with ESMTPS id 3qvhj4yhmd-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Thu, 01 Jun 2023 02:16:37 +0000 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 3510ZJ1N026039; Thu, 1 Jun 2023 02:16:36 GMT Received: from nam12-mw2-obe.outbound.protection.outlook.com (mail-mw2nam12lp2045.outbound.protection.outlook.com [104.47.66.45]) by iadpaimrmta01.imrmtpd1.prodappiadaev1.oraclevcn.com (PPS) with ESMTPS id 3qu8ad2bag-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Thu, 01 Jun 2023 02:16:36 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=gtfOR/3SoPycPBpwJaKWH1HMGYxRbigbLBMUaQOUlCx1a8svh1QMq8x3UjnVz1sepkjwNWAww45tYl0lFgwupKWCLE8/4VOz2b+rpRCckhpIHh3hfepze8ybKpRXqlOsiBiaZgDRYffDx5V1UrkXiYmqSFjjlP7a2s5NnSEkV0QHcJgjbWf6FXXk4GGnTYKNdHVyvT7JMUSR7MdPDk8IqIaB7m8BJGc8Ezng4IM57HgM3t7uRAEirtycn5y+wqW3gCvl1ClHXPavHj7Al5N12GvNo8ra/cDgcUtWaAlCcg8IrnpImqItzmH6/mO4jH0AOQ0hzQxqsh2/la666n/GEg== 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=0QsGUeSC8PoHDvjhcOgTqj5kZeGqMxkW78nbUd0JW7g=; b=G14Xt4pzt7qO7hO+cONdY1dKD7YaQywuI29O9ewZXQ7tPBUD8+38BcJ9PBe/SyRGRoe4C7Yf1KdXNb4xOG+fLHDDBhZcrmw6pRU3D1q1cKj0qUnzJiOCWS65eSUW5vSi8S4xc1B4C4GjvZwiKdKuDPouo4k5yfUtqXnuxehxQ/GfrrUwKQ4SIktZZKN+vdffQkKEnJC3+8k4z5PUpE6qMMBeht4bdmvOvymIdHyv0PrwgmwOHmUUPEpaOG6XjLIjpbHS7+dpb/G9jX5cVaqJxUgB2roc6GFk96NgA9lChrLQciBBJZRIDzjxfjtG1Xj1FV2ADXuhDJWIqRYotcvV7A== 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=0QsGUeSC8PoHDvjhcOgTqj5kZeGqMxkW78nbUd0JW7g=; b=oRIKA1CM4Bm8/wxk3z0Vn5DiM/u0nnOIfH9GVrlPSdZY4M+q9fAf2eVXdNT0gWIsWpifuTeIJcIFdMutg+mpAizqZInNHln1AESoggqZuhAxQVzasQmj/6d0Z2qQytvKnNU6nMIZ2H8hcdwzgSXpW8Ms/C5eIdr/zhvrGnxwdBU= Received: from SN6PR10MB3022.namprd10.prod.outlook.com (2603:10b6:805:d8::25) by SJ0PR10MB4687.namprd10.prod.outlook.com (2603:10b6:a03:2d8::12) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6455.23; Thu, 1 Jun 2023 02:16:33 +0000 Received: from SN6PR10MB3022.namprd10.prod.outlook.com ([fe80::998f:d221:5fb6:c67d]) by SN6PR10MB3022.namprd10.prod.outlook.com ([fe80::998f:d221:5fb6:c67d%7]) with mapi id 15.20.6433.024; Thu, 1 Jun 2023 02:16:33 +0000 From: "Liam R. Howlett" To: Andrew Morton Cc: maple-tree@lists.infradead.org, linux-mm@kvack.org, linux-kernel@vger.kernel.org, "Liam R. Howlett" Subject: [PATCH 07/14] mm: Remove re-walk from mmap_region() Date: Wed, 31 May 2023 22:15:58 -0400 Message-Id: <20230601021605.2823123-8-Liam.Howlett@oracle.com> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20230601021605.2823123-1-Liam.Howlett@oracle.com> References: <20230601021605.2823123-1-Liam.Howlett@oracle.com> X-ClientProxiedBy: YT3PR01CA0007.CANPRD01.PROD.OUTLOOK.COM (2603:10b6:b01:86::19) To SN6PR10MB3022.namprd10.prod.outlook.com (2603:10b6:805:d8::25) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: SN6PR10MB3022:EE_|SJ0PR10MB4687:EE_ X-MS-Office365-Filtering-Correlation-Id: 0592cebc-4244-4810-e025-08db6246385c X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: ns9EikDrQ/hEJISe0sqy+Y3EJ5EhRpOadFwATE7gkjGgix3cO5a3ymJBkJ7opWzzVg51g6TjNHUAVjQXy1TQ56Z8a556zUzBaESB55diit7XEbnrw09a+kCxuqjQl0yzWftqNQX/6MjJKuOF/pe1LJQDQsl7FCrnTP9sf+/MgpBAMk62NvepD3/FncEOrAtK6seaMEXqlGAYITDPAKUZao3IjXyiKtaJZAl0cQ4vPmR6l3/LzXbCaFYcEoUOAkhyoowhHQvZCcY/KILGhMyWUmKEt8A4z3CDT7KYeFFEjUtdzsJSpZWySIM7Uw8VhHZkSqDyffal7Bl2jOWu78qzS0GrK9LF4Atv/zmzyjqBxald3DtkWjvjaQwVxft3D4iJkpqpq2xW+jn60c16zPKXu6skVjrUOrba2GIkQoD3ZyCJqnRrygOId5C0T1WEYnUCZFyZN5dso20cxADBwgbj67Imiw9iB+VtoDULy4AszdeIRscFYYkYEyD5YOYxB8u5Sl7rgYMDg97etVZVJCrMz5DsucZwl3r4r/ccTz92Zdgi24HsGeuCYXejpJSkLeir 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:(13230028)(396003)(39860400002)(136003)(346002)(376002)(366004)(451199021)(36756003)(38100700002)(86362001)(8936002)(8676002)(41300700001)(107886003)(5660300002)(26005)(1076003)(6506007)(6512007)(2906002)(186003)(2616005)(83380400001)(6666004)(6486002)(66556008)(66476007)(66946007)(316002)(478600001)(6916009)(4326008);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: H4qLnThywqsPz0a/lHKsxCBbqfPmWYX4U4NPOjbaEoEyAsYdle3If8cLnOsEpfJMGwhTMkid6y335sTSYS0iZb92ToXCjH647Yr8NvBmVXCRmLzjx73vC2Zak13a/TgdgARRWQhOZzqJ+cqRvsQrgaJDHXYVRV+fJIQVZCe6RMoDDomT6zRSqLP9J21XMsbZVsdl4Hi7Q5e1b6Alq7ixswbWaJtxxOYHKoZfxf6BJNxzC2P7VpgGHRtZeIMhngOHtzDXIjnB0i76XlyEE68u3zRWjI7ZJs9uU6uw4+EyX3aWXsvZ8d25bjckqC73FKzK1hIAUVuMgq/kpQJ7vREbIy81ITd2zOhwXigZ1Ee1OmZd9pXUGHElxf7YP2xXnApQX81dp3Nvk3lZLoFQvHjIoiVWgkyZwLOgbAwNmM4+/aIw6HAh08AyzgLy1zi/1HAKS2+/4wSdGP/FNDCdkgBvT6NBljR2tTXiYnTqnoZwDVjfgi/zGZfmw5mLWiYnyhp20Ocu5+axsQo2n7NsvdpeUVLipEwLr9aOaoT/GVLbnptLfr255ip4Mzp09gUTUdWTXN561S5W0WZjy/jtLFNw1vKGXlTYndVlJ0A4c97pLfh8PVtGIOpamUMc3umoLPsVuB0XMyFfU8QBdDvlcujsg2rzZSQ2/wpFZHn8QzImM2RN8AJF2uL/2U279sBv5PmpslBwMY4Zeut/jTBFMCdmtL+hDTB43gof4C8YK6/l0alo/2ZqF1kdvL9gYIPzLkByFgZHK4kOplNSf8K/cscjfsgabhBSOybIT8ZeZHYbLACX3wU4aYB/I/YI2LE9LRoSBU0AYHfJWbU1r1ymjkOGn9AAH17jl6IFIRU9t+YQy5FJzu9xS57aJnWPD2r7zJoj/dF9cGmFuM/5TOHitcA4/dB9++QuIoRkq6rA1mhJfQeg3ez1wu+jbXot/dpiDEzWH5Z9YYXPRad6FiQXMYShHqkyQwQIEv2vyr+06pMykkB9JhCCGfgxhfYWZgXMTkGrROhtSq0B4WhN6p/3UZOLvzIjSjXmSEoZ/cSCejZq9KAJP7pqaN/3Ha1QcgyWKPNOoU5/dNSwR8M/O2HhehkX5F4AuLHxLqz9g7YKqB+jQs/X+nqUxsXz51Ihv25J+yhobj2KHY3CKgXAlvyWcx3oy1jzax4CflbJsgXBcLKRrOl3JL54e8I9Hr+z7/rW1n7P3JUaTlQO0+E6/UE1Y3uayttkoZJuvRSXCZGsoQzIQ27TjzBz270lwU6kn8EIECWT2uw6FJCDUZANbu/bM+Tn0p1nH2skMps+J4LMDTa57MuzFAAyvUxkgdIYGx6lBnjxQzc7zZeV91F4BAJNDsI0epgY20+ngupfZCI7SG88bYE06m7TpSyjb53qxiDo3GoMcsgF9CeHTmBgBuJesKYdWL83gVfbs0omPxV/LkPsi9uM0CswpdwCiogpghM0BXhdPo9WdGp0qKsHTXwD108QfAKVYzirRHadxchwENde2q2JSEFBlardKXSXSm6oZpIuXMjAXqOtK5CoZxY7N+chfVHqZXQCPlEe+tpuSSQmsLKCwByZx7b80WhoTbPTM3VopL10DJQwt+K5lwkHQQAunQ== X-MS-Exchange-AntiSpam-ExternalHop-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-ExternalHop-MessageData-0: OujIaRBqu1K12FvoCRBeHBdpQUUlpbrYcj8uc0e0XlyVEEZImqBOj0QTSAGbf1xivpka/aTc2J/C/QNixwQu0XCnjnYTw14eQuvBKCuTJZY3Vnxpx4y9TpfKe1RVWkOHE2nXXCQXz55KNu0EyYLOdjCZMl66Ox4wBQmRPs6dAaV1Fdrq1FQ9CVzJ4KvuKEtW0++6zphjgn/O2R9n+PugOR28Z/TWb5ZYDAj5Hvng6sWH3r3hj+NMEjhshegOJwMOTKFYdcDMAU3BhPecJ3CT2vOqO9zrOzv6dkHUvLv95/gOK3NIC6c6lg56LrW96WJoa2xfocNg4af+V0C47B9z8KboQmbHxa2+2pjqzn9ZLdyL05oa5lLgU8NGEy05qZlxgbokRwtJWQLs3Ljl1uPHQB3Jln14+O0eaOTC3nKBGR8cA6YoeHjla5g5/kPETtpEK6hgWLf1cs1pLEiTvALPZMIa+dHyyG0d7wmG/NiC4kPGMDv1JiYpIl2fUoASyuonYIFC3cx+DzBf/t6psrHMhCnnnDYBdQSeEdZlXkOOgjApOfMpzE5vf5wknC4cnzyftnLEv0I13ps4qKJDOfDW7br204wVnthzI7C0padAiGqNTB7JqQAU77Jbm2udKq2OQ3DJrxeFZEYNT+txbB5K3gwfhU8n9J8Z+DMWVgflIdANH6M4vNkYNAyJD9PEsSlFktGGXV5AOBrc6LPgL4XidEb59+X6xWM+nsrou3Yxn8SMf28vUBt4EKYAERCD1qH8B2ColR7eluuPR0QiHhePYLqIP0MVvIRCP8UMJPZrmAKEgvcybmaGfCTLYVvBXF4bj9acajEhgznh64pbGK5mJqVM8Rlc2ZEZbFsrNYEwdjj3DTDn3qUnAco9PUxXTlsm+NwedhdlX0R+msuTwH1OUQ== X-OriginatorOrg: oracle.com X-MS-Exchange-CrossTenant-Network-Message-Id: 0592cebc-4244-4810-e025-08db6246385c X-MS-Exchange-CrossTenant-AuthSource: SN6PR10MB3022.namprd10.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 01 Jun 2023 02:16:33.7293 (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: xrQwKeIv5O7X5/9OZYKhKYhCTgmoZbAuihctVVYkK3dUN0bfjiI2tA/ihqzM6WXFuzSx1JgYgyDAIMJiKdaFvw== X-MS-Exchange-Transport-CrossTenantHeadersStamped: SJ0PR10MB4687 X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.254,Aquarius:18.0.957,Hydra:6.0.573,FMLib:17.11.176.26 definitions=2023-05-31_18,2023-05-31_03,2023-05-22_02 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 suspectscore=0 phishscore=0 spamscore=0 adultscore=0 mlxlogscore=767 bulkscore=0 malwarescore=0 mlxscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2304280000 definitions=main-2306010016 X-Proofpoint-GUID: IbPd7lk4QHZ4jpsyW0oEDE1oZQaVBgxJ X-Proofpoint-ORIG-GUID: IbPd7lk4QHZ4jpsyW0oEDE1oZQaVBgxJ 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_H5,RCVD_IN_MSPIKE_WL,SPF_HELO_NONE,SPF_NONE, T_SCC_BODY_TEXT_LINE 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: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1767465337058123067?= X-GMAIL-MSGID: =?utf-8?q?1767465337058123067?= Using vma_iter_set() will reset the tree and cause a re-walk. Use vmi_iter_config() to set the write to a sub-set of the range. Change the file case to also use vmi_iter_config() so that the end is correctly set. Signed-off-by: Liam R. Howlett --- mm/internal.h | 8 ++++++++ mm/mmap.c | 4 ++-- 2 files changed, 10 insertions(+), 2 deletions(-) diff --git a/mm/internal.h b/mm/internal.h index 24437f11d3c2..cdf06f680d6e 100644 --- a/mm/internal.h +++ b/mm/internal.h @@ -1034,6 +1034,14 @@ static inline bool vma_soft_dirty_enabled(struct vm_area_struct *vma) return !(vma->vm_flags & VM_SOFTDIRTY); } +static inline void vma_iter_config(struct vma_iterator *vmi, + unsigned long index, unsigned long last) +{ + MAS_BUG_ON(&vmi->mas, vmi->mas.node != MAS_START && + (vmi->mas.index > index || vmi->mas.last < index)); + __mas_set_range(&vmi->mas, index, last - 1); +} + /* * VMA Iterator functions shared between nommu and mmap */ diff --git a/mm/mmap.c b/mm/mmap.c index fd3f505b40cc..8b3e58d6ac40 100644 --- a/mm/mmap.c +++ b/mm/mmap.c @@ -2659,7 +2659,7 @@ unsigned long mmap_region(struct file *file, unsigned long addr, goto unacct_error; } - vma_iter_set(&vmi, addr); + vma_iter_config(&vmi, addr, end); vma->vm_start = addr; vma->vm_end = end; vm_flags_init(vma, vm_flags); @@ -2686,7 +2686,7 @@ unsigned long mmap_region(struct file *file, unsigned long addr, if (WARN_ON((addr != vma->vm_start))) goto close_and_free_vma; - vma_iter_set(&vmi, addr); + vma_iter_config(&vmi, addr, end); /* * If vm_flags changed after call_mmap(), we should try merge * vma again as we may succeed this time. From patchwork Thu Jun 1 02:15:59 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Liam R. Howlett" X-Patchwork-Id: 101654 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:994d:0:b0:3d9:f83d:47d9 with SMTP id k13csp8982vqr; Wed, 31 May 2023 19:38:18 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ6I39DAcLgGYNohItGai2tfLwzbNs5WBs0vUH5ywyjjm+GOKS8jl1zvxO0dnQjBNrUHcKiK X-Received: by 2002:ac8:5bc2:0:b0:3f6:b918:2351 with SMTP id b2-20020ac85bc2000000b003f6b9182351mr9773175qtb.0.1685587098710; Wed, 31 May 2023 19:38:18 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1685587098; cv=pass; d=google.com; s=arc-20160816; b=f9GfkBuUffdcJ2RYWqWWnUvWHncVPFS0nC98OSdAtKf3tFByBmUMYopA4BDQX2xPpF vcSfRbbumBfxO5CkM3NfAcII9fun0BWrVvyDGpe2kYJwS6AjS0HTCP0ZVf4E6EWqHprw TdKjJPUDnRToa+pybTleYDseI+h7WvJko6vmk6EqAKOVZWOlnr1DcICfjI1PoUiSP0Me dJjKG3pksiZT5gpyQaYEVdBVsb8nRFerwebMFCEZ0aVi/XECVLM3i9eFuochVJfaaWgR c8PIb06pQc6ZIlf3tjVv2SlQXsRoWMiat+Mr3ScSYBQdgVv3ckpHkx9fQkj2ym6bR+E4 ckPg== 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 :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature:dkim-signature; bh=5QJYR8C6Oei1oSISVfXvwbAAhAE+CkJSWTpENeGDljY=; b=kNVkF8oPaWoeFI0UFaQp/00U40JbySMYVkn/woee1oTjQ2yWWaNBF2zzAoqUmek4b6 QhTdZsXpWZ25WMSWyJ+gh6BA3+KxIk27wNiX+YzKgxWrMt0f3KbLn4pk7lArFs3suZXj OqxFI5PvUIHFoYMHfHfa1anMLj+6t7hU3t6TfqOJo1ZSruZVi9bun9PTzwsLy3kd2SjU FRxaO3jELzgTna8pD+VC4s1Y/Z29KmUqQ/ipChOlxtJpaHAuOhpSKU5lv5gQ7vb/nDl4 buiDCI0ecgxqa5ip/KIf1Gqr+dSOhYgNKvbg5INjfd8w6lxg31z+cgRQlUAtrd6nh4TW IK/Q== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@oracle.com header.s=corp-2023-03-30 header.b=DNDJfCM4; dkim=pass header.i=@oracle.onmicrosoft.com header.s=selector2-oracle-onmicrosoft-com header.b=Bpf4l4Ov; 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 h9-20020a633849000000b0053ee9b21820si1996290pgn.72.2023.05.31.19.38.03; Wed, 31 May 2023 19:38:18 -0700 (PDT) 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-2023-03-30 header.b=DNDJfCM4; dkim=pass header.i=@oracle.onmicrosoft.com header.s=selector2-oracle-onmicrosoft-com header.b=Bpf4l4Ov; 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 S229783AbjFACRe (ORCPT + 99 others); Wed, 31 May 2023 22:17:34 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:51586 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231152AbjFACRO (ORCPT ); Wed, 31 May 2023 22:17:14 -0400 Received: from mx0a-00069f02.pphosted.com (mx0a-00069f02.pphosted.com [205.220.165.32]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 509DF1AB for ; Wed, 31 May 2023 19:16:52 -0700 (PDT) Received: from pps.filterd (m0246617.ppops.net [127.0.0.1]) by mx0b-00069f02.pphosted.com (8.17.1.19/8.17.1.19) with ESMTP id 34VKAx0q021961; Thu, 1 Jun 2023 02:16:44 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-03-30; bh=5QJYR8C6Oei1oSISVfXvwbAAhAE+CkJSWTpENeGDljY=; b=DNDJfCM4ONt3vjsCH8mkaDo8ADhZTOK1GOgvPZbhtsvpFj0ceWxAPAf3PX46p40AQ8M/ ZE6oT823T/eNbXlB2J8+hAU6lGjSFnmsa/6nMg+zt/CO3JIeYF02r8r185uhxzvPc2jF gqya1Yw7N1qBhhaQ45ZKXxaHvxvWm/01ruQzeDX7ULtel5zsTrbGoFod2o/bwgK2aC/i ZkhiEMfl3bw+Us7x+O7rq8PxmNxUoQZIyZ4bWY6KLelbc+n9ORXG4jxVbHm3fpFw3Csi EGNrKoL1qSGuwjAOzjmYZJdPlDXD9/eSptgGBULneSUuxpPFj8BFP+iIsWKwFGVOpsSX jQ== Received: from phxpaimrmta01.imrmtpd1.prodappphxaev1.oraclevcn.com (phxpaimrmta01.appoci.oracle.com [138.1.114.2]) by mx0b-00069f02.pphosted.com (PPS) with ESMTPS id 3qvhmjqja8-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Thu, 01 Jun 2023 02:16:44 +0000 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 3511YC8b014618; Thu, 1 Jun 2023 02:16:43 GMT Received: from nam12-mw2-obe.outbound.protection.outlook.com (mail-mw2nam12lp2040.outbound.protection.outlook.com [104.47.66.40]) by phxpaimrmta01.imrmtpd1.prodappphxaev1.oraclevcn.com (PPS) with ESMTPS id 3qu8a6grag-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Thu, 01 Jun 2023 02:16:43 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=YqDQqNr3n1MitCb7P5+EQwfbog+qnTSDsC1BZ5y3TXdloa5yG4X/oUx/SL0dy01d/Vjj9aYPQiSXBC5HUBOg1bhE4xqy0I7Cr3mQhvp3dBh5GwlLNiUzVTURF8259ku2/Ckwlxziaa0lRcuAWvaJhyJdwANCJuVVz98Ja8Yo9Ji86wW9t0qrzwhdPLWmcazbmfhrpS0+PuMRJSFLa2s81cf+ODHc3l7vi416gyv4zEc+chU26MeAqxe0UAmqWKYWyLxwF06DHii8YLPlcFMUJu0H/fFfFk0K1gO3+ub+vj09LcFQ/S6/nmdqnPuvnou1IhPa1BnPUWOokel5bRCb/w== 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=5QJYR8C6Oei1oSISVfXvwbAAhAE+CkJSWTpENeGDljY=; b=SXKjPBnU+z2V5GD7wUMkUFJZMWveGsTmRIzypDGnMDYXSTULLRCcLzwXsvTa4dP29EDjgnje8IHg3Ii1vP9HARlghc5wybVSdYZmweR9qsIhgozSeerBllBAhhzT07k7ujKfK2GiGaQXbhYxy45DdEV1quNjI9eJYMwMB7z8iLCKiQ34k8InSvGXemME8oNdYDqbJMsT8TvjJv9jmO/LmxvWIoZof9vaKJsHEBEPtdPFRNdikffdZHUUwlrHYwSA70YJ9fcYuRuCyakNdDMDFh4g7KgKpXBu3x3I88HL2dU4Dy4zgpjiD+flEIHjO7STakzPIh5yg6gtfaSY5ij20Q== 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=5QJYR8C6Oei1oSISVfXvwbAAhAE+CkJSWTpENeGDljY=; b=Bpf4l4OvTDyp7bMZ5wvyNAA2a5Hsew/u6Dxf/s/rIKhX/gegHKNxSP6XourpnHW9bIQ7Xw5uo53boySCzPG4o1+DWNi6xhSClBmoAJTzJ5e24MPqkFJbghKKVSGREU4qwIH4veRi9f7ugoLhJ3WM66mrebmX2iAtSQdPUg5Uf3A= Received: from SN6PR10MB3022.namprd10.prod.outlook.com (2603:10b6:805:d8::25) by SJ0PR10MB4687.namprd10.prod.outlook.com (2603:10b6:a03:2d8::12) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6455.23; Thu, 1 Jun 2023 02:16:36 +0000 Received: from SN6PR10MB3022.namprd10.prod.outlook.com ([fe80::998f:d221:5fb6:c67d]) by SN6PR10MB3022.namprd10.prod.outlook.com ([fe80::998f:d221:5fb6:c67d%7]) with mapi id 15.20.6433.024; Thu, 1 Jun 2023 02:16:36 +0000 From: "Liam R. Howlett" To: Andrew Morton Cc: maple-tree@lists.infradead.org, linux-mm@kvack.org, linux-kernel@vger.kernel.org, "Liam R. Howlett" Subject: [PATCH 08/14] maple_tree: Re-introduce entry to mas_preallocate() arguments Date: Wed, 31 May 2023 22:15:59 -0400 Message-Id: <20230601021605.2823123-9-Liam.Howlett@oracle.com> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20230601021605.2823123-1-Liam.Howlett@oracle.com> References: <20230601021605.2823123-1-Liam.Howlett@oracle.com> X-ClientProxiedBy: YT4PR01CA0230.CANPRD01.PROD.OUTLOOK.COM (2603:10b6:b01:eb::10) To SN6PR10MB3022.namprd10.prod.outlook.com (2603:10b6:805:d8::25) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: SN6PR10MB3022:EE_|SJ0PR10MB4687:EE_ X-MS-Office365-Filtering-Correlation-Id: cec4d59d-3a1e-42a1-6281-08db62463a0c X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: jH4N7B/4/TXtr9dgBpqMVWakv2D2YV2WxVm6x2wbQ7EC/LMquwIzoJK3O5V0xGr+rHBgWK2iYi64FHGJ4Dn12lBg6xIp8EEqk6d+8LDiWy8xTWyeHJph5gonUe7HcfeAUf+WD4GFi4FXFG0znk7R1TJ+y3wrfp9kSxgCevyshk4HNusEWkoj9x9VYPIkZNEEDUV3bbAJ5Cq8+d0hwmXK432NUgsFgB6dmOretUwV6yss1xgFAYA6AOwB/GBbY9iHxT/3kXWDbJo/iIuYc5ktIns3irXPupvbWAg8vPdzlUE91t3v9ddIzdxQ/kLrWIVVfeLxXRJZkjZIqKHuTqPOcIHXKrTkMpKzelxp8f53/vfsw+AoPH4I7lqAc1XuJivOCAtjelwrAGnbQgQzbIvwAvXYxTFMh1cQ6tE1zwUXw0ZTsFvt4MmIiXrZR1yDo1Rq7nMmuknHODgGXCM8agefu89aUgAkHHwRR0jGK2cDX6jZUvkkW0I5C2Ho4B4G+AQXi68DjiZKZIOSbFA9P2zR3n53WFO8HdaAdfMdGRQylaBA7UPLmF2/RG6LW/ClzOxk 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:(13230028)(396003)(39860400002)(136003)(346002)(376002)(366004)(451199021)(36756003)(38100700002)(86362001)(8936002)(8676002)(41300700001)(107886003)(5660300002)(26005)(1076003)(6506007)(6512007)(2906002)(186003)(2616005)(83380400001)(6666004)(6486002)(66556008)(66476007)(66946007)(316002)(478600001)(6916009)(4326008);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: YkSzHga2t4SJ4OpmT4ZJ56jUij1OUXHlAR4Wmo6sooAqQq1Mgv9lnFk+Gg4QEABD8zdvCsZNEXZwBa2TvE3h50dQGLYscAB6wEHij7hL84lxHQIJZzlbcU+4gt9ktIP3sAv9EKwg7SiEdEHmhxXMuKlZk19clnS1i3DlN1aanGhxR3q1eSBVJkjJFitFaekYt+O4KDnJlSBPUqyGL2V4a0Lg89zcBI6YGdzu8dKtvbk8HIzKLK5nqYsCpOgbUDJMtad1o0ch76XlarknGmdNa3DzHyxl39g7hx7ufH9238+HHKMXaAFkH8kg+FBVtKh+zg0SCbVFjyvO/eoirF33T9rVyiN5sin5BzHl9J9BobMhkQuhabKw9/MWTj0YORLh1qEM0tSw5f/kITZ7fPgrw8UH7nT4vX9Utvq7gb3M5JJ2jYTnUZ4kw3luVE3NS0IYLV5+JcK6u3SmFCUnmjbDNxIeqeFC2/cvQ5O/Jy1UNrHxlAu0YPe2xPhr22ZekySi9Ew6Q2iX2SHP9jS2WaQ440fTD85zy6LFlPUKXB8GvYn0XHT7rE8p9YNPG2pA5z9eGrZNvnLs62eu/0Wksyjci7REopFGAa7RSnmcgA8XcnxbWjAmepTMfnUJE783Pw4hkZ9LvduQPrQLm9Eq0AIs3tXJikqFmRJUXH/AzJLbGDn4K9+Vr1me8ku+5HR7p8YFL4O5ax+HJ+Mo5d6cAz++pVnmln2lA5yWsJwn/vLjUulzJcpYA2OQ64bBSt3AfYW3XuEY+uF1t7UOlb8NmwHepyvGM9o3utlEujquwYJNMq5/eQV0V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rqULklgP33EUMyygoLAm2BgyQ2u1dIxEjx97Cm34wCxrBi4WsUXBHsESY2hoNitvvc3/qhEY/BCd+c4pi0sIQ+PXB+iuBCjkHilITs1PIkZftJNR9cSw6WOjgsgQ1XyX8xxmmzrVXh8vw6Ft++KBttkW4/QF4G7NuEqHtcU6IC4CjqOwuegW4pzdMZYEwQNFynbKDIKVyI3aX2lQoUcDIiFcfRogKs00DQbHlCLtWFn6fANb1K22uoMlsPgZiYpVc16CwjAAlDkJA50MQTlJ+owiYG69sjEifdjCON5BSRMTWyaVLHhPz2wbikCmjn+Mb/vrYgVY0WJ/unERQJ4SRMwxKihJ4FRyQM+rM1cK5AVkspSH2ngSPxkwPlZ4XP3uUJCIz+SODVz9JfxGA7icMEkSvWV24tzxGGn0MH6ZPSF18NFlE9kV7tQWlXIyQFdLah85swV5lGFYc9meMtYSX9t3B5nqXNsALUMNFSRyNbPUpJ6xv2MrH7DHoQ1dhfui5ZFMLHaji5hv+F0ZmE0og0H0BvfgnWFPSI8mYMvDv/G7ueJispE7edyLlH9vPquEN4O9+UMekVi7BUkwLUIymzSptqOUIUE7bkIel/hnB1J9K9URGP2gPzkyCERfXRph8DcjDKJYx5LtHnAw7lTI3Th9AVhJ476w0pkrFEjiMAPEbmrqRXPcA+lGg33yi407Wm+MQDaBuOHPCM8uW+4N5JcxpBcVWww== X-OriginatorOrg: oracle.com X-MS-Exchange-CrossTenant-Network-Message-Id: cec4d59d-3a1e-42a1-6281-08db62463a0c X-MS-Exchange-CrossTenant-AuthSource: SN6PR10MB3022.namprd10.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 01 Jun 2023 02:16:36.5299 (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: y63BrENuFU4Mvevt5h77JMyodALECCUgqZdEMgaeHTGeWy4p6VzBmwHZWP2GzDKNcXqiu3Uby3OiPBu03+ohqw== X-MS-Exchange-Transport-CrossTenantHeadersStamped: SJ0PR10MB4687 X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.254,Aquarius:18.0.957,Hydra:6.0.573,FMLib:17.11.176.26 definitions=2023-05-31_18,2023-05-31_03,2023-05-22_02 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 suspectscore=0 adultscore=0 spamscore=0 phishscore=0 malwarescore=0 mlxlogscore=999 mlxscore=0 bulkscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2304280000 definitions=main-2306010016 X-Proofpoint-ORIG-GUID: DIFzhmCDkco2r01SE62ZRXspyZbAP9cn X-Proofpoint-GUID: DIFzhmCDkco2r01SE62ZRXspyZbAP9cn 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_H5,RCVD_IN_MSPIKE_WL,SPF_HELO_NONE,SPF_NONE, T_SCC_BODY_TEXT_LINE 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: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1767466177743207465?= X-GMAIL-MSGID: =?utf-8?q?1767466177743207465?= The current preallocation strategy is to preallocate the absolute worst-case allocation for a tree modification. The entry (or NULL) is needed to know how many nodes are needed to write to the tree. Start by adding the argument to the mas_preallocate() definition. Signed-off-by: Liam R. Howlett --- include/linux/maple_tree.h | 2 +- lib/maple_tree.c | 3 ++- mm/internal.h | 2 +- mm/mmap.c | 4 ++-- tools/testing/radix-tree/maple.c | 32 ++++++++++++++++---------------- 5 files changed, 22 insertions(+), 21 deletions(-) diff --git a/include/linux/maple_tree.h b/include/linux/maple_tree.h index ed50d8f459e6..e18ecbefc7f7 100644 --- a/include/linux/maple_tree.h +++ b/include/linux/maple_tree.h @@ -458,7 +458,7 @@ void *mas_find(struct ma_state *mas, unsigned long max); void *mas_find_range(struct ma_state *mas, unsigned long max); void *mas_find_rev(struct ma_state *mas, unsigned long min); void *mas_find_range_rev(struct ma_state *mas, unsigned long max); -int mas_preallocate(struct ma_state *mas, gfp_t gfp); +int mas_preallocate(struct ma_state *mas, void *entry, gfp_t gfp); bool mas_is_err(struct ma_state *mas); bool mas_nomem(struct ma_state *mas, gfp_t gfp); diff --git a/lib/maple_tree.c b/lib/maple_tree.c index bfffbb7cab26..34eccddb0b47 100644 --- a/lib/maple_tree.c +++ b/lib/maple_tree.c @@ -5535,11 +5535,12 @@ EXPORT_SYMBOL_GPL(mas_store_prealloc); /** * mas_preallocate() - Preallocate enough nodes for a store operation * @mas: The maple state + * @entry: The entry that will be stored * @gfp: The GFP_FLAGS to use for allocations. * * Return: 0 on success, -ENOMEM if memory could not be allocated. */ -int mas_preallocate(struct ma_state *mas, gfp_t gfp) +int mas_preallocate(struct ma_state *mas, void *entry, gfp_t gfp) { int ret; diff --git a/mm/internal.h b/mm/internal.h index cdf06f680d6e..2691deca9699 100644 --- a/mm/internal.h +++ b/mm/internal.h @@ -1047,7 +1047,7 @@ static inline void vma_iter_config(struct vma_iterator *vmi, */ static inline int vma_iter_prealloc(struct vma_iterator *vmi) { - return mas_preallocate(&vmi->mas, GFP_KERNEL); + return mas_preallocate(&vmi->mas, NULL, GFP_KERNEL); } static inline void vma_iter_clear(struct vma_iterator *vmi, diff --git a/mm/mmap.c b/mm/mmap.c index 8b3e58d6ac40..75b2a86e1faa 100644 --- a/mm/mmap.c +++ b/mm/mmap.c @@ -1982,7 +1982,7 @@ int expand_upwards(struct vm_area_struct *vma, unsigned long address) /* Check that both stack segments have the same anon_vma? */ } - if (mas_preallocate(&mas, GFP_KERNEL)) + if (mas_preallocate(&mas, vma, GFP_KERNEL)) return -ENOMEM; /* We must make sure the anon_vma is allocated. */ @@ -2064,7 +2064,7 @@ int expand_downwards(struct vm_area_struct *vma, unsigned long address) return -ENOMEM; } - if (mas_preallocate(&mas, GFP_KERNEL)) + if (mas_preallocate(&mas, vma, GFP_KERNEL)) return -ENOMEM; /* We must make sure the anon_vma is allocated. */ diff --git a/tools/testing/radix-tree/maple.c b/tools/testing/radix-tree/maple.c index 03539d86cdf0..cfadc4b75d51 100644 --- a/tools/testing/radix-tree/maple.c +++ b/tools/testing/radix-tree/maple.c @@ -35383,7 +35383,7 @@ static noinline void __init check_prealloc(struct maple_tree *mt) for (i = 0; i <= max; i++) mtree_test_store_range(mt, i * 10, i * 10 + 5, &i); - MT_BUG_ON(mt, mas_preallocate(&mas, GFP_KERNEL) != 0); + MT_BUG_ON(mt, mas_preallocate(&mas, ptr, GFP_KERNEL) != 0); allocated = mas_allocated(&mas); height = mas_mt_height(&mas); MT_BUG_ON(mt, allocated == 0); @@ -35392,18 +35392,18 @@ static noinline void __init check_prealloc(struct maple_tree *mt) allocated = mas_allocated(&mas); MT_BUG_ON(mt, allocated != 0); - MT_BUG_ON(mt, mas_preallocate(&mas, GFP_KERNEL) != 0); + MT_BUG_ON(mt, mas_preallocate(&mas, ptr, GFP_KERNEL) != 0); allocated = mas_allocated(&mas); height = mas_mt_height(&mas); MT_BUG_ON(mt, allocated == 0); MT_BUG_ON(mt, allocated != 1 + height * 3); - MT_BUG_ON(mt, mas_preallocate(&mas, GFP_KERNEL) != 0); + MT_BUG_ON(mt, mas_preallocate(&mas, ptr, GFP_KERNEL) != 0); mas_destroy(&mas); allocated = mas_allocated(&mas); MT_BUG_ON(mt, allocated != 0); - MT_BUG_ON(mt, mas_preallocate(&mas, GFP_KERNEL) != 0); + MT_BUG_ON(mt, mas_preallocate(&mas, ptr, GFP_KERNEL) != 0); allocated = mas_allocated(&mas); height = mas_mt_height(&mas); MT_BUG_ON(mt, allocated == 0); @@ -35412,26 +35412,26 @@ static noinline void __init check_prealloc(struct maple_tree *mt) MT_BUG_ON(mt, mas_allocated(&mas) != allocated - 1); mn->parent = ma_parent_ptr(mn); ma_free_rcu(mn); - MT_BUG_ON(mt, mas_preallocate(&mas, GFP_KERNEL) != 0); + MT_BUG_ON(mt, mas_preallocate(&mas, ptr, GFP_KERNEL) != 0); mas_destroy(&mas); allocated = mas_allocated(&mas); MT_BUG_ON(mt, allocated != 0); - MT_BUG_ON(mt, mas_preallocate(&mas, GFP_KERNEL) != 0); + MT_BUG_ON(mt, mas_preallocate(&mas, ptr, GFP_KERNEL) != 0); allocated = mas_allocated(&mas); height = mas_mt_height(&mas); MT_BUG_ON(mt, allocated == 0); MT_BUG_ON(mt, allocated != 1 + height * 3); mn = mas_pop_node(&mas); MT_BUG_ON(mt, mas_allocated(&mas) != allocated - 1); - MT_BUG_ON(mt, mas_preallocate(&mas, GFP_KERNEL) != 0); + MT_BUG_ON(mt, mas_preallocate(&mas, ptr, GFP_KERNEL) != 0); mas_destroy(&mas); allocated = mas_allocated(&mas); MT_BUG_ON(mt, allocated != 0); mn->parent = ma_parent_ptr(mn); ma_free_rcu(mn); - MT_BUG_ON(mt, mas_preallocate(&mas, GFP_KERNEL) != 0); + MT_BUG_ON(mt, mas_preallocate(&mas, ptr, GFP_KERNEL) != 0); allocated = mas_allocated(&mas); height = mas_mt_height(&mas); MT_BUG_ON(mt, allocated == 0); @@ -35440,12 +35440,12 @@ static noinline void __init check_prealloc(struct maple_tree *mt) MT_BUG_ON(mt, mas_allocated(&mas) != allocated - 1); mas_push_node(&mas, mn); MT_BUG_ON(mt, mas_allocated(&mas) != allocated); - MT_BUG_ON(mt, mas_preallocate(&mas, GFP_KERNEL) != 0); + MT_BUG_ON(mt, mas_preallocate(&mas, ptr, GFP_KERNEL) != 0); mas_destroy(&mas); allocated = mas_allocated(&mas); MT_BUG_ON(mt, allocated != 0); - MT_BUG_ON(mt, mas_preallocate(&mas, GFP_KERNEL) != 0); + MT_BUG_ON(mt, mas_preallocate(&mas, ptr, GFP_KERNEL) != 0); allocated = mas_allocated(&mas); height = mas_mt_height(&mas); MT_BUG_ON(mt, allocated == 0); @@ -35453,21 +35453,21 @@ static noinline void __init check_prealloc(struct maple_tree *mt) mas_store_prealloc(&mas, ptr); MT_BUG_ON(mt, mas_allocated(&mas) != 0); - MT_BUG_ON(mt, mas_preallocate(&mas, GFP_KERNEL) != 0); + MT_BUG_ON(mt, mas_preallocate(&mas, ptr, GFP_KERNEL) != 0); allocated = mas_allocated(&mas); height = mas_mt_height(&mas); MT_BUG_ON(mt, allocated == 0); MT_BUG_ON(mt, allocated != 1 + height * 3); mas_store_prealloc(&mas, ptr); MT_BUG_ON(mt, mas_allocated(&mas) != 0); - MT_BUG_ON(mt, mas_preallocate(&mas, GFP_KERNEL) != 0); + MT_BUG_ON(mt, mas_preallocate(&mas, ptr, GFP_KERNEL) != 0); allocated = mas_allocated(&mas); height = mas_mt_height(&mas); MT_BUG_ON(mt, allocated == 0); MT_BUG_ON(mt, allocated != 1 + height * 3); mas_store_prealloc(&mas, ptr); - MT_BUG_ON(mt, mas_preallocate(&mas, GFP_KERNEL) != 0); + MT_BUG_ON(mt, mas_preallocate(&mas, ptr, GFP_KERNEL) != 0); allocated = mas_allocated(&mas); height = mas_mt_height(&mas); MT_BUG_ON(mt, allocated == 0); @@ -35475,14 +35475,14 @@ static noinline void __init check_prealloc(struct maple_tree *mt) mas_store_prealloc(&mas, ptr); MT_BUG_ON(mt, mas_allocated(&mas) != 0); mt_set_non_kernel(1); - MT_BUG_ON(mt, mas_preallocate(&mas, GFP_KERNEL & GFP_NOWAIT) == 0); + MT_BUG_ON(mt, mas_preallocate(&mas, ptr, GFP_KERNEL & GFP_NOWAIT) == 0); allocated = mas_allocated(&mas); height = mas_mt_height(&mas); MT_BUG_ON(mt, allocated != 0); mas_destroy(&mas); - MT_BUG_ON(mt, mas_preallocate(&mas, GFP_KERNEL) != 0); + MT_BUG_ON(mt, mas_preallocate(&mas, ptr, GFP_KERNEL) != 0); allocated = mas_allocated(&mas); height = mas_mt_height(&mas); MT_BUG_ON(mt, allocated == 0); @@ -35490,7 +35490,7 @@ static noinline void __init check_prealloc(struct maple_tree *mt) mas_store_prealloc(&mas, ptr); MT_BUG_ON(mt, mas_allocated(&mas) != 0); mt_set_non_kernel(1); - MT_BUG_ON(mt, mas_preallocate(&mas, GFP_KERNEL & GFP_NOWAIT) == 0); + MT_BUG_ON(mt, mas_preallocate(&mas, ptr, GFP_KERNEL & GFP_NOWAIT) == 0); allocated = mas_allocated(&mas); height = mas_mt_height(&mas); MT_BUG_ON(mt, allocated != 0); From patchwork Thu Jun 1 02:16:00 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Liam R. Howlett" X-Patchwork-Id: 101647 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:994d:0:b0:3d9:f83d:47d9 with SMTP id k13csp5392vqr; Wed, 31 May 2023 19:19:27 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ66X1/i7VjB5GQ8pOJIhlPSS9Gv9WmlfSMSBOhOZyBxuFVg6Xr01kMEMZ8bQzcVB13Ig1YJ X-Received: by 2002:a05:6870:b316:b0:19e:d5f5:8db4 with SMTP id a22-20020a056870b31600b0019ed5f58db4mr5668039oao.46.1685585966833; Wed, 31 May 2023 19:19:26 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1685585966; cv=pass; d=google.com; s=arc-20160816; b=jRhpX6y3paTNUVXgvhHFloW8gABJjDFeLhQWeD97UbKNAiSKqjE4g+4j2uhizG/x+S 57ofXzsfvd75kJe8eIl7jSlO37rGDTtWd1eFcyWsKj/p6ZFS2zCl9ftcMsN4yJE1cAvB xmKaGkFtASeIi3dbDqiT4OgWEVyZhOBeyE1hGPdMFtJ4YVCihjk2NzWalYwZX+SF14Kq tBkA3HWT+AwX5eMJRDKng8M80dhL82vnkdZTExPiRe++Cs3VwrFxne3uufFVGshPee3G lXVJgpukHQk0oHmWCWfuaKzafprAG+VPRSk4JzSC7kIi0j0yRDt/U+JJ5hVIKLirf/X+ vb+A== 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 :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature:dkim-signature; bh=NJmVxdLzLEbLcdb/yA4FmvurN2C/Dp3Rfx9FmMeuxiA=; b=olGAMovp/pP49niwruCiPUci7Yn5SYymUbnVuc2yQ6fyrYyvdKCdJAj1JOom9GlUbY zmehfEXPaldwgHgcdLicoByvo3CwFr4BpPNy7kgUl5R4EVwAmLIRt5WnqgZ9T5pYTdwT RniiD8NANzSXgcjtsgdG6b+m2FXanfRwsBCAPzVLngQT2CIAk9+VX5Lomc174ZR1SPCV Q3coMiu+q9BQV0zjJ19b3XpqOJfg7/ES7mJLVTbtCNrb5dVoUOr0Kw8W/SLKQnAjFDqC ryYzIrr7Eg40oa3jEBrXKOJ4nPcIdez/1biBQuop7WLbXEZhfamRKqPckTvsuFNv5Sj7 wyXA== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@oracle.com header.s=corp-2023-03-30 header.b="I+d0Hgj/"; dkim=pass header.i=@oracle.onmicrosoft.com header.s=selector2-oracle-onmicrosoft-com header.b="ZXM10YY/"; 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 s17-20020a632c11000000b005369f4111b1si2024480pgs.658.2023.05.31.19.19.14; Wed, 31 May 2023 19:19:26 -0700 (PDT) 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-2023-03-30 header.b="I+d0Hgj/"; dkim=pass header.i=@oracle.onmicrosoft.com header.s=selector2-oracle-onmicrosoft-com header.b="ZXM10YY/"; 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 S230499AbjFACRm (ORCPT + 99 others); Wed, 31 May 2023 22:17:42 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:51320 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230498AbjFACRO (ORCPT ); Wed, 31 May 2023 22:17:14 -0400 Received: from mx0a-00069f02.pphosted.com (mx0a-00069f02.pphosted.com [205.220.165.32]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 9EFAC1AD for ; Wed, 31 May 2023 19:16:52 -0700 (PDT) Received: from pps.filterd (m0246617.ppops.net [127.0.0.1]) by mx0b-00069f02.pphosted.com (8.17.1.19/8.17.1.19) with ESMTP id 34VJvV5Q022056; Thu, 1 Jun 2023 02:16:45 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-03-30; bh=NJmVxdLzLEbLcdb/yA4FmvurN2C/Dp3Rfx9FmMeuxiA=; b=I+d0Hgj/M0vCZE6XR5DjIjFcKV1xAUtAQRMVU0yVaxCUIThDsrgB34s/p7h3vZgDYlIk vNkVAG5ikCUV14bnbFNG5G0UWwVqwe/iS49Kx4wJE9c5Leq7O8ZtB/royKLxWD4v0Kk2 2FkY1AtsWQGu+/rDNORnYxWuK5jl2Nafa1VF5QKw8A5LNpg40cZZtJytnc9d5wTJD2Ur zjMfjPSiYs1tlfzfIyukwu9yRJ5l5wD9o9zsR0O4xnAhKWWTfQMtxxhbxtyxCxY8XHtP htvFvhHmzm31yTG39fwc0zAVTD+k3Bakpu/EvMUq4ftX+zEHAe6ola49gKgXAojotQyx sg== Received: from phxpaimrmta01.imrmtpd1.prodappphxaev1.oraclevcn.com (phxpaimrmta01.appoci.oracle.com [138.1.114.2]) by mx0b-00069f02.pphosted.com (PPS) with ESMTPS id 3qvhmjqja9-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Thu, 01 Jun 2023 02:16:44 +0000 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 3511YC8c014618; Thu, 1 Jun 2023 02:16:44 GMT Received: from nam12-mw2-obe.outbound.protection.outlook.com (mail-mw2nam12lp2040.outbound.protection.outlook.com [104.47.66.40]) by phxpaimrmta01.imrmtpd1.prodappphxaev1.oraclevcn.com (PPS) with ESMTPS id 3qu8a6grag-2 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Thu, 01 Jun 2023 02:16:44 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=d2XFJ3yC7py9RGj3tq6UUZEEtzC748NiBt6zM4R2FkTxEKtUQ24iB8yxsWFjKtzB8jOEmYn81l9sGXGCqXiBROq8Sa7ac/6bfdHqHq4/SPTbIVJ13aNoc3BvKq9nNdeA/igqyVjBBW7R14B/N7kLQ4NliDsT5ETJvzs+q44qFBV1G3voctwnsiRX59U6hzwaKz53LfRpmYES1FxKx6Cx+e8rW3D28Gl9IGa1usQ01QGy8BvudjS5BsR3BelAlzEVzEkhXa+GIW3bjEiI/CY7vw2E8VxoQ9E4dXsXqPWPKyLWxTVJ5jEga7qEXdka2hLHP3Ci4ZqbFyDnSpdZrCKDIg== 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=NJmVxdLzLEbLcdb/yA4FmvurN2C/Dp3Rfx9FmMeuxiA=; b=i3AdvXyA558q4BfbbuMwyRQZoIl1DdQUEGXdLHcofWLwkLwnMcTqoxB/LQ0iFtKFnHWZeVrQiuzBwIneySlsxgtMiT0i0KZSRg8OLT1soimBYK608thggv1u3bDSX2iYkQST8rsthcSGpkK2NSisLFTI82OVqMapDN79/XmqUjtz16s0LaHGGI6Txkh29pbb7RYlNlHthWwfZcamasGI43eHwFTLoXUq444okY1eoqMSGpVj1hOSDvdCyjly0rR+Auv56XVGVGBDspI2kDhMBX+DyVZ7jz5l57XRU47UejAAjoRet3xNL/FuAFcpgzeHdQhrLDyl8BQ65ir4ad5eiQ== 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=NJmVxdLzLEbLcdb/yA4FmvurN2C/Dp3Rfx9FmMeuxiA=; b=ZXM10YY/U7FFQJFZ4l9jgQUb4ie09s/DqlQSyu6TClprXJWqr/d8FDHrBzLCD51/Bgh1DuYeG9pBPPHqUGo6pYbP0gfUwsOuPL9wMOvoZmU/kjNpfkzl6zK9ZaXZQnhbVIlrLY8a9IhBsuInRvcJtY2YO6M2AqvfytiLhtCOtBU= Received: from SN6PR10MB3022.namprd10.prod.outlook.com (2603:10b6:805:d8::25) by SJ0PR10MB4687.namprd10.prod.outlook.com (2603:10b6:a03:2d8::12) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6455.23; Thu, 1 Jun 2023 02:16:40 +0000 Received: from SN6PR10MB3022.namprd10.prod.outlook.com ([fe80::998f:d221:5fb6:c67d]) by SN6PR10MB3022.namprd10.prod.outlook.com ([fe80::998f:d221:5fb6:c67d%7]) with mapi id 15.20.6433.024; Thu, 1 Jun 2023 02:16:39 +0000 From: "Liam R. Howlett" To: Andrew Morton Cc: maple-tree@lists.infradead.org, linux-mm@kvack.org, linux-kernel@vger.kernel.org, "Liam R. Howlett" Subject: [PATCH 09/14] mm: Use vma_iter_clear_gfp() in nommu Date: Wed, 31 May 2023 22:16:00 -0400 Message-Id: <20230601021605.2823123-10-Liam.Howlett@oracle.com> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20230601021605.2823123-1-Liam.Howlett@oracle.com> References: <20230601021605.2823123-1-Liam.Howlett@oracle.com> X-ClientProxiedBy: YT1PR01CA0109.CANPRD01.PROD.OUTLOOK.COM (2603:10b6:b01:2c::18) To SN6PR10MB3022.namprd10.prod.outlook.com (2603:10b6:805:d8::25) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: SN6PR10MB3022:EE_|SJ0PR10MB4687:EE_ X-MS-Office365-Filtering-Correlation-Id: 764d96bb-2b7c-47f5-bfca-08db62463b95 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: 9/rL/6OAsg/3tWtZ9GOKA76CIeF+ACWSp1kqJrd5XZmfvbN6cWP04nLURx+5zFk6Zo+cf226C+ENpcT2zZcmaypTeCYNIOuj0te28N+L1aVDb78v/76VLKQPqCfpvm7VwkxW+YV/khSKnF/3vFsTX37pEq5vPi1GNb6yuhpPEeKaKkNyg0sUaOsV2epM0Gr/bwGXcCEd8UgtGAsqA4TIzpn6vlpNoRXcVY9AQtPlg+069OTGSlKLjffRU2k+3PfDTBuQVPSP8TSF+RLRbqHXa4rT9FCUQTr301g3fiDZdfVmrRihYrxleE9OqI2RammBax7WWFIvZlI6NLOrnDEPe3cE+dDiX4+PRDlOM6oGE3ryPAzmCkLJYO9egY5c/7cvUxzkNBttGU49FnDQ41TPAPno8cvM+qP0kqs2sjnRqTBi2lNY0oTPgdYRYn1H1Hb5ALhSq6TkhNhA3n7FQBy0RW7tA/86ooQ8c1GRWfbZR8p4+Rp3D0fupc5QcijSr8AceHIv+hQB6sXUEzB7uQ5Imtnbo6otrzSSImSPGWCmZBHRnXFqWbed7rbZLrMcnC5H 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:(13230028)(396003)(39860400002)(136003)(346002)(376002)(366004)(451199021)(36756003)(38100700002)(86362001)(8936002)(8676002)(41300700001)(107886003)(5660300002)(26005)(1076003)(6506007)(6512007)(2906002)(186003)(2616005)(83380400001)(6666004)(6486002)(66556008)(66476007)(66946007)(316002)(478600001)(6916009)(4326008);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: itOkKYcsysgjIM7P3IYuUPPD9KDnWfwJ5NNbl6KwsERDU29Qo+m3rKXdSoHsXYXq2aIrCx1kn+vWiBvsigCXzNtTeO1r7Yq350UoK4H5lCbH6slPlrbp+f5qJeVEO8TG5EajtRetySBWT6hJn3JAvRO7O7RStwBD0CAWfIkZm2Btkwypt3hWfm6+YLucJC9V4mDKA2KS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U6a7MQnIfkIb/TawLRL50QZY7rUmTyFG01PkVmvCRIYO/awGAMuDwVB4XHqlI/wG8wu39YguUI3FRJmgik6XYbrOyAFxbbl2N2joy5MNNY/+7WLgr3q6GAISYJ6vtQxAvtxhvgRyeobQqO8pjf+aYD6wE22c1y2IIJluxfRCVgHfZ6qLsOPMRE+22iL62RZeXZAMXe8l5T7Uzh63chdbB3v3XSy+nWYn4SvBvwnTUsnmWTPrhKOjIkQGCDA== X-OriginatorOrg: oracle.com X-MS-Exchange-CrossTenant-Network-Message-Id: 764d96bb-2b7c-47f5-bfca-08db62463b95 X-MS-Exchange-CrossTenant-AuthSource: SN6PR10MB3022.namprd10.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 01 Jun 2023 02:16:39.1074 (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: K8zrHK8zn9VdbxZkBayF4hNk2VJsNrK3gzLySnBJKHe3ve7BDwzA3DyBecDOgEycz2fOWcfm9b+MFg1voBZCHg== X-MS-Exchange-Transport-CrossTenantHeadersStamped: SJ0PR10MB4687 X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.254,Aquarius:18.0.957,Hydra:6.0.573,FMLib:17.11.176.26 definitions=2023-05-31_18,2023-05-31_03,2023-05-22_02 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 suspectscore=0 adultscore=0 spamscore=0 phishscore=0 malwarescore=0 mlxlogscore=985 mlxscore=0 bulkscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2304280000 definitions=main-2306010016 X-Proofpoint-ORIG-GUID: lrsWdV8N_1lIOYm9arKpH7kRzafi5vjx X-Proofpoint-GUID: lrsWdV8N_1lIOYm9arKpH7kRzafi5vjx 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_H5,RCVD_IN_MSPIKE_WL,SPF_HELO_NONE,SPF_NONE, T_SCC_BODY_TEXT_LINE 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: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1767464990686906925?= X-GMAIL-MSGID: =?utf-8?q?1767464990686906925?= Move the definition of vma_iter_clear_gfp() from mmap.c to internal.h so it can be used in the nommu code. This will reduce node preallocations in nommu. Signed-off-by: Liam R. Howlett --- mm/internal.h | 12 ++++++++++++ mm/mmap.c | 12 ------------ mm/nommu.c | 12 ++++-------- 3 files changed, 16 insertions(+), 20 deletions(-) diff --git a/mm/internal.h b/mm/internal.h index 2691deca9699..d78fd0fafa3b 100644 --- a/mm/internal.h +++ b/mm/internal.h @@ -1057,6 +1057,18 @@ static inline void vma_iter_clear(struct vma_iterator *vmi, mas_store_prealloc(&vmi->mas, NULL); } +static inline int vma_iter_clear_gfp(struct vma_iterator *vmi, + unsigned long start, unsigned long end, gfp_t gfp) +{ + vmi->mas.index = start; + vmi->mas.last = end - 1; + mas_store_gfp(&vmi->mas, NULL, gfp); + if (unlikely(mas_is_err(&vmi->mas))) + return -ENOMEM; + + return 0; +} + static inline struct vm_area_struct *vma_iter_load(struct vma_iterator *vmi) { return mas_walk(&vmi->mas); diff --git a/mm/mmap.c b/mm/mmap.c index 75b2a86e1faa..22c71dff762b 100644 --- a/mm/mmap.c +++ b/mm/mmap.c @@ -154,18 +154,6 @@ static inline struct vm_area_struct *vma_prev_limit(struct vma_iterator *vmi, return mas_prev(&vmi->mas, min); } -static inline int vma_iter_clear_gfp(struct vma_iterator *vmi, - unsigned long start, unsigned long end, gfp_t gfp) -{ - vmi->mas.index = start; - vmi->mas.last = end - 1; - mas_store_gfp(&vmi->mas, NULL, gfp); - if (unlikely(mas_is_err(&vmi->mas))) - return -ENOMEM; - - return 0; -} - /* * check_brk_limits() - Use platform specific check of range & verify mlock * limits. diff --git a/mm/nommu.c b/mm/nommu.c index f670d9979a26..a764b86b132a 100644 --- a/mm/nommu.c +++ b/mm/nommu.c @@ -1383,17 +1383,13 @@ static int vmi_shrink_vma(struct vma_iterator *vmi, /* adjust the VMA's pointers, which may reposition it in the MM's tree * and list */ - if (vma_iter_prealloc(vmi)) { - pr_warn("Allocation of vma tree for process %d failed\n", - current->pid); - return -ENOMEM; - } - if (from > vma->vm_start) { - vma_iter_clear(vmi, from, vma->vm_end); + if (vma_iter_clear_gfp(vmi, from, vma->vm_end, GFP_KERNEL)) + return -ENOMEM; vma->vm_end = from; } else { - vma_iter_clear(vmi, vma->vm_start, to); + if (vma_iter_clear_gfp(vmi, vma->vm_start, to, GFP_KERNEL)) + return -ENOMEM; vma->vm_start = to; } From patchwork Thu Jun 1 02:16:01 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Liam R. Howlett" X-Patchwork-Id: 101646 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:994d:0:b0:3d9:f83d:47d9 with SMTP id k13csp5326vqr; Wed, 31 May 2023 19:18:53 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ7GUPKeVz+58rGfRw6qHYtHfns7gNsIzpF7hqzuzAELe0qK7Bcr9a8SQOUbU2YPL59RPRn2 X-Received: by 2002:a05:6a00:148b:b0:636:f899:46a0 with SMTP id v11-20020a056a00148b00b00636f89946a0mr10183495pfu.15.1685585933473; Wed, 31 May 2023 19:18:53 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1685585933; cv=pass; d=google.com; s=arc-20160816; b=vE0K5EUXdYJds5qKc04QH352zV5xS1G1DqXqOubJJneYEwCIMTRmPsDf2tpIFXbb5u T81uhPPcH7jQZPGP1h7qOfY6H8VKKT7ZHb+LQ1/ZJBblrYAKk41TOnNQ+m5vhjXT2TP1 SyWdmPqF1NWCIND9f7jgCctnK3tf/TQmXV6SlRAKFC+zSP/Cd04QjAuZNYgvAPIum+7A sVRFv4mtBa5/wBbTq4i1b3zZtOytooeD8lUX7SFn7IzB/4Q1eHvqst6Cs4oRrBXWfmfk ein5lO7ggg3XM4SXXPEWT1eVQQjcTIkXe82L3A+Km+0WHd0xEGLn10loZokmaZeJvKqV R+EQ== 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 :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature:dkim-signature; bh=R0qsDcG9O4MhzZqrq1oD6FDIspNJvYaqrNhWXitLwfg=; b=gERIEweVFnUzdZznWgg3pjZtuJMIzjOuSVc4VN/YAP6/st5UNRnk8JH+kHC3NICrzl 9GkLDorYQUBtBsRyy9pS7iJo59jcH6Y/434zWhWJkXjEnmY6lMi2Q50BbP+zsSv1N779 +NXkzG5eVfCtwny4EjufUlXfoVezXPAhMzAn/ZB+zbFDkvkX/TmYNWI4cb68Z+PZmmML iJsqbgdD9qkh744gSi43ueJRRvQNKzdP8uGZ3KGmTntk2qkjb0X2KNjeF/nueJbmE0zV NHJr/8g0WDimrilhm3uAoxFLCeqi3K+QzjHewbp5GqJW65bfqpZTat3HThnfULkkDH7r NJXA== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@oracle.com header.s=corp-2023-03-30 header.b=PtnGSGLa; dkim=pass header.i=@oracle.onmicrosoft.com header.s=selector2-oracle-onmicrosoft-com header.b=j8pAexRw; 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 g64-20020a636b43000000b00528d1d9c7b3si2066506pgc.732.2023.05.31.19.18.40; Wed, 31 May 2023 19:18:53 -0700 (PDT) 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-2023-03-30 header.b=PtnGSGLa; dkim=pass header.i=@oracle.onmicrosoft.com header.s=selector2-oracle-onmicrosoft-com header.b=j8pAexRw; 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 S230483AbjFACRj (ORCPT + 99 others); Wed, 31 May 2023 22:17:39 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:51342 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229992AbjFACRP (ORCPT ); Wed, 31 May 2023 22:17:15 -0400 Received: from mx0a-00069f02.pphosted.com (mx0a-00069f02.pphosted.com [205.220.165.32]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 437111B0 for ; Wed, 31 May 2023 19:16:53 -0700 (PDT) Received: from pps.filterd (m0246629.ppops.net [127.0.0.1]) by mx0b-00069f02.pphosted.com (8.17.1.19/8.17.1.19) with ESMTP id 34VKIEje032508; Thu, 1 Jun 2023 02:16:45 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-03-30; bh=R0qsDcG9O4MhzZqrq1oD6FDIspNJvYaqrNhWXitLwfg=; b=PtnGSGLadaxpFYBfSJvFXng6oWFL07b6iI8i5p54eCcNuPE2uoPQehQBAE7pb7Ev0VLn z8pToT/iCUYlkoXhhVeoTFhsHGA95PhNA4yWaLxdKPiYJm7e4chjQQvDyTvWuEMmtRn7 NT3EM2qW5/BBrrTNoX786DLmjcWklEHYdGLrI+8r906i/m9vUbiUTyFLBco29ckiQ3/E gV3RYZ/Aa7pdEPHt0g1HE4z6TG0/y4W573RdZpVitOzaeTPZYagY/uJhuCSKl56nLP+x ra6oKtU6dZooiQEBSzaB94F2vpXDvn7SDnSfEoz9v4oCdE+bZOUS8rTL/GSqtdEY9FH7 eQ== Received: from phxpaimrmta01.imrmtpd1.prodappphxaev1.oraclevcn.com (phxpaimrmta01.appoci.oracle.com [138.1.114.2]) by mx0b-00069f02.pphosted.com (PPS) with ESMTPS id 3qvhb97hvg-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Thu, 01 Jun 2023 02:16:45 +0000 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 3511YC8d014618; Thu, 1 Jun 2023 02:16:44 GMT Received: from nam12-mw2-obe.outbound.protection.outlook.com (mail-mw2nam12lp2040.outbound.protection.outlook.com [104.47.66.40]) by phxpaimrmta01.imrmtpd1.prodappphxaev1.oraclevcn.com (PPS) with ESMTPS id 3qu8a6grag-3 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Thu, 01 Jun 2023 02:16:44 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=UR1mxZ86x3+fIhLgQWSXcwcQyL9Lxj5Vi3xMkcb29dh+XCN7OJl7zrh+l7fw6tqx0qtk6Z8vm+k/01CBoWbEtRAniPEmOn7oGZcigKX0T2oX0GyNldnIwa24Syt4nS39Xn5vDAffLL3ZUSqbppTvyovIItbrWAB4u8xD/VkE/o/0wVqwJbmriwj/bXxKQdQNr3EmEH/d2TsogPIrwFZfZGDnTv1UoAcNaLHU7u94wJyBaUmxqkgaP4SvsNz9CAyofZ6z5tOmmZ+6HPV0EysxNY5uY+hmZWsLm/TJ8EWAQlcCGwZ0Nvd84WZXr725OLYon5f1MrhApGQxmH7kJS+uBw== 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=R0qsDcG9O4MhzZqrq1oD6FDIspNJvYaqrNhWXitLwfg=; b=KQ6o8SvETHAfgm4guphXzHWBzeD2lH82xrKP7zV8Q8XtcwaTBZw05WR+aFKWli+z2Hu/yAFHQueP6/qqa8+vBJDCVg0JA0o6Yw9N+XFf0Z11gusheqgx17STnTQ0KNIkMz3PSVGhUPjQS3BVYCdY9eY0PKMhUR44GVlN+KnFusjEE8B4pLTRNRchDDlAJzRMyYLLkKLgqv18HTne+FKGqq24/TmI6yyljarv3f3ZA6/RhLJtl0a7uv6zTOAvy2SQ0x/AXA1XkbCSL4dy4kccimd/staETs2la+WWZ6R67ROMKvfjCKw74FpzPiAdn3nEHk2N+YFYzgTjHlw43R8PaQ== 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=R0qsDcG9O4MhzZqrq1oD6FDIspNJvYaqrNhWXitLwfg=; b=j8pAexRwxJZY8hsZ3dlCUzdR3YwM8BQd/4gW5kGOODCXkce/+41utsWGi4Zpyu2lFstTOk6pb+uzDkgw9XNc64+Dx2uWAb9NO8e1a5mPNNaTlI5f9heO+fjX8RNQflaEzPFiR3AakFZ18w4hnQZNVYqleCYjyWt9oQerLivhAaQ= Received: from SN6PR10MB3022.namprd10.prod.outlook.com (2603:10b6:805:d8::25) by SJ0PR10MB4687.namprd10.prod.outlook.com (2603:10b6:a03:2d8::12) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6455.23; Thu, 1 Jun 2023 02:16:42 +0000 Received: from SN6PR10MB3022.namprd10.prod.outlook.com ([fe80::998f:d221:5fb6:c67d]) by SN6PR10MB3022.namprd10.prod.outlook.com ([fe80::998f:d221:5fb6:c67d%7]) with mapi id 15.20.6433.024; Thu, 1 Jun 2023 02:16:42 +0000 From: "Liam R. Howlett" To: Andrew Morton Cc: maple-tree@lists.infradead.org, linux-mm@kvack.org, linux-kernel@vger.kernel.org, "Liam R. Howlett" Subject: [PATCH 10/14] mm: Set up vma iterator for vma_iter_prealloc() calls Date: Wed, 31 May 2023 22:16:01 -0400 Message-Id: <20230601021605.2823123-11-Liam.Howlett@oracle.com> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20230601021605.2823123-1-Liam.Howlett@oracle.com> References: <20230601021605.2823123-1-Liam.Howlett@oracle.com> X-ClientProxiedBy: YT1PR01CA0122.CANPRD01.PROD.OUTLOOK.COM (2603:10b6:b01:2c::31) To SN6PR10MB3022.namprd10.prod.outlook.com (2603:10b6:805:d8::25) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: SN6PR10MB3022:EE_|SJ0PR10MB4687:EE_ X-MS-Office365-Filtering-Correlation-Id: 8b391d5f-d585-4d38-dfc5-08db62463d42 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: s2qW/AjIZi4Swm1ZMUfcEC5/rhpFh7jUwlR5fk9PBbocj52wAdtf6LFCkouQ87VwyxID/cz0S4F1GVXPado+zysYfcpcTMfriPgnz5O0eB60kvgnDQ/+wXTtsrJm+x7oNWLJnk9Zt2VxF7NReeb/OY751/LNrQL2SO0o6CjlTevXjRKnI9UBRl1ObnY/YE8NFnnjmSTjHeA9NlYM4I8sRy41lKlrP6m856aGmcr3T80VF97DE7/tTQSm2OuNDz0xORSvCHt17wrd6r7DHvPHxB9DCkRFgTwwlXiRT/yc1io8YZhskUpimFYwzaueJuiPlQtlkQArj9AqBMcaIToUveGZiT+ECI6L4qvoTBp/2iV6Xnu1dQ9tBGp4nmo3O1IN5pi+oBEa1l4xa8vSQR9JVj8+jWb+AyhxWHxwRBiS/PxK+hEf7tK+IhLyjiL9TLUxjdY2Zwmb5brztqQoVOrVZaE5luuMMVMCQ04Ic82+CYCRCuzy4eTiBxmvfI1oOSMKMRr6wNRM4ELppiGGgrrKiSdXEyn/P82oC5OLUQGuDaBoP6CZtafjcNqqU+K3LzLD 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:(13230028)(396003)(39860400002)(136003)(346002)(376002)(366004)(451199021)(36756003)(38100700002)(86362001)(8936002)(8676002)(41300700001)(107886003)(5660300002)(26005)(1076003)(6506007)(6512007)(30864003)(2906002)(186003)(2616005)(83380400001)(6666004)(6486002)(66556008)(66476007)(66946007)(316002)(478600001)(6916009)(4326008);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-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fFhudxpcIxP1kTy58HSHdN8mzF+zUzcEUQ1qiHbErhyzLLmXICIVXPbbOEHcooYWlZt2vy5OaPIQeD9P+Cr39YMP2y200nrJ6o4bWKKG8uNSX5YyfGDnvlXBM2+7pVTRNAd8GrcbERh1AAQhlXgfryWzNSUHi12XWeyAm6N0H0FZ6qPGjO+m2fwdrWnT3JExf36U4rAQqhtjLwx01qIvjp/tAiJk7ThblFUadeSQi4KPYCnFMkIjIBUOerEmxMULKPmrRr811dsDw9tgLW9kcqVcOi0i2mm7Hz+VoL/SRFpt+IkoMMBwSLKiZqApkRsRTvY2lUownxLL8HS6WBi9+SDRkoLXa8anT+xn0Nbw5xAEcHfpTpTqTH8via+8YIOCrZtWcmpuT7emk4mJ/M/woWRAGyInIdDIlHkOcW+xKP0OBQebcoNpFJfZjcecoD/gAflC4pjckt6Q== X-OriginatorOrg: oracle.com X-MS-Exchange-CrossTenant-Network-Message-Id: 8b391d5f-d585-4d38-dfc5-08db62463d42 X-MS-Exchange-CrossTenant-AuthSource: SN6PR10MB3022.namprd10.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 01 Jun 2023 02:16:41.9738 (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: J4WquQDN+UXc4LV/IKdkmdhy7sSj6odFGO5WYq3JrS0ezLmae5wmK8UxlkPotQGPo5wObCtpPntoQ6hjJhdxPQ== X-MS-Exchange-Transport-CrossTenantHeadersStamped: SJ0PR10MB4687 X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.254,Aquarius:18.0.957,Hydra:6.0.573,FMLib:17.11.176.26 definitions=2023-05-31_18,2023-05-31_03,2023-05-22_02 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 suspectscore=0 adultscore=0 spamscore=0 phishscore=0 malwarescore=0 mlxlogscore=999 mlxscore=0 bulkscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2304280000 definitions=main-2306010016 X-Proofpoint-GUID: -bPzwyrCvF6Vdk0woBIxe-AxPlxS8OzE X-Proofpoint-ORIG-GUID: -bPzwyrCvF6Vdk0woBIxe-AxPlxS8OzE 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_H5,RCVD_IN_MSPIKE_WL,SPF_HELO_NONE,SPF_NONE, T_SCC_BODY_TEXT_LINE 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: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1767464955968153961?= X-GMAIL-MSGID: =?utf-8?q?1767464955968153961?= Set the correct limits for vma_iter_prealloc() calls so that the maple tree can be smarter about how many nodes are needed. Signed-off-by: Liam R. Howlett --- fs/exec.c | 1 + mm/internal.h | 18 +++++------- mm/mmap.c | 81 +++++++++++++++++++++++++++++++-------------------- mm/nommu.c | 33 +++++++++------------ 4 files changed, 72 insertions(+), 61 deletions(-) diff --git a/fs/exec.c b/fs/exec.c index 25c65b64544b..dc0ba74ebb74 100644 --- a/fs/exec.c +++ b/fs/exec.c @@ -697,6 +697,7 @@ static int shift_arg_pages(struct vm_area_struct *vma, unsigned long shift) if (vma != vma_next(&vmi)) return -EFAULT; + vma_iter_prev_range(&vmi); /* * cover the whole range: [new_start, old_end) */ diff --git a/mm/internal.h b/mm/internal.h index d78fd0fafa3b..531b2e95146c 100644 --- a/mm/internal.h +++ b/mm/internal.h @@ -1045,23 +1045,21 @@ static inline void vma_iter_config(struct vma_iterator *vmi, /* * VMA Iterator functions shared between nommu and mmap */ -static inline int vma_iter_prealloc(struct vma_iterator *vmi) +static inline int vma_iter_prealloc(struct vma_iterator *vmi, + struct vm_area_struct *vma) { - return mas_preallocate(&vmi->mas, NULL, GFP_KERNEL); + return mas_preallocate(&vmi->mas, vma, GFP_KERNEL); } -static inline void vma_iter_clear(struct vma_iterator *vmi, - unsigned long start, unsigned long end) +static inline void vma_iter_clear(struct vma_iterator *vmi) { - mas_set_range(&vmi->mas, start, end - 1); mas_store_prealloc(&vmi->mas, NULL); } static inline int vma_iter_clear_gfp(struct vma_iterator *vmi, unsigned long start, unsigned long end, gfp_t gfp) { - vmi->mas.index = start; - vmi->mas.last = end - 1; + __mas_set_range(&vmi->mas, start, end - 1); mas_store_gfp(&vmi->mas, NULL, gfp); if (unlikely(mas_is_err(&vmi->mas))) return -ENOMEM; @@ -1098,8 +1096,7 @@ static inline void vma_iter_store(struct vma_iterator *vmi, ((vmi->mas.index > vma->vm_start) || (vmi->mas.last < vma->vm_start))) vma_iter_invalidate(vmi); - vmi->mas.index = vma->vm_start; - vmi->mas.last = vma->vm_end - 1; + __mas_set_range(&vmi->mas, vma->vm_start, vma->vm_end - 1); mas_store_prealloc(&vmi->mas, vma); } @@ -1110,8 +1107,7 @@ static inline int vma_iter_store_gfp(struct vma_iterator *vmi, ((vmi->mas.index > vma->vm_start) || (vmi->mas.last < vma->vm_start))) vma_iter_invalidate(vmi); - vmi->mas.index = vma->vm_start; - vmi->mas.last = vma->vm_end - 1; + __mas_set_range(&vmi->mas, vma->vm_start, vma->vm_end - 1); mas_store_gfp(&vmi->mas, vma, gfp); if (unlikely(mas_is_err(&vmi->mas))) return -ENOMEM; diff --git a/mm/mmap.c b/mm/mmap.c index 22c71dff762b..eaebcc8f60d2 100644 --- a/mm/mmap.c +++ b/mm/mmap.c @@ -411,7 +411,8 @@ static int vma_link(struct mm_struct *mm, struct vm_area_struct *vma) VMA_ITERATOR(vmi, mm, 0); struct address_space *mapping = NULL; - if (vma_iter_prealloc(&vmi)) + vma_iter_config(&vmi, vma->vm_start, vma->vm_end); + if (vma_iter_prealloc(&vmi, vma)) return -ENOMEM; if (vma->vm_file) { @@ -664,19 +665,16 @@ int vma_expand(struct vma_iterator *vmi, struct vm_area_struct *vma, /* Only handles expanding */ VM_WARN_ON(vma->vm_start < start || vma->vm_end > end); - if (vma_iter_prealloc(vmi)) + /* Note: vma iterator must be pointing to 'start' */ + vma_iter_config(vmi, start, end); + if (vma_iter_prealloc(vmi, vma)) goto nomem; vma_prepare(&vp); vma_adjust_trans_huge(vma, start, end, 0); - /* VMA iterator points to previous, so set to start if necessary */ - if (vma_iter_addr(vmi) != start) - vma_iter_set(vmi, start); - vma->vm_start = start; vma->vm_end = end; vma->vm_pgoff = pgoff; - /* Note: mas must be pointing to the expanding VMA */ vma_iter_store(vmi, vma); vma_complete(&vp, vmi, vma->vm_mm); @@ -703,19 +701,19 @@ int vma_shrink(struct vma_iterator *vmi, struct vm_area_struct *vma, WARN_ON((vma->vm_start != start) && (vma->vm_end != end)); - if (vma_iter_prealloc(vmi)) + if (vma->vm_start < start) + vma_iter_config(vmi, vma->vm_start, start); + else + vma_iter_config(vmi, end, vma->vm_end); + + if (vma_iter_prealloc(vmi, NULL)) return -ENOMEM; init_vma_prep(&vp, vma); vma_prepare(&vp); vma_adjust_trans_huge(vma, start, end, 0); - if (vma->vm_start < start) - vma_iter_clear(vmi, vma->vm_start, start); - - if (vma->vm_end > end) - vma_iter_clear(vmi, end, vma->vm_end); - + vma_iter_clear(vmi); vma->vm_start = start; vma->vm_end = end; vma->vm_pgoff = pgoff; @@ -991,7 +989,17 @@ struct vm_area_struct *vma_merge(struct vma_iterator *vmi, struct mm_struct *mm, if (err) return NULL; - if (vma_iter_prealloc(vmi)) + if (vma_start < vma->vm_start || vma_end > vma->vm_end) + vma_expanded = true; + + if (vma_expanded) { + vma_iter_config(vmi, vma_start, vma_end); + } else { + vma_iter_config(vmi, adjust->vm_start + adj_start, + adjust->vm_end); + } + + if (vma_iter_prealloc(vmi, vma)) return NULL; init_multi_vma_prep(&vp, vma, adjust, remove, remove2); @@ -1000,8 +1008,6 @@ struct vm_area_struct *vma_merge(struct vma_iterator *vmi, struct mm_struct *mm, vma_prepare(&vp); vma_adjust_trans_huge(vma, vma_start, vma_end, adj_start); - if (vma_start < vma->vm_start || vma_end > vma->vm_end) - vma_expanded = true; vma->vm_start = vma_start; vma->vm_end = vma_end; @@ -1945,7 +1951,7 @@ int expand_upwards(struct vm_area_struct *vma, unsigned long address) struct vm_area_struct *next; unsigned long gap_addr; int error = 0; - MA_STATE(mas, &mm->mm_mt, 0, 0); + MA_STATE(mas, &mm->mm_mt, vma->vm_start, address); if (!(vma->vm_flags & VM_GROWSUP)) return -EFAULT; @@ -1970,6 +1976,10 @@ int expand_upwards(struct vm_area_struct *vma, unsigned long address) /* Check that both stack segments have the same anon_vma? */ } + if (next) + mas_prev_range(&mas, address); + + __mas_set_range(&mas, vma->vm_start, address - 1); if (mas_preallocate(&mas, vma, GFP_KERNEL)) return -ENOMEM; @@ -2013,7 +2023,6 @@ int expand_upwards(struct vm_area_struct *vma, unsigned long address) anon_vma_interval_tree_pre_update_vma(vma); vma->vm_end = address; /* Overwrite old entry in mtree. */ - mas_set_range(&mas, vma->vm_start, address - 1); mas_store_prealloc(&mas, vma); anon_vma_interval_tree_post_update_vma(vma); spin_unlock(&mm->page_table_lock); @@ -2052,6 +2061,10 @@ int expand_downwards(struct vm_area_struct *vma, unsigned long address) return -ENOMEM; } + if (prev) + mas_next_range(&mas, vma->vm_start); + + __mas_set_range(&mas, address, vma->vm_end - 1); if (mas_preallocate(&mas, vma, GFP_KERNEL)) return -ENOMEM; @@ -2096,7 +2109,6 @@ int expand_downwards(struct vm_area_struct *vma, unsigned long address) vma->vm_start = address; vma->vm_pgoff -= grow; /* Overwrite old entry in mtree. */ - mas_set_range(&mas, address, vma->vm_end - 1); mas_store_prealloc(&mas, vma); anon_vma_interval_tree_post_update_vma(vma); spin_unlock(&mm->page_table_lock); @@ -2255,10 +2267,6 @@ int __split_vma(struct vma_iterator *vmi, struct vm_area_struct *vma, if (!new) return -ENOMEM; - err = -ENOMEM; - if (vma_iter_prealloc(vmi)) - goto out_free_vma; - if (new_below) { new->vm_end = addr; } else { @@ -2266,6 +2274,11 @@ int __split_vma(struct vma_iterator *vmi, struct vm_area_struct *vma, new->vm_pgoff += ((addr - vma->vm_start) >> PAGE_SHIFT); } + err = -ENOMEM; + vma_iter_config(vmi, new->vm_start, new->vm_end); + if (vma_iter_prealloc(vmi, new)) + goto out_free_vma; + err = vma_dup_policy(vma, new); if (err) goto out_free_vmi; @@ -2600,8 +2613,12 @@ unsigned long mmap_region(struct file *file, unsigned long addr, next = vma_next(&vmi); prev = vma_prev(&vmi); - if (vm_flags & VM_SPECIAL) + if (vm_flags & VM_SPECIAL) { + if (prev) + vma_iter_next_range(&vmi); + goto cannot_expand; + } /* Attempt to expand an old mapping */ /* Check next */ @@ -2611,6 +2628,7 @@ unsigned long mmap_region(struct file *file, unsigned long addr, merge_end = next->vm_end; vma = next; vm_pgoff = next->vm_pgoff - pglen; + } /* Check prev */ @@ -2622,9 +2640,10 @@ unsigned long mmap_region(struct file *file, unsigned long addr, merge_start = prev->vm_start; vma = prev; vm_pgoff = prev->vm_pgoff; + } else if (prev) { + vma_iter_next_range(&vmi); } - /* Actually expand, if possible */ if (vma && !vma_expand(&vmi, vma, merge_start, merge_end, vm_pgoff, next)) { @@ -2633,9 +2652,6 @@ unsigned long mmap_region(struct file *file, unsigned long addr, } cannot_expand: - if (prev) - vma_iter_next_range(&vmi); - /* * Determine the object being mapped and call the appropriate * specific mapper. the address has already been validated, but @@ -2721,7 +2737,7 @@ unsigned long mmap_region(struct file *file, unsigned long addr, goto close_and_free_vma; error = -ENOMEM; - if (vma_iter_prealloc(&vmi)) + if (vma_iter_prealloc(&vmi, vma)) goto close_and_free_vma; if (vma->vm_file) @@ -2994,7 +3010,8 @@ static int do_brk_flags(struct vma_iterator *vmi, struct vm_area_struct *vma, if (vma && vma->vm_end == addr && !vma_policy(vma) && can_vma_merge_after(vma, flags, NULL, NULL, addr >> PAGE_SHIFT, NULL_VM_UFFD_CTX, NULL)) { - if (vma_iter_prealloc(vmi)) + vma_iter_config(vmi, vma->vm_start, addr + len); + if (vma_iter_prealloc(vmi, vma)) goto unacct_fail; init_vma_prep(&vp, vma); @@ -3009,6 +3026,8 @@ static int do_brk_flags(struct vma_iterator *vmi, struct vm_area_struct *vma, goto out; } + if (vma) + vma_iter_next_range(vmi); /* create a vma struct for an anonymous mapping */ vma = vm_area_alloc(mm); if (!vma) diff --git a/mm/nommu.c b/mm/nommu.c index a764b86b132a..a96b889cc17e 100644 --- a/mm/nommu.c +++ b/mm/nommu.c @@ -583,7 +583,8 @@ static int delete_vma_from_mm(struct vm_area_struct *vma) { VMA_ITERATOR(vmi, vma->vm_mm, vma->vm_start); - if (vma_iter_prealloc(&vmi)) { + vma_iter_config(&vmi, vma->vm_start, vma->vm_end); + if (vma_iter_prealloc(&vmi, vma)) { pr_warn("Allocation of vma tree for process %d failed\n", current->pid); return -ENOMEM; @@ -591,7 +592,7 @@ static int delete_vma_from_mm(struct vm_area_struct *vma) cleanup_vma_from_mm(vma); /* remove from the MM's tree and list */ - vma_iter_clear(&vmi, vma->vm_start, vma->vm_end); + vma_iter_clear(&vmi); return 0; } /* @@ -1041,9 +1042,6 @@ unsigned long do_mmap(struct file *file, if (!vma) goto error_getting_vma; - if (vma_iter_prealloc(&vmi)) - goto error_vma_iter_prealloc; - region->vm_usage = 1; region->vm_flags = vm_flags; region->vm_pgoff = pgoff; @@ -1185,6 +1183,10 @@ unsigned long do_mmap(struct file *file, share: BUG_ON(!vma->vm_region); + vma_iter_config(&vmi, vma->vm_start, vma->vm_end); + if (vma_iter_prealloc(&vmi, vma)) + goto error_just_free; + setup_vma_to_mm(vma, current->mm); current->mm->map_count++; /* add the VMA to the tree */ @@ -1231,14 +1233,6 @@ unsigned long do_mmap(struct file *file, len, current->pid); show_free_areas(0, NULL); return -ENOMEM; - -error_vma_iter_prealloc: - kmem_cache_free(vm_region_jar, region); - vm_area_free(vma); - pr_warn("Allocation of vma tree for process %d failed\n", current->pid); - show_free_areas(0, NULL); - return -ENOMEM; - } unsigned long ksys_mmap_pgoff(unsigned long addr, unsigned long len, @@ -1323,12 +1317,6 @@ int split_vma(struct vma_iterator *vmi, struct vm_area_struct *vma, if (!new) goto err_vma_dup; - if (vma_iter_prealloc(vmi)) { - pr_warn("Allocation of vma tree for process %d failed\n", - current->pid); - goto err_vmi_preallocate; - } - /* most fields are the same, copy all, and then fixup */ *region = *vma->vm_region; new->vm_region = region; @@ -1342,6 +1330,13 @@ int split_vma(struct vma_iterator *vmi, struct vm_area_struct *vma, region->vm_pgoff = new->vm_pgoff += npages; } + vma_iter_config(vmi, new->vm_start, new->vm_end); + if (vma_iter_prealloc(vmi, vma)) { + pr_warn("Allocation of vma tree for process %d failed\n", + current->pid); + goto err_vmi_preallocate; + } + if (new->vm_ops && new->vm_ops->open) new->vm_ops->open(new); From patchwork Thu Jun 1 02:16:02 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Liam R. Howlett" X-Patchwork-Id: 101652 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:994d:0:b0:3d9:f83d:47d9 with SMTP id k13csp6712vqr; Wed, 31 May 2023 19:26:41 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ7VQtjKlAg8GACXbY5ZHkisV20POdZWlBy14xQx4WrDEGw/+x+IrJdbuplEyFdh1U2Sj4d7 X-Received: by 2002:ac8:7dc4:0:b0:3e6:3851:b945 with SMTP id c4-20020ac87dc4000000b003e63851b945mr7317323qte.67.1685586400950; Wed, 31 May 2023 19:26:40 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1685586400; cv=pass; d=google.com; s=arc-20160816; b=KSy5VTQkL1x+vPQlB6eKjVD+yxX7o9YtSTnqyOYMIKc4jcF2Bl+AECSn/rPWiYAERw /v9NKFWFby0Rjqx1WEbdK+latm7gZvje2f2mSo6YYdrCtfFjbDOUKZ8E4Pgp19SruVJO Nr1TpOBOqgTEHD96RU7gjylUUhuhAZWZSUn5dwqrhHFr8nMUVhbXXjixRsuRvFLIAlmW I+BGRDQlugNfMhcKNCIYHgweD+Y2mg9YuIMGat4xqAjGOvqvEp3QaPQnNQIwyGj96BF9 bPs3JW7pl7cyA/dMUeB1SjAZUa2HUzGeF6aBIuGE1XFo8j/BiKc6gZFKL6tbE8AGbvR1 zSNg== 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 :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature:dkim-signature; bh=4TFsZxvWPLZuKl+HYTGeXJqxloynMHdkzDhHBBsiyww=; b=hmvhjnFnq62evAAos0MVkBalupC3OK6vnMpy2z0tcg30HWchMZFAYkgMWNldQKPJzP mMl8vNWuPdJqTQCEzUgTuQGrORsAGCpn3gwEeKX8TLeL3rtAzeStK29DKk/4kF/qOTNE VhmYzf6BOJc7aXzBuFsd5v6zk6aUlWCF0/lV1vhyV1KGIgJhKFV1Rcc2/bfsWVcrMnQx 6TeLWorDGgsXKOprt8+nE4snxs4w8v0H9j8tlcesokHoPI69No4v978qnVNN0+L5oCmC G6jOqb0gPRpxZa794thENvR4NMghrS1jKNuRLKlDbsFMCLpsmB47LuklhJWKaNHrtM6N HSsQ== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@oracle.com header.s=corp-2023-03-30 header.b=pM1A5Zxu; dkim=pass header.i=@oracle.onmicrosoft.com header.s=selector2-oracle-onmicrosoft-com header.b=ATTp6Vlm; 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 w8-20020a63f508000000b0053f212830aesi2027437pgh.311.2023.05.31.19.26.27; Wed, 31 May 2023 19:26:40 -0700 (PDT) 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-2023-03-30 header.b=pM1A5Zxu; dkim=pass header.i=@oracle.onmicrosoft.com header.s=selector2-oracle-onmicrosoft-com header.b=ATTp6Vlm; 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 S229702AbjFACRg (ORCPT + 99 others); Wed, 31 May 2023 22:17:36 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:51570 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230471AbjFACRN (ORCPT ); Wed, 31 May 2023 22:17:13 -0400 Received: from mx0a-00069f02.pphosted.com (mx0a-00069f02.pphosted.com [205.220.165.32]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 6F218185 for ; Wed, 31 May 2023 19:16:51 -0700 (PDT) Received: from pps.filterd (m0246629.ppops.net [127.0.0.1]) by mx0b-00069f02.pphosted.com (8.17.1.19/8.17.1.19) with ESMTP id 34VKIEjf032508; Thu, 1 Jun 2023 02:16:48 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-03-30; bh=4TFsZxvWPLZuKl+HYTGeXJqxloynMHdkzDhHBBsiyww=; b=pM1A5ZxuvU7AaIqbTAMcAI0YUFgGI1A72gx/be9cuAQIui/y++G/OlvlqaClovGws4lu kaLtHrbMLpis1VUPukSVNYdwRzDI/DQPD5HYvvs2gR7AEXtHZfWXSDk1ZKMeByEP2JtL GhiAIZBhu23d9Ry3kuayfT1n60FpI9mnb0pjQAmdF17KShN0Cja4rOgk1r9829Jqq1DB bEBMYV0ItoteQX8s3VaSJtjOnouMYBX0IDo1IuI0fHFYkDf+WiI+2kHO1ZKo+2vu7I07 WnNLH5LLml0J3AHsLN+R8sJ/d8vWj5trglutzmu/dVykhmzoIMLMyUZhUGxRIU+vOsqw zA== Received: from iadpaimrmta02.imrmtpd1.prodappiadaev1.oraclevcn.com (iadpaimrmta02.appoci.oracle.com [147.154.18.20]) by mx0b-00069f02.pphosted.com (PPS) with ESMTPS id 3qvhb97hvh-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Thu, 01 Jun 2023 02:16:48 +0000 Received: from pps.filterd (iadpaimrmta02.imrmtpd1.prodappiadaev1.oraclevcn.com [127.0.0.1]) by iadpaimrmta02.imrmtpd1.prodappiadaev1.oraclevcn.com (8.17.1.19/8.17.1.19) with ESMTP id 3510GXSa000395; Thu, 1 Jun 2023 02:16:46 GMT Received: from nam12-mw2-obe.outbound.protection.outlook.com (mail-mw2nam12lp2046.outbound.protection.outlook.com [104.47.66.46]) by iadpaimrmta02.imrmtpd1.prodappiadaev1.oraclevcn.com (PPS) with ESMTPS id 3qu8qb17gj-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Thu, 01 Jun 2023 02:16:46 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=F3nAspeCc6KlGSdq1OS4jWcA/uRLUcE7Cj+fvGd7LAUGFlL65XQ03HKoEnzI6ua7JCUnVKKnf8zXKIixkZANeELszSYFg3Cc/j8c3JMYeFXcpF0xu7CaLbxKqIDenu39c52SGe+aem04yHlOUGXjxlPCbnECMdD/8xuVEru/sEnP2ht1MF7dKwEMOGRDqHqBvYKzBFx36DT69BP8AZY1XD9S0a3SwRxOChr4B2A3MqCqEyJ78qDDVkpaVbefTFQlze5w868WLshiqBExOf7UMb47X9ASKOfyLR2n3nKsexX4+MEePo/3XBUooBvZOawmVoSFS67pOJxYhWkW5wo12A== 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=4TFsZxvWPLZuKl+HYTGeXJqxloynMHdkzDhHBBsiyww=; b=W196DDG5GaQBirKQRwbjYgxGB4vWc73Shv03BloxujnKAU/6rXnIP2x5a3Stsy8c5gOPxLCPIESWRbcPNHiyOEo1Hvm2GsH6gcrBnpduiY0MmYXrJ01zXcbfekbJWXu5IPbEqmqHRWv/giKIgXqjiRvtEn9RWqSH6wBVPqeHVCotdaK/7fqOcHdufTZQ4M7LyogV3iS7g2x2J3AKR1Uh70kLIHe1rRO8bXnjBhDKOFYKCsz8d29Nic8I7Ss7lbP+4iUuy95pQJn/krPv/Mx95ih4u+cYleoewXL4XsgT64D3ex9oWr0i5T8r5tMhuoIylcj61ku7WAIATUjx513+0w== 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=4TFsZxvWPLZuKl+HYTGeXJqxloynMHdkzDhHBBsiyww=; b=ATTp6VlmuB8ZHPalWJ6wdlV5Bt5OkBmRAXs7USAMyL6PC9/olD8dd94i77o1AytEJAQs9bmO52S/zhugdmHwyMcdHhAlx4FoYij/Rx+mpRngJ3F1aR17suZnNPk0IaKgXJre7X6H6anM+JWl7KRPRrWUgFGrCD7Sf7gcroMUU04= Received: from SN6PR10MB3022.namprd10.prod.outlook.com (2603:10b6:805:d8::25) by SJ0PR10MB4687.namprd10.prod.outlook.com (2603:10b6:a03:2d8::12) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6455.23; Thu, 1 Jun 2023 02:16:44 +0000 Received: from SN6PR10MB3022.namprd10.prod.outlook.com ([fe80::998f:d221:5fb6:c67d]) by SN6PR10MB3022.namprd10.prod.outlook.com ([fe80::998f:d221:5fb6:c67d%7]) with mapi id 15.20.6433.024; Thu, 1 Jun 2023 02:16:44 +0000 From: "Liam R. Howlett" To: Andrew Morton Cc: maple-tree@lists.infradead.org, linux-mm@kvack.org, linux-kernel@vger.kernel.org, "Liam R. Howlett" Subject: [PATCH 11/14] maple_tree: Move mas_wr_end_piv() below mas_wr_extend_null() Date: Wed, 31 May 2023 22:16:02 -0400 Message-Id: <20230601021605.2823123-12-Liam.Howlett@oracle.com> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20230601021605.2823123-1-Liam.Howlett@oracle.com> References: <20230601021605.2823123-1-Liam.Howlett@oracle.com> X-ClientProxiedBy: YT4PR01CA0350.CANPRD01.PROD.OUTLOOK.COM (2603:10b6:b01:fc::20) To SN6PR10MB3022.namprd10.prod.outlook.com (2603:10b6:805:d8::25) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: SN6PR10MB3022:EE_|SJ0PR10MB4687:EE_ X-MS-Office365-Filtering-Correlation-Id: 0823f243-7bec-4265-3f17-08db62463ead X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: wElmbrN/2vBN3FK8K0/CaezvffvIb9tQ9InzW2OZhlwjm3ip3GW3v9Lsk/pypEnjRxvrLyD9yvwN+5JI6rnq1We7lQtjpxc+T6vmUxZhgkYImv0MABS30dWIPgNz6Uxze69qDhIvLxKErSRF454CB4fh37LnQW1Kck/ezn51SziJf/kphoeVdcTB9RXWaOr4y3UCkAoQXoe5/gvIa1lotuALgRdmB7UnK6quDhdqfaNDRwYpPjEJ/tqeMPOgnRQ/ThRVZwEbOR3alr3MAstiWHxZxoWfegcrBYk9sjWx1fWd4Lq2QAYcsNsYXyaqq3kEc65cR1pciOIeOjHlyC1pmDbZewTxO5gC7BWoFYlLhnDJnb693lOgUvNTXWQjbv1VwqqMhN3R78YGQYxHD2+PYAf6eMZeC/BY4YXLuu0Hb3QOEpE16Hnd8qN9E2vJI6coqrJGuS95w+Hvaaq2Q8bMwlc0G3AlQUJxIcHgzfbDSpaOfHxrrpLYlgKZi7QqSTpya/efsxV3RtHZoT2cv/3Z6SmP/9VPTNIBw0mQEmn3TMY1YDVh7kmM1kkARn4IJpnL 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:(13230028)(396003)(39860400002)(136003)(346002)(376002)(366004)(451199021)(36756003)(38100700002)(86362001)(8936002)(8676002)(41300700001)(107886003)(5660300002)(26005)(1076003)(6506007)(6512007)(2906002)(186003)(2616005)(83380400001)(6666004)(6486002)(66556008)(66476007)(66946007)(316002)(478600001)(6916009)(4326008);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: XotL4NPDDPjRxuvXlsapMIYZ/LHMQ2osz6DER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qR/+oWSYwDZ1ZiwvwOijYmmxMG/2cinE5ZMXzwAUksD6vWiPO8Vc/Yqzv6N7mOxAxNBFIbUXZ5gJdftZH8oXOcwGEXQlIxh6gQpf042KpC9DEpT4xxNbaOC50qVwXYHXxty9zELKtR7QEPnucdrCQZ/bTA3bzinRpF7rRfFSJvpung1IBEsHuxDZmYJSFMjcVYUf/APs3YPVOibBoqnJ9xExLyQA0+2QA32HTIl99uSMIDX+lNcp3VOJW0nTIzO56A0H/CY8chRkVtkSC6InkbvCGPtZrFZhbXIrHwtqOGd7FozaZgseuD3T0w2zFtVMXfZQNjCfaXzpSPQdQVmp3Bz0FqKxYvjua15q7h38s4BaaCUlRghNFq0i+SMeVS1Z7RDz8w2aKno1TZB51IheKoiEwtIoBd3b8bGwg4kCY+QQ== X-OriginatorOrg: oracle.com X-MS-Exchange-CrossTenant-Network-Message-Id: 0823f243-7bec-4265-3f17-08db62463ead X-MS-Exchange-CrossTenant-AuthSource: SN6PR10MB3022.namprd10.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 01 Jun 2023 02:16:44.3309 (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: R6BJQ73z9Mrg8d5wP7VQgVXgbmbjWN9MzZ1B7nDjQN9MfAhh1fF5BGqNhweEkRe7h21F09NikHoIxJUpP1nkXg== X-MS-Exchange-Transport-CrossTenantHeadersStamped: SJ0PR10MB4687 X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.254,Aquarius:18.0.957,Hydra:6.0.573,FMLib:17.11.176.26 definitions=2023-05-31_18,2023-05-31_03,2023-05-22_02 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 bulkscore=0 mlxscore=0 mlxlogscore=999 suspectscore=0 malwarescore=0 adultscore=0 phishscore=0 spamscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2304280000 definitions=main-2306010016 X-Proofpoint-GUID: _2xj_LCbJZY3wadi2aao3ZIQYNZjATUN X-Proofpoint-ORIG-GUID: _2xj_LCbJZY3wadi2aao3ZIQYNZjATUN 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_H5,RCVD_IN_MSPIKE_WL,SPF_HELO_NONE,SPF_NONE, T_SCC_BODY_TEXT_LINE 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: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1767465446249006379?= X-GMAIL-MSGID: =?utf-8?q?1767465446249006379?= Relocate it and call mas_wr_extend_null() from within mas_wr_end_piv(). Extending the NULL may affect the end pivot value so call mas_wr_endtend_null() from within mas_wr_end_piv() to keep it all together. Signed-off-by: Liam R. Howlett --- lib/maple_tree.c | 31 +++++++++++++++---------------- 1 file changed, 15 insertions(+), 16 deletions(-) diff --git a/lib/maple_tree.c b/lib/maple_tree.c index 34eccddb0b47..adf662bc413e 100644 --- a/lib/maple_tree.c +++ b/lib/maple_tree.c @@ -4197,18 +4197,6 @@ static inline bool mas_wr_slot_store(struct ma_wr_state *wr_mas) return true; } -static inline void mas_wr_end_piv(struct ma_wr_state *wr_mas) -{ - while ((wr_mas->offset_end < wr_mas->node_end) && - (wr_mas->mas->last > wr_mas->pivots[wr_mas->offset_end])) - wr_mas->offset_end++; - - if (wr_mas->offset_end < wr_mas->node_end) - wr_mas->end_piv = wr_mas->pivots[wr_mas->offset_end]; - else - wr_mas->end_piv = wr_mas->mas->max; -} - static inline void mas_wr_extend_null(struct ma_wr_state *wr_mas) { struct ma_state *mas = wr_mas->mas; @@ -4245,6 +4233,21 @@ static inline void mas_wr_extend_null(struct ma_wr_state *wr_mas) } } +static inline void mas_wr_end_piv(struct ma_wr_state *wr_mas) +{ + while ((wr_mas->offset_end < wr_mas->node_end) && + (wr_mas->mas->last > wr_mas->pivots[wr_mas->offset_end])) + wr_mas->offset_end++; + + if (wr_mas->offset_end < wr_mas->node_end) + wr_mas->end_piv = wr_mas->pivots[wr_mas->offset_end]; + else + wr_mas->end_piv = wr_mas->mas->max; + + if (!wr_mas->entry) + mas_wr_extend_null(wr_mas); +} + static inline unsigned char mas_wr_new_end(struct ma_wr_state *wr_mas) { struct ma_state *mas = wr_mas->mas; @@ -4377,10 +4380,6 @@ static inline void *mas_wr_store_entry(struct ma_wr_state *wr_mas) /* At this point, we are at the leaf node that needs to be altered. */ mas_wr_end_piv(wr_mas); - - if (!wr_mas->entry) - mas_wr_extend_null(wr_mas); - /* New root for a single pointer */ if (unlikely(!mas->index && mas->last == ULONG_MAX)) { mas_new_root(mas, wr_mas->entry); From patchwork Thu Jun 1 02:16:03 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Liam R. Howlett" X-Patchwork-Id: 101655 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:994d:0:b0:3d9:f83d:47d9 with SMTP id k13csp9280vqr; Wed, 31 May 2023 19:39:45 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ4KJaPyO7dlh+aTPecfKTkW0qvG15+MtGIQ0cczkVXa7V5womW4vCXKVV7x9+hebFctHJcm X-Received: by 2002:a05:6358:4408:b0:123:4e5e:d65 with SMTP id z8-20020a056358440800b001234e5e0d65mr4482766rwc.10.1685587184897; Wed, 31 May 2023 19:39:44 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1685587184; cv=pass; d=google.com; s=arc-20160816; b=PhyFhqRUkUNYSP6Ib3heB6c9PsvvAEIXD6sQ4Z0ME6pyZ6BPRDJf3OLrtiIhJTKCgx jDuBv+2TYOlfksxTg7rYPaVbOeqdRfGgdINbrOTdLUtOxVQJzDiCrsvWw/jdZPalEsN7 1uUqWiK7BB1BGQv4so/JoePIloIOgBAWuYDTAM/wzS25GQb3pjNgJipGfX51z21FidGb NIJ6jE/jFUqLkEEWA1fSoAPpXxletjukfCuYinPSw8DxhNEm/5OBVFVRonXgDrYhHP3I pFqJ0LQjYH6D7Pim0yARkS1dir5QOJWxg+CbxPAcWLkHgjm0ETpZ03ClAE4W2gtmQUrH F+mw== 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 :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature:dkim-signature; bh=FGEQzS2ZqtOSuXKdUJZz96qlDHQ0UK9ObJRJifyRxVs=; b=AtWfblBiqlOWanw4az/LgeyAO8QE11GES8RCeDq1A9ykcDaeC77UPKDjd1rmAzaRGG ewjqUtnDPWc2eZ0Po7Vf/xWDOvqZdVMvbbfi47fEi4NXEfybZ1R7WJxloxYWdXxZn8tR jivDUao5VXN6ZyQ6CIXRZdO4Iv9WH6cUSh/VlmIQygi4qiFLAU41LHNnE0blXdN9uz5U LFnrC6vn9Y4PV2pzBAI79Z1cphxsA+cky71ankSbVfsYo2OCgLdMcS2MTbJqUmvopH8S qmrTY3MPCHy1bGyfqiL76xKst/ETM6sP4cLkqE3ZUWFvzLVJ8san9uLRxXVYJgXRCTm6 uOLg== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@oracle.com header.s=corp-2023-03-30 header.b=qgjcg80X; dkim=pass header.i=@oracle.onmicrosoft.com header.s=selector2-oracle-onmicrosoft-com header.b=j19U8xWx; 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 30-20020a17090a191e00b0025352448b95si285484pjg.172.2023.05.31.19.39.29; Wed, 31 May 2023 19:39:44 -0700 (PDT) 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-2023-03-30 header.b=qgjcg80X; dkim=pass header.i=@oracle.onmicrosoft.com header.s=selector2-oracle-onmicrosoft-com header.b=j19U8xWx; 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 S231150AbjFACSO (ORCPT + 99 others); Wed, 31 May 2023 22:18:14 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:51994 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231174AbjFACRt (ORCPT ); Wed, 31 May 2023 22:17:49 -0400 Received: from mx0b-00069f02.pphosted.com (mx0b-00069f02.pphosted.com [205.220.177.32]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id A8CEF184 for ; Wed, 31 May 2023 19:17:12 -0700 (PDT) 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 34VJvOIU031546; Thu, 1 Jun 2023 02:16: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-03-30; bh=FGEQzS2ZqtOSuXKdUJZz96qlDHQ0UK9ObJRJifyRxVs=; b=qgjcg80XP8EfXp0dvMK3U8+Eaubp2W2+20jnFCwWK3cmhBLEy9M4JiYUbyaP6eMnhogR uyUw6qa99NfAY4QdJVr0EnQK87CIH9zMyGFDEJeELP/21iffKlJ4OKk6dUBAWX8ZwfVh FI9OOdE3K4ComtehDHIhnv+PtZsbWeE7qPuY+WiLpMMOEmywGVpiShBIb16FP1W/FhAc SLUmWiJLZOZu6DBQIZ1TG4Z74hgdv+JHavCZ4ZSnaA2SH84AaaAfe3Ouqhq+yIpaFY89 N2ytGMdvTe9GZYKEQTWc4DQyB/Z5vk+opJ4Cv30YlaoE90f5Z9lyHF0+HJTdl6TPrExj 2A== Received: from iadpaimrmta02.imrmtpd1.prodappiadaev1.oraclevcn.com (iadpaimrmta02.appoci.oracle.com [147.154.18.20]) by mx0b-00069f02.pphosted.com (PPS) with ESMTPS id 3qvhj4yhmm-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Thu, 01 Jun 2023 02:16:54 +0000 Received: from pps.filterd (iadpaimrmta02.imrmtpd1.prodappiadaev1.oraclevcn.com [127.0.0.1]) by iadpaimrmta02.imrmtpd1.prodappiadaev1.oraclevcn.com (8.17.1.19/8.17.1.19) with ESMTP id 35116JEH000447; Thu, 1 Jun 2023 02:16:54 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 3qu8qb17j9-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Thu, 01 Jun 2023 02:16:54 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=RsAEPCaImibpTnXH3zeIMYVKBYVPxHZQxymPD8Fkm3b2NUAmqZDLjNEWLIUqD3IjWmN7nXuLKnp1tWwS7FjMpIA8EU1EsNdVzzrp6Ph7+2o1LTsSbbT9VO8Ct0Nv+1aFQ0Jq6ytM5Rzd4EFYnDYwhCjJWQKTUos1vVPKot+EO1bHDVnV5GYEZJ87F1NVaWBsj3Gi7JCb8F4s02BqXsL4la5IP0GzAcgMY1oVg4Y0vjCTilh0/gekPXYicx/J4NtHMs6oRl3S0zcK9ff9PvVNXvFpmFuikqmfYRILa5fkxlUCxucSDJ6D34DQmjZF+ThbusTCFcUca7CMaiRV+Kt9jg== 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=FGEQzS2ZqtOSuXKdUJZz96qlDHQ0UK9ObJRJifyRxVs=; b=cuYVSxXDWkQR0VXCUwMEc2cFkvjcU1/ysoN42YH+Or32cHrct/LFCnPuV6aInnBVGq7PGL78GRGp5MPv4ROtJ4aJc5XdkIi7Jse1XfhSYOkCEdZhSd2b9M1bY3nLTDcdUmHQzimS4jHk2jiVQ4nDLkXwmEm/C/SVScDbHkjArV6qr3LGfzNJBV9f2FKn/5CNlBwQVokkBOfs8/jSzqY8tD0kC4IhDAHWwN+vgbkvF3vrQbK+PNNsu8uGkRTl2UIpQ16Oowq2PXOV5LoYKzSw90pDZOEKLmahW0Lql3EETAly/1K1pTkB4/71xmu0Enh9mZJgSZrQB62Vvc9k6GuZIw== 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=FGEQzS2ZqtOSuXKdUJZz96qlDHQ0UK9ObJRJifyRxVs=; b=j19U8xWxBSYY+Y1Lc1jMwql/tQxm7HJCZuaDYi3FruGNRqiaHZNVTk+JJ4QdUTwgFFMEItr46XHFH56YbzN6tE9irSiymANZpI/45A+oxZvKc/4d2HpZ+J6HhX8TDLdAT7NBauAzvgRh1xiDZJzRLxqAZhaCTYODA+ovLBgq5pA= Received: from SN6PR10MB3022.namprd10.prod.outlook.com (2603:10b6:805:d8::25) by SJ0PR10MB4687.namprd10.prod.outlook.com (2603:10b6:a03:2d8::12) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6455.23; Thu, 1 Jun 2023 02:16:46 +0000 Received: from SN6PR10MB3022.namprd10.prod.outlook.com ([fe80::998f:d221:5fb6:c67d]) by SN6PR10MB3022.namprd10.prod.outlook.com ([fe80::998f:d221:5fb6:c67d%7]) with mapi id 15.20.6433.024; Thu, 1 Jun 2023 02:16:46 +0000 From: "Liam R. Howlett" To: Andrew Morton Cc: maple-tree@lists.infradead.org, linux-mm@kvack.org, linux-kernel@vger.kernel.org, "Liam R. Howlett" Subject: [PATCH 12/14] maple_tree: Update mas_preallocate() testing Date: Wed, 31 May 2023 22:16:03 -0400 Message-Id: <20230601021605.2823123-13-Liam.Howlett@oracle.com> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20230601021605.2823123-1-Liam.Howlett@oracle.com> References: <20230601021605.2823123-1-Liam.Howlett@oracle.com> X-ClientProxiedBy: YT4PR01CA0346.CANPRD01.PROD.OUTLOOK.COM (2603:10b6:b01:fc::16) To SN6PR10MB3022.namprd10.prod.outlook.com (2603:10b6:805:d8::25) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: SN6PR10MB3022:EE_|SJ0PR10MB4687:EE_ X-MS-Office365-Filtering-Correlation-Id: cf938d25-5525-42c8-00c4-08db6246401a X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: QIOiZenpDZWn8zsqDf3pOh/DO8ApqnUHEqbvA4gCO9/SDF2HRfgFLib0ijVvOXrSwjmeUAxxgEevFhJ9r7Vzogtkq4pjyw41SCifBFRCReXq1VmFrP6s9Cat2Ep7ttTI5Ner3CQCiOsyQnuvwMBCZ2Ut6+iZOjne8ZaPxpycEhefgtCK1TtxwooqjO8KIDwb6u8H9RAwp4uUGppjXLUAFODwPIR3A55urdgyHTh+8EoO6UglAgXxKfVi7AtoR74zIh0uwkArbZkkQ8pTOreoq/cddhy5cNI2SdfeDCP/GfUey07zjrgTWfwrP/jhYq7FvPg4MY0qQItwvMudc9Tga+/RSjqGexf66qgZvAbINbyzE51mhz7FOi89y/3xr6Wt4f2io3gw5mZG1zQaZv7sYHExOWw6WS/GvxI7wfWgFaWmxVW695AYJvq+Dj1vygyRjGkifJT5duHKQVIC3KI4GuZ/VWHwE1CC/TShHFkzfZydk2hdyRU75gw7RhYtt6raHEw9c8rKQ6Egk9fwaAWtKJsQrh2sGNKQ52JGZF8fsre9NmRAnyR71IHlGe7Gf35k 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:(13230028)(396003)(39860400002)(136003)(346002)(376002)(366004)(451199021)(36756003)(38100700002)(86362001)(8936002)(8676002)(41300700001)(107886003)(5660300002)(26005)(1076003)(6506007)(6512007)(2906002)(186003)(2616005)(83380400001)(6666004)(6486002)(66556008)(66476007)(66946007)(316002)(478600001)(6916009)(4326008);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-M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krUAslmM+sLMo2cpR0jFkmy63sEOY/wspWKIGVd/lBuU0bgZbOikD9T2ozyEQaQYFbZuFnHgYABix72aeKzEbUuQwmynGRteRaGEKODUIbdpOJyURenEOaDeoYL4Uh+0lqkvbjVFlKASfirrpS1mtQpqwBA8LB8LTjxh4qiwwJuONbE3zgMzSb5fX5wZ6ACL+rghKM1YP8mqvPweq0VoVWuPiWFK8RB+QjUavr/N1Vf2KqaEyxIAUDKmh9qJcTWoJbLYKmUlySLrMC3ZjB1M7JzkZvt3P1HAlj6RpyC0KCYzERBAC8dEYk6+D69TzKdqgogFD3GphsPdtxhn/2C2TzdpF53i5UHKO5svc88U1mm1Q6YXhcPkAEd+clVdxa8qo1xExTqYmgDpOlFSDIPeF8rm3iXLNLUnQdydzR98b8Ae5xR+z6CoLhBQxUNAsOP9AMfTfk/ntk/9/Tv+cUgLwgV8JmI6ngP48JUmw== X-OriginatorOrg: oracle.com X-MS-Exchange-CrossTenant-Network-Message-Id: cf938d25-5525-42c8-00c4-08db6246401a X-MS-Exchange-CrossTenant-AuthSource: SN6PR10MB3022.namprd10.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 01 Jun 2023 02:16:46.7128 (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: RE64aboa1KYXYHTEN6vxcAhWqCPGeSkYVGi2IxywEYQQ9B1/B6CAAfsRsekCRcAlhTv8rzNUUzPHQn7bJnGvRQ== X-MS-Exchange-Transport-CrossTenantHeadersStamped: SJ0PR10MB4687 X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.254,Aquarius:18.0.957,Hydra:6.0.573,FMLib:17.11.176.26 definitions=2023-05-31_18,2023-05-31_03,2023-05-22_02 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 bulkscore=0 mlxscore=0 mlxlogscore=999 suspectscore=0 malwarescore=0 adultscore=0 phishscore=0 spamscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2304280000 definitions=main-2306010016 X-Proofpoint-GUID: yxWeFdedYE3QSHAAJHXDI6NmtaRUDcBt X-Proofpoint-ORIG-GUID: yxWeFdedYE3QSHAAJHXDI6NmtaRUDcBt 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_H5,RCVD_IN_MSPIKE_WL,SPF_HELO_NONE,SPF_NONE, T_SCC_BODY_TEXT_LINE 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: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1767466267732613164?= X-GMAIL-MSGID: =?utf-8?q?1767466267732613164?= Signed-off-by: Liam R. Howlett --- tools/testing/radix-tree/maple.c | 27 ++++++++++++++++----------- 1 file changed, 16 insertions(+), 11 deletions(-) diff --git a/tools/testing/radix-tree/maple.c b/tools/testing/radix-tree/maple.c index cfadc4b75d51..14d89ba186ee 100644 --- a/tools/testing/radix-tree/maple.c +++ b/tools/testing/radix-tree/maple.c @@ -35383,6 +35383,8 @@ static noinline void __init check_prealloc(struct maple_tree *mt) for (i = 0; i <= max; i++) mtree_test_store_range(mt, i * 10, i * 10 + 5, &i); + /* Spanning store */ + mas_set_range(&mas, 470, 500); MT_BUG_ON(mt, mas_preallocate(&mas, ptr, GFP_KERNEL) != 0); allocated = mas_allocated(&mas); height = mas_mt_height(&mas); @@ -35406,7 +35408,6 @@ static noinline void __init check_prealloc(struct maple_tree *mt) MT_BUG_ON(mt, mas_preallocate(&mas, ptr, GFP_KERNEL) != 0); allocated = mas_allocated(&mas); height = mas_mt_height(&mas); - MT_BUG_ON(mt, allocated == 0); MT_BUG_ON(mt, allocated != 1 + height * 3); mn = mas_pop_node(&mas); MT_BUG_ON(mt, mas_allocated(&mas) != allocated - 1); @@ -35420,7 +35421,6 @@ static noinline void __init check_prealloc(struct maple_tree *mt) MT_BUG_ON(mt, mas_preallocate(&mas, ptr, GFP_KERNEL) != 0); allocated = mas_allocated(&mas); height = mas_mt_height(&mas); - MT_BUG_ON(mt, allocated == 0); MT_BUG_ON(mt, allocated != 1 + height * 3); mn = mas_pop_node(&mas); MT_BUG_ON(mt, mas_allocated(&mas) != allocated - 1); @@ -35434,7 +35434,6 @@ static noinline void __init check_prealloc(struct maple_tree *mt) MT_BUG_ON(mt, mas_preallocate(&mas, ptr, GFP_KERNEL) != 0); allocated = mas_allocated(&mas); height = mas_mt_height(&mas); - MT_BUG_ON(mt, allocated == 0); MT_BUG_ON(mt, allocated != 1 + height * 3); mn = mas_pop_node(&mas); MT_BUG_ON(mt, mas_allocated(&mas) != allocated - 1); @@ -35448,33 +35447,37 @@ static noinline void __init check_prealloc(struct maple_tree *mt) MT_BUG_ON(mt, mas_preallocate(&mas, ptr, GFP_KERNEL) != 0); allocated = mas_allocated(&mas); height = mas_mt_height(&mas); - MT_BUG_ON(mt, allocated == 0); MT_BUG_ON(mt, allocated != 1 + height * 3); mas_store_prealloc(&mas, ptr); MT_BUG_ON(mt, mas_allocated(&mas) != 0); + /* Slot store does not need allocations */ + mas_set_range(&mas, 6, 9); MT_BUG_ON(mt, mas_preallocate(&mas, ptr, GFP_KERNEL) != 0); allocated = mas_allocated(&mas); - height = mas_mt_height(&mas); - MT_BUG_ON(mt, allocated == 0); - MT_BUG_ON(mt, allocated != 1 + height * 3); + MT_BUG_ON(mt, allocated != 0); mas_store_prealloc(&mas, ptr); MT_BUG_ON(mt, mas_allocated(&mas) != 0); + + mas_set_range(&mas, 6, 10); MT_BUG_ON(mt, mas_preallocate(&mas, ptr, GFP_KERNEL) != 0); allocated = mas_allocated(&mas); height = mas_mt_height(&mas); - MT_BUG_ON(mt, allocated == 0); - MT_BUG_ON(mt, allocated != 1 + height * 3); + MT_BUG_ON(mt, allocated != 1); mas_store_prealloc(&mas, ptr); + MT_BUG_ON(mt, mas_allocated(&mas) != 0); + /* Split */ + mas_set_range(&mas, 54, 54); MT_BUG_ON(mt, mas_preallocate(&mas, ptr, GFP_KERNEL) != 0); allocated = mas_allocated(&mas); height = mas_mt_height(&mas); - MT_BUG_ON(mt, allocated == 0); - MT_BUG_ON(mt, allocated != 1 + height * 3); + MT_BUG_ON(mt, allocated != 1 + height * 2); mas_store_prealloc(&mas, ptr); MT_BUG_ON(mt, mas_allocated(&mas) != 0); mt_set_non_kernel(1); + /* Spanning store */ + mas_set_range(&mas, 1, 100); MT_BUG_ON(mt, mas_preallocate(&mas, ptr, GFP_KERNEL & GFP_NOWAIT) == 0); allocated = mas_allocated(&mas); height = mas_mt_height(&mas); @@ -35482,6 +35485,7 @@ static noinline void __init check_prealloc(struct maple_tree *mt) mas_destroy(&mas); + /* Spanning store */ MT_BUG_ON(mt, mas_preallocate(&mas, ptr, GFP_KERNEL) != 0); allocated = mas_allocated(&mas); height = mas_mt_height(&mas); @@ -35489,6 +35493,7 @@ static noinline void __init check_prealloc(struct maple_tree *mt) MT_BUG_ON(mt, allocated != 1 + height * 3); mas_store_prealloc(&mas, ptr); MT_BUG_ON(mt, mas_allocated(&mas) != 0); + mas_set_range(&mas, 0, 200); mt_set_non_kernel(1); MT_BUG_ON(mt, mas_preallocate(&mas, ptr, GFP_KERNEL & GFP_NOWAIT) == 0); allocated = mas_allocated(&mas); From patchwork Thu Jun 1 02:16:04 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Liam R. Howlett" X-Patchwork-Id: 101656 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:994d:0:b0:3d9:f83d:47d9 with SMTP id k13csp9358vqr; Wed, 31 May 2023 19:40:11 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ4kW5ul5tB1gETWFrpDY1IOZ0PGWBFydbYUYALStu5dBamKZICIrxjeWhehn+Z41T4s3xgD X-Received: by 2002:a17:90a:e00b:b0:256:468b:fb50 with SMTP id u11-20020a17090ae00b00b00256468bfb50mr7541051pjy.47.1685587211669; Wed, 31 May 2023 19:40:11 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1685587211; cv=pass; d=google.com; s=arc-20160816; b=WXzvTztzEITbk9li5lXFks/vH1wLV9qAVzzKPtj3uJmTvcisu+p56Dat/BnJ+NSP0B TGSeF4tErv3cmkIXHt8x25jyaotoZ5NmFjAC8oEKyj3c+sJxC0uefBWV8ZA80dJr3XQz V+uxKQsBJEHuENU352s1AFoHzCVQAi0tdGjZQ4Dq4olYRWXnwuWv/ivgDmyiPvrME8SK oXWee5630glP7WYyWcxMxcF8ZEgLYor8prg7nIK1vY+kRLXEKKM0+9wCFJoEJDIo0G2f gbrqWQnM2vWNyDCes5I5ZFUNgx50dDceXKAoT38ajWZrkeqpqehEIJKWI9xMBiR852JV ezdA== 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 :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature:dkim-signature; bh=+CgKikc0zM0ALiJOO2y1mRbuQqUaVFROXh6PVzYHBVU=; b=pjacG39m1OT3nUAG3Y1XV9Q7qT+mXK6QwVKy0iy4ALzTCS+bCAUC7yLYEjzgJFTAra hGXSyKbyA3t4uMknMhy26AXJPyHAwPDYHSsVmDaocKKqZ2osjv7GrbntOSaU9xV89+tU xrYmy5kCeo+a3SJiZh53D4Szgs2nzSZNvRu4SIXRkGMswsWN/wm7Q+FM2AlQqIB6Col5 5QvY+VCyNnF4xEmxs3JR/nNNKcNpzpBB3uCiWXHalRP4BnXN+DoLkrNo1eEtGvBiUL2j KTC248jxOa9aajrd5zchKB5AwMadVAWjKiP1/OhimDfgQOAgU08DxU+tDx5o5iGWUe68 0vJw== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@oracle.com header.s=corp-2023-03-30 header.b=kgYrRywK; dkim=pass header.i=@oracle.onmicrosoft.com header.s=selector2-oracle-onmicrosoft-com header.b=AoRTCCVW; 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 30-20020a17090a191e00b0025352448b95si285484pjg.172.2023.05.31.19.39.57; Wed, 31 May 2023 19:40:11 -0700 (PDT) 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-2023-03-30 header.b=kgYrRywK; dkim=pass header.i=@oracle.onmicrosoft.com header.s=selector2-oracle-onmicrosoft-com header.b=AoRTCCVW; 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 S229873AbjFACSJ (ORCPT + 99 others); Wed, 31 May 2023 22:18:09 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:52000 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231179AbjFACRv (ORCPT ); Wed, 31 May 2023 22:17:51 -0400 Received: from mx0b-00069f02.pphosted.com (mx0b-00069f02.pphosted.com [205.220.177.32]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 06031121 for ; Wed, 31 May 2023 19:17:14 -0700 (PDT) Received: from pps.filterd (m0246632.ppops.net [127.0.0.1]) by mx0b-00069f02.pphosted.com (8.17.1.19/8.17.1.19) with ESMTP id 34VKT4XL016257; Thu, 1 Jun 2023 02:16: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-03-30; bh=+CgKikc0zM0ALiJOO2y1mRbuQqUaVFROXh6PVzYHBVU=; b=kgYrRywKMPDTTAap5I204HTZ+93306VMNk56yo9w+vJfN7+UsR0C8RLwZh/i1ggKRrHW 8NoFO1oB97vm/OlAynnrmh49JsnCMT0HyYHr+aENjMUE3MxcDv1JO7ycu3VmYIwkek0H BgzPdgel41/Q27fF5uaES4UNIlo7MD/3sHNPoCPPhhdnaO2AEkH3xzqBzAYcjzciIGjp nmnFFM1h6/xMJLnj4ZX2ebBbEX5iq8OVjp1wLdIfrWpznNMI1Ye690/CnCJkgFPbz/Zw +dSozAEObYjpPAslkTZsdW8ebwl+btLqb5J1xVCDltO0C5DWBgDX/Uq0WN8QASI2iify 9w== Received: from iadpaimrmta02.imrmtpd1.prodappiadaev1.oraclevcn.com (iadpaimrmta02.appoci.oracle.com [147.154.18.20]) by mx0b-00069f02.pphosted.com (PPS) with ESMTPS id 3qvhmeqhqg-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Thu, 01 Jun 2023 02:16:55 +0000 Received: from pps.filterd (iadpaimrmta02.imrmtpd1.prodappiadaev1.oraclevcn.com [127.0.0.1]) by iadpaimrmta02.imrmtpd1.prodappiadaev1.oraclevcn.com (8.17.1.19/8.17.1.19) with ESMTP id 35116JEI000447; Thu, 1 Jun 2023 02:16:54 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 3qu8qb17j9-2 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Thu, 01 Jun 2023 02:16:54 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=dAP6c0YHSQd1Gb7l9xvIm/Q5olHD6TGxSgpfMdO/oJI21K3QoN9PWq+nq3TbpPoZnC9rpDPZZ7EftCETu4ElV1n+QwD4ivhCAyzG5LlTBmXlxwywANe6j4julllSyyQTcqZ3fDp1/6arRvyOukH0kCdXUrmiNrjpF14WSg1HTbjn0HLZ1Ay+WD/DhnyHBNMFk8FNDBxHrWoHbzNd0ZvjRq/jESNK+RYSC3yn4WZzLjDDRPI/kRqRGDEGLYb8TUVEHdPMS4FHVE8MvMEBl4qxbJwUPJkfDEmRbLxchE9mijrn5qvd0nMjG07cy7ifra/1estus8/75MB3uCU/uiSXKw== 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=+CgKikc0zM0ALiJOO2y1mRbuQqUaVFROXh6PVzYHBVU=; b=UlLDXiOB4RGhMc7Vpyvi58fXDM3IwQGIK6qDFfymPLzo0shXnUh8VtzqdJykwG/Tw/+TunrghkLEC5tDMgYF6rVhgCk9ibPPFI34MDDLdF2/ylAfxeqG8bBAAdQkc8nioN3ZqfgYsJhmwKcINrD2blAAPo5bu3Jn/Cj6X60+KjfYUUxiuo9RzVs/rQJK2Nu/tcIocxe4J1ZDcbc1f0pQ94lIPooOOzZzNAr5tgDQJo0sZTy61R2HKoF/UjycKHYbPzkDbj3Axe85/cs7wC0DXDL/lTI+Fb/USnOtciu0sS9fvDkUjRTm84OBa3N9cHvbtwDfXEElngtbNoodjBzBAg== 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=+CgKikc0zM0ALiJOO2y1mRbuQqUaVFROXh6PVzYHBVU=; b=AoRTCCVWw/rf5ilgTVs6kU/wWr7o/CFJvDy+bAXMczWITVF8hmz1FDjwAqkFgsZmX6drvt0YTs9/0wGDHJ0CKUeMxdohJVj8OrMtKDQsFh7m5t58dUAorym3klJLaYqopwjT5T+iNYKf57Ghglzp/czprPUZGRfw0XnSx5cCzVM= Received: from SN6PR10MB3022.namprd10.prod.outlook.com (2603:10b6:805:d8::25) by SJ0PR10MB4687.namprd10.prod.outlook.com (2603:10b6:a03:2d8::12) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6455.23; Thu, 1 Jun 2023 02:16:49 +0000 Received: from SN6PR10MB3022.namprd10.prod.outlook.com ([fe80::998f:d221:5fb6:c67d]) by SN6PR10MB3022.namprd10.prod.outlook.com ([fe80::998f:d221:5fb6:c67d%7]) with mapi id 15.20.6433.024; Thu, 1 Jun 2023 02:16:49 +0000 From: "Liam R. Howlett" To: Andrew Morton Cc: maple-tree@lists.infradead.org, linux-mm@kvack.org, linux-kernel@vger.kernel.org, "Liam R. Howlett" Subject: [PATCH 13/14] maple_tree: Refine mas_preallocate() node calculations Date: Wed, 31 May 2023 22:16:04 -0400 Message-Id: <20230601021605.2823123-14-Liam.Howlett@oracle.com> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20230601021605.2823123-1-Liam.Howlett@oracle.com> References: <20230601021605.2823123-1-Liam.Howlett@oracle.com> X-ClientProxiedBy: YT1PR01CA0069.CANPRD01.PROD.OUTLOOK.COM (2603:10b6:b01:2d::8) To SN6PR10MB3022.namprd10.prod.outlook.com (2603:10b6:805:d8::25) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: SN6PR10MB3022:EE_|SJ0PR10MB4687:EE_ X-MS-Office365-Filtering-Correlation-Id: 602bfc5a-40f5-4f1d-22a4-08db624641a8 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: 2hSzVyju6dAy+SfvdmCoQX9dHr5Qfjm7g+bj4ZmOitUR6AeQBqjEWyXanWFNdyCEQQNWCh8mqDcbqXhB+5JNcMGK6F8YBJFZguNgqU0hw55pYta3kzMRYLCG3JzzxUNdtzctGw/YVNVNH3IG7H5vmDEgcYwK1hd0hzkvxFg+6rctiFVLjWyusRYGJUAJyiqSHs9VjmzreouF9fAm5UMWCgXJRamKMFZxSQuxMGblq/GyZjbBHhnn9sBqoKfx/aO4oB5byhjSti8t07A8gfmXTtMdBw45jilpaVxTX8Nw08hnBmZbgsjDnJIdri+uyYYa9B6PsN4BcxRDveAVV/dCeMKjNSdT341UdfDP3+7xugWSft4IH1ijWbJ31F7SLBt0iNKEHO4dLlgz1gfHRuc1gU4MTKsTCu+HhsB0tpC+WJu+/FkY0YTFH/J8pvxOpMeqrJwdLo72VpZDNsdyT917dJ2vJqVDcgYJHykInfXeZobrNTJiRgHKN2pX1bI9qty8Av8MuL0YNr+S45K0et50fKKg6F9dfP4M/e8tgy+uaOmF3MkqQd5c0Bfrg97JdlwC 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:(13230028)(396003)(39860400002)(136003)(346002)(376002)(366004)(451199021)(36756003)(38100700002)(86362001)(8936002)(8676002)(41300700001)(107886003)(5660300002)(26005)(1076003)(6506007)(6512007)(2906002)(186003)(2616005)(83380400001)(6666004)(6486002)(66556008)(66476007)(66946007)(316002)(478600001)(6916009)(4326008);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: BhNzUr5VGGxZ08KUdoh+MSBK5t93fT2ovRP9v5sEWy84NDTxLkBNpAVCwZ8NOPTIgdJikWur2oMPzw+lj71um8/lQwy/bAhdO5VvkD0g3hwTVrdE8tE/HNQ30YjJwKRj60C4/R/L8GHB18xOoRwJXDRhfsAKAMuqXNTqxWJS0rpAG1pVCQhvjhoWquzoaGcOnMd9bxel2AUwF+tk5Lz7fmiJNnaIH4QfSFRU3tlBdb9ofd7Ku5Ymv33f7C03El9Ah4826MdAbbynon8RJgJdEFgfpQ291KZX67HD8Ayyp23tnEwIJpwyrqIuVwKAy6I7UmU16leUnO+SNb4b6ppjwEOU4g1VWZGKPCReiMVFttSjI8E8CKwYFUyA1+ODGu8LiP6pqh4BancU10hqr8mUQqac0k9p1mWEeGE0xl/Y75h0XDSYcsIT81eMdcu0YdqvuLElYlSJMq0UuDfVr9iiNF1s4sNHb3sJvLvk+i7lncqdbBqjBuj6mrR5pZA2i+YO32EBuEhkpWHNZcgaS0/7vNg6iYnSPS/WzCIULsFsJpqGfHCK3chvvfOlx9a7oPb1S1DqqGvIfhQcKUJyHSuRRc790zPi82HTU2zG8ybMLMCSXB/D8xe6y4UXkNKcWBOt1JAV30KigCvOsMHOhE78VxvhD/TltL5jlpmsQS0TZs/yy9j1jNFYrfW3Bpju7e02OlATiOG5x0z0FWjbWwVjXhou4fjvqG8j50JAqwXl6Nx7Hid3UvSV6fOV0RcP7Tabh8n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hyAMYPxQO1bXin+rZnSzedMAABEhv+8yecB6QIVi1B64KqwAa+65CYzbNsdLQVWxPg+5CIKCqqtRu6DDazSDPJQKMQWDh09hIJoJyu/MKUcx+ugFoYWBkHOXwiV44+pfcmE0/kmURWy2JDODCvRw8jVZivFTNPqOXi5njaGSc0fwuF78Km2l/9QbEqy2AwNDkl8SF5rmYwpLZMdIb+X+i9HoePKEd/jRuAK9FNsWn8LsMK/8rjo4AzX4cQF1M0gWSZruVnfcRgkErqC40k9wSZAvr6lIrhrTNUj0cGZqHzsFlIvWxuHBMXKtmNCQhPhxTIoTqiK4l7aNO+XIHnEQ+UJU6A55+JlkL4YzAEqHWkWvtJnQYxmnQwKp1ZWiiLI5pBnRPqVG9aNBcXHR2oH+u9nUINbhI0JP1kXzCJbyJIevNl+iFcM2IIJUyOZU/6IvwhVGVt9kbwvxApwd0SxydTBVuHq2BfSc2emu60dUh9K/hnFiiOK5ewPSfxSxY9wPIiZ6mTDqC8fXyt+Wn3fKXyVPCfE4gx26lvTwvmS52zmimXAMYoMGQjnenY1dMRubXFnqi8aW6RjkCojg2N4BPbz5JwpsataLRa37nWYL5T3DyhKKEbGFMbEJdyLYO2JITeXKbo/rrP/2l9O/ry5wbWBhjWcZ+MfXmVQGzMAIJW/OBjCs5vCGFnYLfT7PBF1BIEp2YvpUrV4TBO+LBAPHSM3IbXOD0lgs7kYQljMS4QU5lYbCqVuU3xFAPxJ4w== X-OriginatorOrg: oracle.com X-MS-Exchange-CrossTenant-Network-Message-Id: 602bfc5a-40f5-4f1d-22a4-08db624641a8 X-MS-Exchange-CrossTenant-AuthSource: SN6PR10MB3022.namprd10.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 01 Jun 2023 02:16:49.3514 (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: ZGultGz7cWjG+O+JC5PZxB4fjG/4J0zHCV2jUsFOe8KQMwb8vA5oIgCBaYgvyqOyj0+aoT7bJECnAxTcJbcIHA== X-MS-Exchange-Transport-CrossTenantHeadersStamped: SJ0PR10MB4687 X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.254,Aquarius:18.0.957,Hydra:6.0.573,FMLib:17.11.176.26 definitions=2023-05-31_18,2023-05-31_03,2023-05-22_02 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 bulkscore=0 mlxscore=0 mlxlogscore=999 suspectscore=0 malwarescore=0 adultscore=0 phishscore=0 spamscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2304280000 definitions=main-2306010016 X-Proofpoint-ORIG-GUID: gZ4mrLy89S_U6lDpyfs6a3oCv5AQ4Mjp X-Proofpoint-GUID: gZ4mrLy89S_U6lDpyfs6a3oCv5AQ4Mjp 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_H5,RCVD_IN_MSPIKE_WL,SPF_HELO_NONE,SPF_NONE, T_SCC_BODY_TEXT_LINE 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: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1767466295913119389?= X-GMAIL-MSGID: =?utf-8?q?1767466295913119389?= Calculate the number of nodes based on the pending write action instead of assuming the worst case. This addresses a performance regression introduced in platforms that have longer allocation timing. Signed-off-by: Liam R. Howlett --- lib/maple_tree.c | 44 +++++++++++++++++++++++++++++++++++++++++++- 1 file changed, 43 insertions(+), 1 deletion(-) diff --git a/lib/maple_tree.c b/lib/maple_tree.c index adf662bc413e..5ea211c3f186 100644 --- a/lib/maple_tree.c +++ b/lib/maple_tree.c @@ -5541,9 +5541,51 @@ EXPORT_SYMBOL_GPL(mas_store_prealloc); */ int mas_preallocate(struct ma_state *mas, void *entry, gfp_t gfp) { + MA_WR_STATE(wr_mas, mas, entry); + unsigned char node_size; + int request = 1; int ret; - mas_node_count_gfp(mas, 1 + mas_mt_height(mas) * 3, gfp); + + if (unlikely(!mas->index && mas->last == ULONG_MAX)) + goto ask_now; + + mas_wr_store_setup(&wr_mas); + wr_mas.content = mas_start(mas); + /* Root expand */ + if (unlikely(mas_is_none(mas) || mas_is_ptr(mas))) + goto ask_now; + + if (unlikely(!mas_wr_walk(&wr_mas))) { + /* Spanning store, use worst case for now */ + request = 1 + mas_mt_height(mas) * 3; + goto ask_now; + } + + /* At this point, we are at the leaf node that needs to be altered. */ + /* Exact fit, no nodes needed. */ + if (wr_mas.r_min == mas->index && wr_mas.r_max == mas->last) + return 0; + + mas_wr_end_piv(&wr_mas); + node_size = mas_wr_new_end(&wr_mas); + if (node_size >= mt_slots[wr_mas.type]) { + /* Split, worst case for now. */ + request = 1 + mas_mt_height(mas) * 2; + goto ask_now; + } + + /* New root needs a singe node */ + if (unlikely(mte_is_root(mas->node))) + goto ask_now; + + /* Potential spanning rebalance collapsing a node, use worst-case */ + if (node_size - 1 <= mt_min_slots[wr_mas.type]) + request = mas_mt_height(mas) * 2 - 1; + + /* node store, slot store needs one node */ +ask_now: + mas_node_count_gfp(mas, request, gfp); mas->mas_flags |= MA_STATE_PREALLOC; if (likely(!mas_is_err(mas))) return 0; From patchwork Thu Jun 1 02:16:05 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Liam R. Howlett" X-Patchwork-Id: 101648 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:994d:0:b0:3d9:f83d:47d9 with SMTP id k13csp5964vqr; Wed, 31 May 2023 19:22:19 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ6pLLAl/dbqrIBlrCHiyyKn8LGLI1ZPzoLE/2skECj/AOAtxYFpnVnnWP4ILXfiQRiwcz0i X-Received: by 2002:a05:6a20:2d23:b0:10f:195f:6556 with SMTP id g35-20020a056a202d2300b0010f195f6556mr6951793pzl.31.1685586138682; Wed, 31 May 2023 19:22:18 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1685586138; cv=pass; d=google.com; s=arc-20160816; b=Quc0S5dhJYbm8OPajyxi7yj/lyC1yBzzdRA8fXYvvpNdSwHXy3EDI9lQg/dKtd6HA0 OZE/K7SvmTgSAAC/Yt502yww29oTeq9nNUytTEbVmgxsi/xsXMb7QOXRtlcE6T0fzJq0 5el87xG853psJFWAB7AOZAwdoGOnfpiQBqytmAfq7bTwbGPQPBOXmF5A4+f3jaQmNrFy GfwiCQ5DNiwZll5YFFvX+RAyHrDOL6BfRGVTEvwg3kPG/3lEgX5tk13JMHaNcEKx3nOK Ojw1MPE4KlxrcFpED5Lc6DimltntBvnc1yl72mxIBsy/l+Bt2EoLAot1jRKZyp28YPpI khlA== 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 :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature:dkim-signature; bh=812rbvUohctb//QCwvvGnF0ZAjJWMAJsWaUHeAI/wzk=; b=UY8wLLy3dNS3sCBgytS1Exr2+J9xT9Av3NtjCjYVdqtpoj4YbR3bXvkMxvzZ3yaIko jK1x2KZPX0D+FceEqluOeRcD6Esd6uctbKPcnfO1wmm5kckcNZi5JIGaFNxdd5vfDjU0 gwwePLIHfg0fbtjXXOKxukT9yMJjbq69iWcSJayH0PPPek1hBIBpSgWYt4D7WHL44Lt7 mAbmuTgOgPn4sgE35F6PFtFcL7vZKsvV5wAljhxX+3aahhTiNEEvfC1EMEdhRCVZFtb5 kBfSBAGdWHNjrCKnBsqteOVOMyPwgIZPCSbNSaMZz3QyUQculPQP51z0DCtVZWIFOenq kpzg== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@oracle.com header.s=corp-2023-03-30 header.b=VtLlUUCc; dkim=pass header.i=@oracle.onmicrosoft.com header.s=selector2-oracle-onmicrosoft-com header.b=RpdTAPaJ; 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 184-20020a6300c1000000b0053ff2caa766si121589pga.550.2023.05.31.19.22.05; Wed, 31 May 2023 19:22:18 -0700 (PDT) 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-2023-03-30 header.b=VtLlUUCc; dkim=pass header.i=@oracle.onmicrosoft.com header.s=selector2-oracle-onmicrosoft-com header.b=RpdTAPaJ; 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 S230512AbjFACSG (ORCPT + 99 others); Wed, 31 May 2023 22:18:06 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:51854 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229873AbjFACRg (ORCPT ); Wed, 31 May 2023 22:17:36 -0400 Received: from mx0b-00069f02.pphosted.com (mx0b-00069f02.pphosted.com [205.220.177.32]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 7A55BE78 for ; Wed, 31 May 2023 19:17:02 -0700 (PDT) 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 34VJxIZv031538; Thu, 1 Jun 2023 02:16:56 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-03-30; bh=812rbvUohctb//QCwvvGnF0ZAjJWMAJsWaUHeAI/wzk=; b=VtLlUUCc6qPeRuH/7fzXqO+5xSVMgFdn20yfHZnk1N67UHtbwGmT9A/CEkRpehIbbIfl Jwb1Vad9KABNwiWDGYl5H2ltFdhCch2j2bjUq7G4qMQvFX8JkHxgR9YEvSuMynuRST3T JbGF8T8oNE6ALsX7yg1PGk1JZ76JpqGEfiNwguM0BMj+zNlYUXPsfBZ2ZAqAkO+GI8kW PLQzqnSCNBeERklI3KhZnP2zRxTLrEDyA3ptpqKNcCDaUcVpuk+dY9TJQ0VUefI2XW5Z mJ22YoQmRysc1XcdBx+diObPDgM73Ok/z4GZjhdDOfbUH0xWEDL6aCxriiGXCMLKFFE+ Uw== Received: from iadpaimrmta02.imrmtpd1.prodappiadaev1.oraclevcn.com (iadpaimrmta02.appoci.oracle.com [147.154.18.20]) by mx0b-00069f02.pphosted.com (PPS) with ESMTPS id 3qvhj4yhmn-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Thu, 01 Jun 2023 02:16:55 +0000 Received: from pps.filterd (iadpaimrmta02.imrmtpd1.prodappiadaev1.oraclevcn.com [127.0.0.1]) by iadpaimrmta02.imrmtpd1.prodappiadaev1.oraclevcn.com (8.17.1.19/8.17.1.19) with ESMTP id 35116JEK000447; Thu, 1 Jun 2023 02:16:55 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 3qu8qb17j9-3 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Thu, 01 Jun 2023 02:16:55 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=inSgIMjM+QIhvuDU1irBKfvC+YyVRujZKxp6qDEKrCNbD9TR0b9gwpx4Jbjps3JiRoDR+8joP5YpDMBN9oEj4OkqahtA+8ZqnaKPntSxv3zWvcwQl/ThoTY79yFu0IgpFNr38lMTVGcukAw0JchtOE2nP7HW7glFoE/k3yxW28eKF++XNqKzVSI3wdrKkivmzH9hc3edOyL2A8ucHxxQIHrY5g4rOeYPJvFgvNmRjg8jsVShO4G4x1l/BKxcM9oEyE7LcbQkMVbN4vDdzrMpDfFM/R1Y3mMb7J+apNGsbLvNV3zL9YQ1SUjyfW5zRBJAxCVosF6GgLz6tKjefjrJUA== 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=812rbvUohctb//QCwvvGnF0ZAjJWMAJsWaUHeAI/wzk=; b=iY5ehkunVVfgnkw2Q+4nxp9+Ac4dBxiEv45QWBZ9K9qX4x62EKfIoaA6jYDJWvujtYkAGXjlmMaSCvESfGLqQc8FIl6NIblGCCQag2clFgEAHx9BNp1N6GnvykdeLU0rTNkQ1FItgyuwZJyvsc0NTX+PYWEa1Ll+bLgfeATS9ya531Qw5fm9SlmRW44kLlPcJ3FqUZAUcT18A1JUGLzxPQOGFZciGV5rsPGE+ATiMJx6fEWwkpSRjUcSjzDLmX1MUjBvPRq69hgqQsovEEe5Xqvqs+xMGRZSxW8OxPyyntUZta9lNTawQHF2SgxRp0d2QHQxsEcMb8Ja1kNRbHu1pA== 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=812rbvUohctb//QCwvvGnF0ZAjJWMAJsWaUHeAI/wzk=; b=RpdTAPaJoeCUQHwDgo0h2jZ1Zf25E+XFtJcWj6VgI/eBxTA/PMb0saEbQsd6VMYg2EXkrmilURv+CYgbQbg2QFG4yf/I1puacMDTPceLq6Q/BKv4ybI9SVD1FdBjGMHaZbLBitGshprQO2rzEBhg0sOwAeAJVlGvbf0ugbpWg+g= Received: from SN6PR10MB3022.namprd10.prod.outlook.com (2603:10b6:805:d8::25) by SJ0PR10MB4687.namprd10.prod.outlook.com (2603:10b6:a03:2d8::12) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6455.23; Thu, 1 Jun 2023 02:16:51 +0000 Received: from SN6PR10MB3022.namprd10.prod.outlook.com ([fe80::998f:d221:5fb6:c67d]) by SN6PR10MB3022.namprd10.prod.outlook.com ([fe80::998f:d221:5fb6:c67d%7]) with mapi id 15.20.6433.024; Thu, 1 Jun 2023 02:16:51 +0000 From: "Liam R. Howlett" To: Andrew Morton Cc: maple-tree@lists.infradead.org, linux-mm@kvack.org, linux-kernel@vger.kernel.org, "Liam R. Howlett" Subject: [PATCH 14/14] mm/mmap: Change vma iteration order in do_vmi_align_munmap() Date: Wed, 31 May 2023 22:16:05 -0400 Message-Id: <20230601021605.2823123-15-Liam.Howlett@oracle.com> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20230601021605.2823123-1-Liam.Howlett@oracle.com> References: <20230601021605.2823123-1-Liam.Howlett@oracle.com> X-ClientProxiedBy: YT1P288CA0004.CANP288.PROD.OUTLOOK.COM (2603:10b6:b01::17) To SN6PR10MB3022.namprd10.prod.outlook.com (2603:10b6:805:d8::25) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: SN6PR10MB3022:EE_|SJ0PR10MB4687:EE_ X-MS-Office365-Filtering-Correlation-Id: d779e1e2-9258-473d-6f6b-08db624642ff X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: xbRNEAa0ANSU02qR7ZjZJ/DC/pBblu2qXs/va7ivxLxv4MnNuHv7UhFpwpYrS/x75bps1TxaILzdcKgyQGyd4MhPNTM6c9232xK2aVj/J0geuUXKA1QkiTWs8BQSb9Ef+b88vGO69QwKMGfdRmXMtgcyzM7bA9+aT7otsvGywtVcftYe+EXj/dieHd0yBMY7T77FZUHcQMtQeOKXT7GybsNLHX6WGlEMLRselUy7p4Zj1FKMu0z3vFQiiuCWiR7W/tvE92UiGvTesouOkJ+YvUr+FyCzuKigaYLlUTZQQbBxSrVXB/mhmEZSnMhheVo7z5qBd47HjBOsDrayuO2cMUrDmIuj/oxiIImO6Um99XNYBtLQ4PWDB7ufCWYNud0eO/bXkaRkQNKWg3DY+6XJf1/JVDmm5ha1kc4Bios2g918o6ZLW9ZqIua0h8Xh6VgcNlkwJIFiNCET+zZkKr3lpudU0ZddiprsDE3Ol0u1VmIzCSX3LETZik1e/dwIV2zbh6PfZiIGk/MiF+wi6H4y0MhIGiJCS/3kL7uPKTA+VZGE1lRZoN4Pemk1px644pFO 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:(13230028)(396003)(39860400002)(136003)(346002)(376002)(366004)(451199021)(36756003)(38100700002)(86362001)(8936002)(8676002)(41300700001)(107886003)(5660300002)(26005)(1076003)(6506007)(6512007)(2906002)(186003)(2616005)(83380400001)(6666004)(6486002)(66556008)(66476007)(66946007)(316002)(478600001)(6916009)(4326008);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: hcuSRLZiYUk9Rw1L72oqrwDHH6AsieMCHCiRMtg6VwvT6fstiPI5A1G4H7SwCZtIPC1aUvdOi8oQ69PyyCaHRIP1GOC9bIuACyC8oLRONuiCER/zixbXj8SjQ7zmKzGEFjeOx+JJ1+IPN10zpxyCKdhgM3s90SqAZy9eUqM4qH6+UGt5EwBrFAxhebX3VqIPLU9kzjeqZu+gxrEiAB2/tM5FmDr05Q2Fbx8OoCFL6KGYRxruTzEIGkQyAJuEoWVhybY31x37RElb1zpt1EKiWHT6BiGXfOlPwY0pTv7uunwhB4J1sJm++pkTEj29SN4Z6H+jWW4TKIIp2PVTogzqKMvXj215c6To/dVXd6Z15DCyN1AGGEuehXI+eoK3m1Q9nRrTnkj2dWNskvzHead5iG2fbzFVCfgBiFdODjQVvnxunGjUbpsKzTYsnsfbmegR8sdWJ+OlFf9pE/kZf1YJYA6Uo2YhMDAXDevhgmI3tn6o8UyCptYa/nxLRSlhpFDdcRgjbUABPrG3mS8ZzN+c5uinFNkn2DmcD4wtik0e3h8p4hXhVLyi3qv9fwNeDr2cRtc+D+Mbvy0hJvE/XHhnGenos/TL0kgtMXbCaaoXUWc/MtJB2EGAI9TKyij/Fm0Sgs/TGDXHYBDBe/zjRI6U7b5yizZzi6OLIvT8Un1Wge7MzZRrak17Q+HxeJfm5H43UcGmWdTp0UfTDEgXhFcduQBDeYRxPmSAe+cR0THDExb6lQSjJ91mh+w0nB/34fbOlTnsDROT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Nb+2dgKTdhsLfyIqpesF48F/wH1Qlxt+TOFNJoZGwfrRFfX7PPmbF1Hme425TjdwoVmmvB2U7v5G1m+QwEgnNxCsGgW2JkALgsQvZBOtx7BWcXU8KWpwKSrJ1BFE5ncCPyA8XskwCQlkk9uk2JxjyOomsu8ip5D2ug49XxbJ+fVAu9HcHeYneTgoIXxy+mULbPA0NCeaiHd/lrlE2Le23JuRXZdGKvWozCDAalzVydogGB0X9BfKcT5RPa8EkPGvLIEllC0t3GG+/EjCz4tmAgDY9PITHvQ0ummVtbFtFy/0qUw91xIT98q2bQjm0XLebTxCH7gT6UO4XuxVKwryZO7peo89tIUWDGo6XP01G0S66W66Va4W+nNODuNHmfax/KszzxRclI/h8lYLKVOIJaS7rFG5hFC/FyqdAFRVbpgD0fu21T9m1iMKgzs21ApOsgXPTVMEtGiAoJe8fBnoqHuFESkcSO3e09PtMWMVv78sVTWdJt9laaoIMm6vapt0q4qd2cKhHhNLGWAnV+PQompYq2uivm4Dgpq3QSfCZ71hKRIFLEoJpYwx8sU0BZTteF5PXJ5k97f0pYL4GrUyVQFYbvhtbqalMT6w9NzUxLw52vXJvNfHWRNDHfkxtRRynBncQNPc9rTR2uKbLlZNhY+hQdhSZuWz3/xeOiQNnB5WfqeDHKUazIPCpTG8UY/iMhQVM4gAjROye5vYw2rnxfQ0UL+cJk7dYHkiw/uSwfHkjJrN+Dg== X-OriginatorOrg: oracle.com X-MS-Exchange-CrossTenant-Network-Message-Id: d779e1e2-9258-473d-6f6b-08db624642ff X-MS-Exchange-CrossTenant-AuthSource: SN6PR10MB3022.namprd10.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 01 Jun 2023 02:16:51.5873 (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: tFzB9exa0yaBCbQ4wUjxynv6oXM/QNJWdNY0tC2zGR98Y2laoTL/kRDNfvivBnRpaHfGdebcOrKhhnxUuE3Cgw== X-MS-Exchange-Transport-CrossTenantHeadersStamped: SJ0PR10MB4687 X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.254,Aquarius:18.0.957,Hydra:6.0.573,FMLib:17.11.176.26 definitions=2023-05-31_18,2023-05-31_03,2023-05-22_02 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 bulkscore=0 mlxscore=0 mlxlogscore=999 suspectscore=0 malwarescore=0 adultscore=0 phishscore=0 spamscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2304280000 definitions=main-2306010016 X-Proofpoint-GUID: B8ukiy97ucy4fh7unnuhltLuxCJRvBG1 X-Proofpoint-ORIG-GUID: B8ukiy97ucy4fh7unnuhltLuxCJRvBG1 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_H5,RCVD_IN_MSPIKE_WL,SPF_HELO_NONE,SPF_NONE, T_SCC_BODY_TEXT_LINE 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: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1767465170948752389?= X-GMAIL-MSGID: =?utf-8?q?1767465170948752389?= By delaying the setting of prev/next VMA until after the write of NULL, the probability of the prev/next VMA already being in the CPU cache is significantly increased, especially for larger munmap operations. It also means that prev/next will be loaded closer to when they are used. This has the consequence of needing to change the for_each() to a do {} for_each() when writing to the side tree. Since prev will be set later in the function, it is better to reverse the splitting direction of the start VMA (modify the new_below argument to __split_vma). Using the vma_iter_prev_range() to walk back to the correct location in the tree will, on the most part, mean walking within the CPU cache. Usually, this is two steps vs a node reset and a tree re-walk. Signed-off-by: Liam R. Howlett --- mm/mmap.c | 27 ++++++++++++--------------- 1 file changed, 12 insertions(+), 15 deletions(-) diff --git a/mm/mmap.c b/mm/mmap.c index eaebcc8f60d2..429e314bd134 100644 --- a/mm/mmap.c +++ b/mm/mmap.c @@ -2395,20 +2395,17 @@ do_vmi_align_munmap(struct vma_iterator *vmi, struct vm_area_struct *vma, if (end < vma->vm_end && mm->map_count >= sysctl_max_map_count) goto map_count_exceeded; - error = __split_vma(vmi, vma, start, 0); + error = __split_vma(vmi, vma, start, 1); if (error) goto start_split_failed; - - vma = vma_iter_load(vmi); } - prev = vma_prev(vmi); - /* * Detach a range of VMAs from the mm. Using next as a temp variable as * it is always overwritten. */ - for_each_vma_range(*vmi, next, end) { + next = vma; + do { /* Does it split the end? */ if (next->vm_end > end) { error = __split_vma(vmi, next, end, 0); @@ -2440,13 +2437,7 @@ do_vmi_align_munmap(struct vma_iterator *vmi, struct vm_area_struct *vma, BUG_ON(next->vm_start < start); BUG_ON(next->vm_start > end); #endif - } - - if (vma_iter_end(vmi) > end) - next = vma_iter_load(vmi); - - if (!next) - next = vma_next(vmi); + } for_each_vma_range(*vmi, next, end); #if defined(CONFIG_DEBUG_VM_MAPLE_TREE) /* Make sure no VMAs are about to be lost. */ @@ -2467,12 +2458,18 @@ do_vmi_align_munmap(struct vma_iterator *vmi, struct vm_area_struct *vma, BUG_ON(count != test_count); } #endif - /* Point of no return */ - vma_iter_set(vmi, start); + while (vma_iter_addr(vmi) > start) + vma_iter_prev_range(vmi); + if (vma_iter_clear_gfp(vmi, start, end, GFP_KERNEL)) return -ENOMEM; mm->map_count -= count; + prev = vma_iter_prev_range(vmi); + next = vma_next(vmi); + if (next) + vma_iter_prev_range(vmi); + /* * Do not downgrade mmap_lock if we are next to VM_GROWSDOWN or * VM_GROWSUP VMA. Such VMAs can change their size under