Message ID | 20230505174204.2665599-4-Liam.Howlett@oracle.com (mailing list archive) |
---|---|
State | New |
Headers | show
Return-Path: <owner-linux-mm@kvack.org> X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by smtp.lore.kernel.org (Postfix) with ESMTP id 18E90C77B7C for <linux-mm@archiver.kernel.org>; Fri, 5 May 2023 17:44:14 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id D98BC6B0087; Fri, 5 May 2023 13:44:09 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id CF9126B0088; Fri, 5 May 2023 13:44:09 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id AFD646B0089; Fri, 5 May 2023 13:44:09 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from mx0b-00069f02.pphosted.com (mx0b-00069f02.pphosted.com [205.220.177.32]) by kanga.kvack.org (Postfix) with ESMTP id 8B64D6B0087 for <linux-mm@kvack.org>; Fri, 5 May 2023 13:44:09 -0400 (EDT) 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 345HhJxF028056; Fri, 5 May 2023 17:43:51 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=OrIdgrVzXbrkBEQdhLJQ1jIQQYwRAY8yiv0L2JjFINs=; b=y43tW54L0ZFqjtQxUJOeFbHyShrGs2Hj4bX1PgjK3r18/1bJSqG9RxPqktr6CN/JDaqL JbRFO3r3kBUOesCD6Zkz2LnLFco8odYmFFL1KzeNQNpUgp2K/Vgx7j7aCh6xZSbcw7nh +MmoEnFFf8TgFBx0KCfs728BEwWHGA5cRfJ57IbeAQZYwEIJUvgyeyo/2CMqVCvv3JDI cw/7hxa+TwAFrVOMBqPrURgor5WsTXSwraeAqfXFklm6rFXOQiTVDaBnNr2rHqvQ0JYt c9TQGOLrrMILvUIr/z22WOT+wXreNiFgMmYCTrwt2tlJ1aGrSPBcMXCU3MvBvSdF8Ol6 Cw== Received: from phxpaimrmta01.imrmtpd1.prodappphxaev1.oraclevcn.com (phxpaimrmta01.appoci.oracle.com [138.1.114.2]) by mx0b-00069f02.pphosted.com (PPS) with ESMTPS id 3q8t145jc9-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Fri, 05 May 2023 17:43:51 +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 345Gc4Gg020785; Fri, 5 May 2023 17:43:50 GMT Received: from nam12-dm6-obe.outbound.protection.outlook.com (mail-dm6nam12lp2177.outbound.protection.outlook.com [104.47.59.177]) by phxpaimrmta01.imrmtpd1.prodappphxaev1.oraclevcn.com (PPS) with ESMTPS id 3q8spa5exr-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Fri, 05 May 2023 17:43:50 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=hkNsTRsn0VrJ8vD2djYdWBQoODjNA74eVemBcPXOYCEzuMQFdLUmi/Q7SZ35pvlGhJX6ak+SdCPQAcQNCUq3NDe7oKOm5JxbqNDXsUGuqLGgaBXGaWEpIbVU8bCaUvdrRyt3PVYj20dry4EhpalaPSxjNZ+ZuGtMRvJjXGDZk3IatqA10ezu/MtnnU2ZnF8qq4K3/mwdV3l1CNBTGmTVJLJX7jwAX0eOR92enD2cdjm9ydTfJSUN7fXBlyr5DB6BbatkbMuZW3JfJFUXVJAsBplSLmJpdAt2r2wiMoLcnsXc+EHtks9kTSxt1zkFZBF3dP9zpIM5LjY8pJ6/iMlxQA== 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=OrIdgrVzXbrkBEQdhLJQ1jIQQYwRAY8yiv0L2JjFINs=; b=hxCaI3azltygi4qQ4PvUPj5sujb5oNqABXIKJu8J0TnWzS32Qr0k/UCulkySWv+EDuVRcC7RKhugpANozZ9lkaB1vyAmgJ8r2tY7lXSq9nyD7BdpPr/LNWWFfUGF/iX31XyO56HpJiPQF7HC5IL2iT/lldN+4WFPcspfJOPGi6E9n2f8EglWjfVP3dVt6xjJrRYyXXlpTzFfvWKxNOjdLKR5teC/+AZQAgBrHEF3gXS+/opBdLoKtTVwyhxOKZXIRKAJOFpOf985qBKMwDPdfKSiOuUIVpPp5WB09vCoaoVX+/CoifdBaC6bgoxneKB3XKpIMn+cleWVFwLKTRyMAA== 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=OrIdgrVzXbrkBEQdhLJQ1jIQQYwRAY8yiv0L2JjFINs=; b=j6d+1ESRn0w5FG+aGapFL4NW8QhPmg563ASwqS0fcLbvghYQUyzlYZAYpg0hNqM1zPmpSUIlsrb/E61iHGIcM2h57r4oFUOM4y+dsV1XGC/0WNfAvv2PkOdiein9o0vqQ02xFQfB8nrry90p4huNWtSmZiKZQoBPKwAN+ol1CfM= Received: from SN6PR10MB3022.namprd10.prod.outlook.com (2603:10b6:805:d8::25) by BL3PR10MB6089.namprd10.prod.outlook.com (2603:10b6:208:3b5::21) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6363.27; Fri, 5 May 2023 17:43:48 +0000 Received: from SN6PR10MB3022.namprd10.prod.outlook.com ([fe80::8bb9:2bb7:3930:b5da]) by SN6PR10MB3022.namprd10.prod.outlook.com ([fe80::8bb9:2bb7:3930:b5da%7]) with mapi id 15.20.6363.022; Fri, 5 May 2023 17:43:48 +0000 From: "Liam R. Howlett" <Liam.Howlett@oracle.com> To: Andrew Morton <akpm@linux-foundation.org> Cc: maple-tree@lists.infradead.org, linux-mm@kvack.org, linux-kernel@vger.kernel.org, "Liam R. Howlett" <Liam.Howlett@oracle.com>, Peng Zhang <zhangpeng.00@bytedance.com> Subject: [PATCH v2 03/36] maple_tree: Avoid unnecessary ascending Date: Fri, 5 May 2023 13:41:31 -0400 Message-Id: <20230505174204.2665599-4-Liam.Howlett@oracle.com> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20230505174204.2665599-1-Liam.Howlett@oracle.com> References: <20230505174204.2665599-1-Liam.Howlett@oracle.com> Content-Transfer-Encoding: 8bit Content-Type: text/plain X-ClientProxiedBy: YT3PR01CA0001.CANPRD01.PROD.OUTLOOK.COM (2603:10b6:b01:86::27) To SN6PR10MB3022.namprd10.prod.outlook.com (2603:10b6:805:d8::25) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: SN6PR10MB3022:EE_|BL3PR10MB6089:EE_ X-MS-Office365-Filtering-Correlation-Id: a48b9924-86f7-4e8b-26c1-08db4d9047ea X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: xXbA8+KnrhWjO4zLk0vKPMhy+/iB1irJbm8QVek94K897VdRD6BWLpB5GF4DN1w/TlwZCeqdlkTUUA2xp6UEKHfYkk5vpjkyrmI1Uz6INculkQyP8Fzcah0RUGWyI8j8U0iQztDRUtNGsbOXZI/shklkMhPp8wx4KILvSu+IoH1/nIz3N2enK9xGFLITSk7G5zecVaKLeJitiS8JDVGv71H2cqkFmmlxFvn45L7Mhu1ONtN+8ddZTDzwoU9aeu7LnGyxV6LtaG6AAZoLBitczYcN/8eTphUOAkakYOtOT280L4J+5ZPenmYJS16+3p9hIy2t1NyP7TXuHWJZCwWYT6qPfoLSp0rKjTGqf5P06+AoRXTBNefShiMFi3tMRrdJIfucF1M6UMvurTnVXN0mWbZUceXtBKi+IP2XEvoC8JgwuteSUvOMskeNNH4esgdLDYL5pGkoiCqDouYyko2RlovzTsgUL/Wtb6v0OJc2JFWXp5N4oIOpXXVWj9OilGw0O587Oro8rZKTUT0k/DLyxvIvDQ/7ChEnAlA5OBG3PEs7Xg7tPjwjKv4kYyHUNHCi 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)(346002)(366004)(39860400002)(376002)(136003)(451199021)(66476007)(6916009)(4326008)(66946007)(66556008)(6666004)(478600001)(6486002)(316002)(54906003)(36756003)(86362001)(83380400001)(2616005)(6506007)(1076003)(26005)(6512007)(8936002)(5660300002)(8676002)(2906002)(41300700001)(186003)(38100700002);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: 9NaWmodjH5uXy9D5DX3qYr7BKEOE48IHHEmnl2ME3U6gvXEcZFxjU2Ni1yTWLYD+iYfDn04v/ZlmjREJPrV/WNdUGjDdYjWru/3dR+kUjv1LHaWCfr0JQfqtap9r9cbbfEzg36sRgfZlyF2npXWajJYnYzC/H/EGxPYviavnPHDySXvkGzZN2xRHE7+erOoYlD9jEYxjjTKCGtGs1acsv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3Peuj9vbv64X/U3ovTSdIABvbrgwpy+mPPk2ykzP97qcyeo8QZMnGJZ8+UdXicY02TfsI6Aed7qXJdjys0BvwazusHzra4P6iGDrN5stHLxQSVZzwqfpdhnDvJB3CVH5ZEnyrkuT1sorA7i9CxxhNtrDzQrIayskX6vDeZ6qqnWYQaPMe8QFG0if4VpcZ3zndHhRbq3QxuxXYSYv1/mGZhoSZgwpFY2ZNtg9SpaBx7rm/sjXXlZihB8BelQeSwF/KLsDId7Nxrz/f8AYJwTURcG0fFtg8B8OblLX/yW X-OriginatorOrg: oracle.com X-MS-Exchange-CrossTenant-Network-Message-Id: a48b9924-86f7-4e8b-26c1-08db4d9047ea X-MS-Exchange-CrossTenant-AuthSource: SN6PR10MB3022.namprd10.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 05 May 2023 17:43:48.1355 (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: ru2Q0H7+/poI4+jlfCi7XpFv1yVxGMoZPYz+J+dfAh57ubmjfZOuBsL1o36FQ6LRvGVZegJIakeMV3VTu563vQ== X-MS-Exchange-Transport-CrossTenantHeadersStamped: BL3PR10MB6089 X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.254,Aquarius:18.0.942,Hydra:6.0.573,FMLib:17.11.170.22 definitions=2023-05-05_24,2023-05-05_01,2023-02-09_01 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 bulkscore=0 mlxscore=0 spamscore=0 mlxlogscore=999 phishscore=0 malwarescore=0 adultscore=0 suspectscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2303200000 definitions=main-2305050146 X-Proofpoint-GUID: J0hXzc_hJzr1QCEJs9xYqcCFlyOvRn-j X-Proofpoint-ORIG-GUID: J0hXzc_hJzr1QCEJs9xYqcCFlyOvRn-j X-Bogosity: Ham, tests=bogofilter, spamicity=0.000000, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: <linux-mm.kvack.org> |
Series |
Maple tree mas_{next,prev}_range() and cleanup
|
expand
|
diff --git a/lib/maple_tree.c b/lib/maple_tree.c index 555de3a8343e1..5b29d5a916f2c 100644 --- a/lib/maple_tree.c +++ b/lib/maple_tree.c @@ -1103,7 +1103,6 @@ static int mas_ascend(struct ma_state *mas) enum maple_type a_type; unsigned long min, max; unsigned long *pivots; - unsigned char offset; bool set_max = false, set_min = false; a_node = mas_mn(mas); @@ -1115,8 +1114,9 @@ static int mas_ascend(struct ma_state *mas) p_node = mte_parent(mas->node); if (unlikely(a_node == p_node)) return 1; + a_type = mas_parent_type(mas, mas->node); - offset = mte_parent_slot(mas->node); + mas->offset = mte_parent_slot(mas->node); a_enode = mt_mk_node(p_node, a_type); /* Check to make sure all parent information is still accurate */ @@ -1124,7 +1124,6 @@ static int mas_ascend(struct ma_state *mas) return 1; mas->node = a_enode; - mas->offset = offset; if (mte_is_root(a_enode)) { mas->max = ULONG_MAX; @@ -1132,6 +1131,12 @@ static int mas_ascend(struct ma_state *mas) return 0; } + if (!mas->min) + set_min = true; + + if (mas->max == ULONG_MAX) + set_max = true; + min = 0; max = ULONG_MAX; do { diff --git a/tools/testing/radix-tree/maple.c b/tools/testing/radix-tree/maple.c index 9286d3baa12d6..75df543e019c9 100644 --- a/tools/testing/radix-tree/maple.c +++ b/tools/testing/radix-tree/maple.c @@ -35259,6 +35259,7 @@ static void mas_dfs_preorder(struct ma_state *mas) struct maple_enode *prev; unsigned char end, slot = 0; + unsigned long *pivots; if (mas->node == MAS_START) { mas_start(mas); @@ -35291,6 +35292,9 @@ static void mas_dfs_preorder(struct ma_state *mas) mas_ascend(mas); goto walk_up; } + pivots = ma_pivots(mte_to_node(prev), mte_node_type(prev)); + mas->max = mas_safe_pivot(mas, pivots, slot, mte_node_type(prev)); + mas->min = mas_safe_min(mas, pivots, slot); return; done: