From patchwork Wed Nov 27 01:27:51 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Wei Yang X-Patchwork-Id: 13886478 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by smtp.lore.kernel.org (Postfix) with ESMTP id CCE5AD66BA5 for ; Wed, 27 Nov 2024 01:28:44 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 974D76B0098; Tue, 26 Nov 2024 20:28:43 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id 8FD276B0099; Tue, 26 Nov 2024 20:28:43 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 79C8C6B009A; Tue, 26 Nov 2024 20:28:43 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0016.hostedemail.com [216.40.44.16]) by kanga.kvack.org (Postfix) with ESMTP id 56AA16B0098 for ; Tue, 26 Nov 2024 20:28:43 -0500 (EST) Received: from smtpin25.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay02.hostedemail.com (Postfix) with ESMTP id F1BC5121057 for ; Wed, 27 Nov 2024 01:28:42 +0000 (UTC) X-FDA: 82830140316.25.14F7C9A Received: from mail-lf1-f52.google.com (mail-lf1-f52.google.com [209.85.167.52]) by imf10.hostedemail.com (Postfix) with ESMTP id D5604C0008 for ; Wed, 27 Nov 2024 01:28:38 +0000 (UTC) Authentication-Results: imf10.hostedemail.com; dkim=pass header.d=gmail.com header.s=20230601 header.b=DFyP4mWA; dmarc=pass (policy=none) header.from=gmail.com; spf=pass (imf10.hostedemail.com: domain of richard.weiyang@gmail.com designates 209.85.167.52 as permitted sender) smtp.mailfrom=richard.weiyang@gmail.com ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1732670916; a=rsa-sha256; cv=none; b=3J55lewkAOxTj+3XToKxHUK1adWMH669h43y+nq3t8NEsUKLFzJN8LrCa+UWLuf9jM0V37 rLAaRbRZgC7Yq7Ywq9Ij+Xa8d9tIQ/BSGfM5hIUAGDuiK8jJDjh2yzLYa6KDlySBrto/nW nC7bGOq/y/YyYvtq1awMCDuvmZuJiFs= ARC-Authentication-Results: i=1; imf10.hostedemail.com; dkim=pass header.d=gmail.com header.s=20230601 header.b=DFyP4mWA; dmarc=pass (policy=none) header.from=gmail.com; spf=pass (imf10.hostedemail.com: domain of richard.weiyang@gmail.com designates 209.85.167.52 as permitted sender) smtp.mailfrom=richard.weiyang@gmail.com ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1732670916; h=from:from:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:content-type: content-transfer-encoding:in-reply-to:in-reply-to: references:references:dkim-signature; bh=Hz4DrOwQDkGBV/dSxAev4vnHdQKJDrgkgo1ywQp4wX0=; b=mtD5kBeS21uZqLPjgWJB/cUnVlKzQJqCIK0dpQVJKI9khrOwu8SCnp3KgQiC5muQ/yRcVK /dmAHutFLbG9+nQiOycECtQeRxkvhdtOcuKu0T1Hy1dM+j59TlcLhrP4LeCBclYS5MQXEI dxN0OKMS5LlIeSJfecBQ2hausLmdLFA= Received: by mail-lf1-f52.google.com with SMTP id 2adb3069b0e04-53de92be287so2660930e87.1 for ; Tue, 26 Nov 2024 17:28:40 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1732670919; x=1733275719; darn=kvack.org; h=references:in-reply-to:message-id:date:subject:cc:to:from:from:to :cc:subject:date:message-id:reply-to; bh=Hz4DrOwQDkGBV/dSxAev4vnHdQKJDrgkgo1ywQp4wX0=; b=DFyP4mWAKLMvMt+MmSVPOXsGB64Nuy786JSEVDPsM+tGjTlUPjd/CAv7TK+zcgj32y WMSkK5nBZckQk6wlJBUfImL24qNuJ3r4R7ZNcGh9Q64v9Hhsr5wD3/dAYkRXCMwetzzi 9NergP12iC8jWwY2Opj+h/RI2xKq0zG7LnpuChrR9hxEmm3EMSgteCFodprg2ky/utxh d2d3bCc6SmArvz9HIAZ4kqjHUciwTgYsEjk/wV+9zyhJ0oCfaLGsNi7dInjw1Z8czlw/ oX9Gm76zxs4DBaX+r+r5hiSlL4rtRwUTnAN0jKDU13JEs7RQ31PADudmK3RugwYBLuiz v7JA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1732670919; x=1733275719; h=references:in-reply-to:message-id:date:subject:cc:to:from :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=Hz4DrOwQDkGBV/dSxAev4vnHdQKJDrgkgo1ywQp4wX0=; b=foW1mtd9TqBkMme6eOWoRXSKNCxwVWSpGQSqrHvlBCnNUxldPdIwV9bPA7SejtYrCb NXPVti9wxRAZmUeOqCJXevUR0lIfV1x++CRNfibiVGL0ll2adscg2cr9mi1FE3fpvMAm tBQil6Xn9sdr2kccroVBvbjsFKP3S+/grRIbUMIjTdwMr526Xzr6KhSBHvogQVdMaHRH DNnsONv9UVY/SITxKgLO4pfMZFa8YueG6/eS5Sg+rvYTiB76ibaqvHKiGkgq71B3xLVo D1EU/5oZvNEuBvrJSLnL0TLoAxoYz6eXjPW7/ZjhImrhsl8gQQ6adecjJ2i2NMIlKAjI YPgQ== X-Forwarded-Encrypted: i=1; AJvYcCXr8Z8zn9MT/0iKt4ONt2yopUIhO0MAcDRKO5RNWrU9mmuMQW9rtedpblCbHKtfmwh/QeX/Ouw2IA==@kvack.org X-Gm-Message-State: AOJu0YxwOXX/FTy0GPXPk8VZxunNB/7UVpT6fAl4sbLSx74HgQ6RHCMT 9Cj6j389XSzruxQkW4bnj5siWQzrtC8udmHl/Agsb8wXtp/q34Cj X-Gm-Gg: ASbGncvb3AYG44frO90OO0zy359TApy4+8pbaPHlXfpVorEzPByYvg1fNPtVSg03T2s 0Av+A3csryk1BhN5YnhCjvDKbj5ZcctBURksUY9tQAbrcbo3TBFDVR7c2im34DoNG3jWHSnv+pC Icn9QoPY3VBrjOv9yZhAhb04exOMdxAwhIKhqxQJEkvVXmGkCYrgBJMmQu7EwlvPDmzfHykc3F/ KH0EDJG3H/iF5bBF3+Y7LevLooDsriVPTA/AASOsR2XGJF7Gw== X-Google-Smtp-Source: AGHT+IElDusi/O8aVfxQT+OVSzd03XGkwPKZAD+8a6m2G9b2LfT/1dikfax94cLwrKfBnpAb9xDLlw== X-Received: by 2002:a05:6512:3a8d:b0:53d:e83e:a23d with SMTP id 2adb3069b0e04-53df00d952dmr849075e87.27.1732670918957; Tue, 26 Nov 2024 17:28:38 -0800 (PST) Received: from localhost ([185.92.221.13]) by smtp.gmail.com with ESMTPSA id a640c23a62f3a-aa52e45391dsm537747766b.60.2024.11.26.17.28.38 (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Tue, 26 Nov 2024 17:28:38 -0800 (PST) From: Wei Yang To: akpm@linux-foundation.org, Liam.Howlett@oracle.com Cc: maple-tree@lists.infradead.org, linux-mm@kvack.org, Wei Yang , "Liam R . Howlett" , Sidhartha Kumar , Lorenzo Stoakes Subject: [PATCH 5/7] maple_tree: the type of left subtree is already saved in bnode->type Date: Wed, 27 Nov 2024 01:27:51 +0000 Message-Id: <20241127012753.3393-6-richard.weiyang@gmail.com> X-Mailer: git-send-email 2.11.0 In-Reply-To: <20241127012753.3393-1-richard.weiyang@gmail.com> References: <20241127012753.3393-1-richard.weiyang@gmail.com> X-Rspamd-Server: rspam04 X-Rspamd-Queue-Id: D5604C0008 X-Stat-Signature: p3u7wrnenpem8idpfa75bjq88wj5k6tc X-Rspam-User: X-HE-Tag: 1732670918-760355 X-HE-Meta: U2FsdGVkX1+eoD6yyROdXpyXSjeQ8NJWVr2W9uZXnw/hs58SDWPgo29iqEhCIgQOK2QMqyM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4J3h9cOq1Vs7gcZnlTGr8KSn9Stzw4ozqy/DevPHYiwXFLr7lwvUMamxrqpCwZSioT/fIFVqLhG2BK9xpiZ6rUk/sQd6PrMc9f1lvR4DymNYLARV9qF7UbaOBIDmhn40Fm8JnSzWzcttwEUZza0BCVQogKk+Ib9RjUt4m7Wsf9GmwwCY6kfdkpxKaM2YK8Hl7UPDPxVRJkttBnC3+RnO2Aow4jfiPSFZBQ3ZIfCA4lTslG3WGn4XJfIILpB51GNe+9lu8/hsIPom3lu1yxHJSHfSVNJnpidSkgxS9sgyWfj+9Bn5z4KvekUVYelCpOI0Mtf35jm19siiECxIGIh8k/UwpFqmOZB15MOxMdywQOi2oKsX8PGcJgEY8ZBerEL678N X-Bogosity: Ham, tests=bogofilter, spamicity=0.000001, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: List-Subscribe: List-Unsubscribe: mast_sufficient()/mast_overflow() are only used in mas_spanning_rebalance(). Before doing the check, mast_ascend() has retrieved the left subtree type and stored in bnode->type. So we can use the type in bnode->type directly to get minimum slot count. Signed-off-by: Wei Yang CC: Liam R. Howlett CC: Sidhartha Kumar CC: Lorenzo Stoakes --- lib/maple_tree.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/maple_tree.c b/lib/maple_tree.c index 6cabee1371ec..56e9857ce681 100644 --- a/lib/maple_tree.c +++ b/lib/maple_tree.c @@ -2729,7 +2729,7 @@ static inline void mast_combine_cp_right(struct maple_subtree_state *mast) */ static inline bool mast_sufficient(struct maple_subtree_state *mast) { - if (mast->bn->b_end > mt_min_slot_count(mast->orig_l->node)) + if (mast->bn->b_end > mt_min_slots[mast->bn->type]) return true; return false; @@ -2742,7 +2742,7 @@ static inline bool mast_sufficient(struct maple_subtree_state *mast) */ static inline bool mast_overflow(struct maple_subtree_state *mast) { - if (mast->bn->b_end >= mt_slot_count(mast->orig_l->node)) + if (mast->bn->b_end >= mt_slots[mast->bn->type]) return true; return false;