From nobody Wed Sep 17 08:58:10 2025 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 vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 0C485C4332F for ; Wed, 21 Dec 2022 06:01:35 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234420AbiLUGBd (ORCPT ); Wed, 21 Dec 2022 01:01:33 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:58784 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234411AbiLUGB2 (ORCPT ); Wed, 21 Dec 2022 01:01:28 -0500 Received: from mail-pf1-x436.google.com (mail-pf1-x436.google.com [IPv6:2607:f8b0:4864:20::436]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id CE7B99FED for ; Tue, 20 Dec 2022 22:01:26 -0800 (PST) Received: by mail-pf1-x436.google.com with SMTP id g1so9995201pfk.2 for ; Tue, 20 Dec 2022 22:01:26 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=qMWDOSwDa2fJZaK2qvEdhPYi5mJW5ESN2yWnqdHTXKY=; b=d1XJ0LC7K62G/BE2GJcMMB4lKX9S5DOWXKebJXBuG/f7WGlZYWo0Y/8x2TsIPYhQRo pa7+Zr+vV9Yx72kCfj+DM0gedruzyMtl2bPAcBEPFY2rP+7qu4MZYbGdxTPsIkp1EvvE twKa/x/J5/vM0gn+jcde+3MBUbrnLoAWIdfzhh63cunZPKW5iP+BzOJKLeGD13VSuKcL FupTfz5c9Euqf2z+ULNQOqw7T13CK5ke7g03R02/TkJ6G6mpuPUn0w3ToDSvMid1QouI os8jivNy3tPNgFuw4UM+0J1X0mx2vUHH787gV0q3ZuTjcxGSHd36s/QhOYvBPzzRDuoD ShRQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:mime-version: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=qMWDOSwDa2fJZaK2qvEdhPYi5mJW5ESN2yWnqdHTXKY=; b=Qa8mru8aL5i4gULJzaDuFKiqgsQ4ysGEDg9fW44mZA6jWHuFM8hrOjlR42vrBEpceL 0whciGoN7bxVrkN6apcemzi5fX9/oqQTCtyNXnblLr4ZkQ4pT/0A5Ucal3tgzAg2VUjV ibyP+znmYHYa5hAv4Th6qoJq9mlVyZ4Bl2+8L7pdEmZ5ZSavgQvdcFXzkS3in5u6k5KP micznzfI4kduqOe8hRIaNrPdmlQk+jxviZyLgwCYzCXlOiiJ0rq7SmixNOwVZEHwVvp3 tyXud29NyKM5TSbeS7YAZR7XsWYyCUV3uncgT5LgDmx92QNUKzmqskHsVptV525wF8gP dfkA== X-Gm-Message-State: AFqh2koXF1iD0n3S0pNGGd9gyA7QtKTtyIcQxRJ/frayHkbcM4nLgax5 Cv0RUKgL9ZyCdHelxLoEzio= X-Google-Smtp-Source: AMrXdXsCM96KvIVOVe3Zhf07YYI64smG+DMZpPQxHyRJJeMjLIijY/PARh+DkRgyM1DYJcTeBFUlgw== X-Received: by 2002:aa7:9d1e:0:b0:56c:3ed0:1f9d with SMTP id k30-20020aa79d1e000000b0056c3ed01f9dmr972403pfp.17.1671602486390; Tue, 20 Dec 2022 22:01:26 -0800 (PST) Received: from vernon-pc.. ([114.231.52.81]) by smtp.gmail.com with ESMTPSA id w7-20020a626207000000b00562677968aesm9598886pfb.72.2022.12.20.22.01.23 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 20 Dec 2022 22:01:25 -0800 (PST) From: Vernon Yang To: Liam.Howlett@oracle.com, akpm@linux-foundation.org Cc: linux-mm@kvack.org, linux-kernel@vger.kernel.org, maple-tree@lists.infradead.org, Vernon Yang Subject: [PATCH v2 1/7] maple_tree: remove extra space and blank line Date: Wed, 21 Dec 2022 14:00:52 +0800 Message-Id: <20221221060058.609003-2-vernon2gm@gmail.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20221221060058.609003-1-vernon2gm@gmail.com> References: <20221221060058.609003-1-vernon2gm@gmail.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" These extra space and blank line is unnecessary, so drop it. Reviewed-by: Liam R. Howlett Signed-off-by: Vernon Yang --- include/linux/maple_tree.h | 2 -- lib/maple_tree.c | 14 ++++---------- 2 files changed, 4 insertions(+), 12 deletions(-) diff --git a/include/linux/maple_tree.h b/include/linux/maple_tree.h index e594db58a0f1..4ee5a969441c 100644 --- a/include/linux/maple_tree.h +++ b/include/linux/maple_tree.h @@ -517,7 +517,6 @@ static inline void mas_reset(struct ma_state *mas) * entry. * * Note: may return the zero entry. - * */ #define mas_for_each(__mas, __entry, __max) \ while (((__entry) =3D mas_find((__mas), (__max))) !=3D NULL) @@ -639,7 +638,6 @@ static inline void mt_set_in_rcu(struct maple_tree *mt) } =20 static inline unsigned int mt_height(const struct maple_tree *mt) - { return (mt->ma_flags & MT_FLAGS_HEIGHT_MASK) >> MT_FLAGS_HEIGHT_OFFSET; } diff --git a/lib/maple_tree.c b/lib/maple_tree.c index fe3947b80069..8ace65a5eea5 100644 --- a/lib/maple_tree.c +++ b/lib/maple_tree.c @@ -183,7 +183,6 @@ static void ma_free_rcu(struct maple_node *node) call_rcu(&node->rcu, mt_free_rcu); } =20 - static void mas_set_height(struct ma_state *mas) { unsigned int new_flags =3D mas->tree->ma_flags; @@ -468,7 +467,7 @@ static inline void mte_set_parent(struct maple_enode *enode, const struct maple_enode *p= arent, unsigned char slot) { - unsigned long val =3D (unsigned long) parent; + unsigned long val =3D (unsigned long)parent; unsigned long shift; unsigned long type; enum maple_type p_type =3D mte_node_type(parent); @@ -502,7 +501,7 @@ void mte_set_parent(struct maple_enode *enode, const st= ruct maple_enode *parent, */ static inline unsigned int mte_parent_slot(const struct maple_enode *enode) { - unsigned long val =3D (unsigned long) mte_to_node(enode)->parent; + unsigned long val =3D (unsigned long)mte_to_node(enode)->parent; =20 /* Root. */ if (val & 1) @@ -1278,7 +1277,6 @@ static inline void mas_alloc_nodes(struct ma_state *m= as, gfp_t gfp) mas->alloc->total =3D success; mas_set_err(mas, -ENOMEM); return; - } =20 /* @@ -2946,7 +2944,7 @@ static inline void *mtree_range_walk(struct ma_state = *mas) mas->min =3D prev_min; mas->max =3D prev_max; mas->node =3D last; - return (void *) next; + return (void *)next; =20 dead_node: mas_reset(mas); @@ -3464,7 +3462,6 @@ static inline bool mas_push_data(struct ma_state *mas= , int height, */ static int mas_split(struct ma_state *mas, struct maple_big_node *b_node) { - struct maple_subtree_state mast; int height =3D 0; unsigned char mid_split, split =3D 0; @@ -3890,7 +3887,7 @@ static inline void *mtree_lookup_walk(struct ma_state= *mas) goto dead_node; } while (!ma_is_leaf(type)); =20 - return (void *) next; + return (void *)next; =20 dead_node: mas_reset(mas); @@ -4708,7 +4705,6 @@ static inline void *mas_next_nentry(struct ma_state *= mas, =20 static inline void mas_rewalk(struct ma_state *mas, unsigned long index) { - retry: mas_set(mas, index); mas_state_walk(mas); @@ -4716,7 +4712,6 @@ static inline void mas_rewalk(struct ma_state *mas, u= nsigned long index) goto retry; =20 return; - } =20 /* @@ -5618,7 +5613,6 @@ static void mas_wr_store_setup(struct ma_wr_state *wr= _mas) mas_reset(wr_mas->mas); } } - } =20 /* Interface */ --=20 2.34.1 From nobody Wed Sep 17 08:58:10 2025 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 vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 99095C46467 for ; Wed, 21 Dec 2022 06:01:40 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234461AbiLUGBg (ORCPT ); Wed, 21 Dec 2022 01:01:36 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:58816 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234446AbiLUGBb (ORCPT ); Wed, 21 Dec 2022 01:01:31 -0500 Received: from mail-pg1-x534.google.com (mail-pg1-x534.google.com [IPv6:2607:f8b0:4864:20::534]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 99DAFA451 for ; Tue, 20 Dec 2022 22:01:29 -0800 (PST) Received: by mail-pg1-x534.google.com with SMTP id s196so9765683pgs.3 for ; Tue, 20 Dec 2022 22:01:29 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=HuceivYszxi1dsfcy+qfUy+FliXIAedgU34LI+yN1BM=; b=aGtdxygNXyEXuRO3SRKTDU0SZ1mamJ3u2QLuOlZJU9ZbDar1Whyk3PK667jGVxmijC Bk8F6SC8m75KaEJ5ydRynN4bUNA/UMcZ80AVvMenXVzBDgPLYIjrqoNiivTxpTbgz/vn 8bdhOgfTr11AiPiCwW6CfsdW5VLxa4994y1i+hwomVHEvoJedGcXi9ecdhEdc65GgF+g PNe1cPzOc87xidWqyQvv+kpEDNeoDTwTA5Vxbrd5YKI1d7QBy6SDupLRlpw5kgTZyD8h 0euRLBHTIqmDxHdluH23+8Q+cxl82qABHBU3s+y3dlp0icpcHkIbZv+Gu/KYh0An1Lx8 syHg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:mime-version: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=HuceivYszxi1dsfcy+qfUy+FliXIAedgU34LI+yN1BM=; b=fV/S3O8VG2Iw8IDVbMvjzASAt3f3K0ZGZPUP0Q8q0TuReS45uAZAWGfBQsrPVAbPJt K0kzzqMhHhOtNRJmVPMzG79yuA4Zqu4Ryej61voV5SW7Cy3kN0NwZc53HXbRP2Se1CRq qnucz1UkZvG2RIsVGnR5Mp4SMtrFvQDyx3mR2jser6BUYIswkKviKksTvyY7i1FYccfd GlpZ26a4u334Cwz1vi0NIKwrpMQuqE1Rq5ZQnKrmhz+sU+psKe4aUPw48avhNoIsLVz7 74xR7LqZHOsGOmT1qwgpdntmfYkUVOX/NtpC4JSll+i5gdfDR7cGC4PUNN1VtLnsVMmr 7M8A== X-Gm-Message-State: AFqh2koZQncU7fRmSP0YcmARmIkqNk47c/jKOMvVxfXYPGzg6nHJjXFN eTEVpDUD5b5xpq30CwpZXwI= X-Google-Smtp-Source: AMrXdXvS3Z6kpgiVXNdjEzMajBtalFI1ekmEFXKRKgxnGDl9CSYVxZCL/XtEfH5QaXRGMQLgHYra2w== X-Received: by 2002:a05:6a00:3027:b0:577:8d87:d8f4 with SMTP id ay39-20020a056a00302700b005778d87d8f4mr1064981pfb.34.1671602489177; Tue, 20 Dec 2022 22:01:29 -0800 (PST) Received: from vernon-pc.. ([114.231.52.81]) by smtp.gmail.com with ESMTPSA id w7-20020a626207000000b00562677968aesm9598886pfb.72.2022.12.20.22.01.26 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 20 Dec 2022 22:01:28 -0800 (PST) From: Vernon Yang To: Liam.Howlett@oracle.com, akpm@linux-foundation.org Cc: linux-mm@kvack.org, linux-kernel@vger.kernel.org, maple-tree@lists.infradead.org, Vernon Yang Subject: [PATCH v2 2/7] maple_tree: remove extra return statement Date: Wed, 21 Dec 2022 14:00:53 +0800 Message-Id: <20221221060058.609003-3-vernon2gm@gmail.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20221221060058.609003-1-vernon2gm@gmail.com> References: <20221221060058.609003-1-vernon2gm@gmail.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" For functions with a return type of void, it is unnecessary to add a reurn statement at the end of the function, so drop it. Reviewed-by: Liam R. Howlett Signed-off-by: Vernon Yang --- lib/maple_tree.c | 3 --- 1 file changed, 3 deletions(-) diff --git a/lib/maple_tree.c b/lib/maple_tree.c index 8ace65a5eea5..34aa93c85d6e 100644 --- a/lib/maple_tree.c +++ b/lib/maple_tree.c @@ -1276,7 +1276,6 @@ static inline void mas_alloc_nodes(struct ma_state *m= as, gfp_t gfp) if (mas->alloc && !(((unsigned long)mas->alloc & 0x1))) mas->alloc->total =3D success; mas_set_err(mas, -ENOMEM); - return; } =20 /* @@ -4710,8 +4709,6 @@ static inline void mas_rewalk(struct ma_state *mas, u= nsigned long index) mas_state_walk(mas); if (mas_is_start(mas)) goto retry; - - return; } =20 /* --=20 2.34.1 From nobody Wed Sep 17 08:58:10 2025 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 vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id CC94FC4167B for ; Wed, 21 Dec 2022 06:01:43 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234464AbiLUGBm (ORCPT ); Wed, 21 Dec 2022 01:01:42 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:58844 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234372AbiLUGBd (ORCPT ); Wed, 21 Dec 2022 01:01:33 -0500 Received: from mail-pg1-x530.google.com (mail-pg1-x530.google.com [IPv6:2607:f8b0:4864:20::530]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 83B00A45B for ; Tue, 20 Dec 2022 22:01:32 -0800 (PST) Received: by mail-pg1-x530.google.com with SMTP id 82so9795554pgc.0 for ; Tue, 20 Dec 2022 22:01:32 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=98gM+nMF4eQUYfWo5A+IUJS7ZGlkpZboph9F4DdRYdI=; b=OW8qsMkzYqxctImV/NWyLmCYdTie44KkUOfhYEVGtWY9Bt83TvVAexzh3PGdLkNTM2 RbB6iialWb4wRKiMjrdIO9gj24hmgnl4mGBOHqmaAaOlwGKuZPbfwXXbnnOraJ8qW2LB t3ka5CzZTM3bQaHszRPYyvh1qLUw7nILA2NPdXOrGsjfMQKq3wF9Sj3uhOz5ggO5agaZ xNCAj8bamRALkJR30UK4dMVAgMP5+RUs8crcTJF2Tzk+0osr4eBl0ExqkyXJ4YttCla3 mVnIJLkdd3U62oErLjgE6LB+wQoKyJ21I0pESeVPw+mffCztX2w+xeZMnI++SXwN7N2e P3QA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:mime-version: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=98gM+nMF4eQUYfWo5A+IUJS7ZGlkpZboph9F4DdRYdI=; b=s2EFmG6tZ9zevfYp0W1gIHeWrNxXEdhaIYWL5oqcmkvOPl9KgdgXl6wBIC7dJ3OkRs ZlS2daZTmzcyUzO53quKdpyvCeWu1Fy6ij0z8pbKYN6D298GGXJd4v9cwyOvCqLufrLA zAtIbi1sW80jeL6AlvBPaDWiFqgeQs2LEXXerfEMlKzr00i/HZ2zCwKEUChCCTpK2w/o /e44WBc0lHYpDu1Y7G3UfvU27cg1aMSfaBUAv0zWa7A9mOMR0BjoVS37zy58OdU/12N/ yvoH+6vns5BmlaUx5Gc4VrfuB7ykFMrJWOj0k2iM5FegAPcVmrdGjRO6C2V04n1CCAX4 BxaA== X-Gm-Message-State: AFqh2kodlhxAoGs6kDS3kOiB7bHf72wYjvsGePUAspBkoOnneRiXJQNG XM0Lc+DaaYAq00haYvRZR14= X-Google-Smtp-Source: AMrXdXsbG1NWc56PQsRKjtPo5U90MkahU89tGi2vxdMo3dBH3SqM46lw3YlBqRViLrXj4Jp8difS4g== X-Received: by 2002:a62:8408:0:b0:575:d06d:1bfa with SMTP id k8-20020a628408000000b00575d06d1bfamr1328487pfd.2.1671602491994; Tue, 20 Dec 2022 22:01:31 -0800 (PST) Received: from vernon-pc.. ([114.231.52.81]) by smtp.gmail.com with ESMTPSA id w7-20020a626207000000b00562677968aesm9598886pfb.72.2022.12.20.22.01.29 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 20 Dec 2022 22:01:31 -0800 (PST) From: Vernon Yang To: Liam.Howlett@oracle.com, akpm@linux-foundation.org Cc: linux-mm@kvack.org, linux-kernel@vger.kernel.org, maple-tree@lists.infradead.org, Vernon Yang Subject: [PATCH v2 3/7] maple_tree: use mt_node_max() instead of direct operations mt_max[] Date: Wed, 21 Dec 2022 14:00:54 +0800 Message-Id: <20221221060058.609003-4-vernon2gm@gmail.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20221221060058.609003-1-vernon2gm@gmail.com> References: <20221221060058.609003-1-vernon2gm@gmail.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" Use mt_node_max() to get the maximum number of slots for a node, rather than direct operations mt_max[], makes it better portability. Reviewed-by: Liam R. Howlett Signed-off-by: Vernon Yang --- 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 34aa93c85d6e..3d45c515ed42 100644 --- a/lib/maple_tree.c +++ b/lib/maple_tree.c @@ -6723,7 +6723,7 @@ static void mt_dump_range64(const struct maple_tree *= mt, void *entry, =20 if (i < (MAPLE_RANGE64_SLOTS - 1)) last =3D node->pivot[i]; - else if (!node->slot[i] && max !=3D mt_max[mte_node_type(entry)]) + else if (!node->slot[i] && max !=3D mt_node_max(entry)) break; if (last =3D=3D 0 && i > 0) break; @@ -6830,7 +6830,7 @@ void mt_dump(const struct maple_tree *mt) if (!xa_is_node(entry)) mt_dump_entry(entry, 0, 0, 0); else if (entry) - mt_dump_node(mt, entry, 0, mt_max[mte_node_type(entry)], 0); + mt_dump_node(mt, entry, 0, mt_node_max(entry), 0); } EXPORT_SYMBOL_GPL(mt_dump); =20 --=20 2.34.1 From nobody Wed Sep 17 08:58:10 2025 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 vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 0CA6CC4332F for ; Wed, 21 Dec 2022 06:02:04 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234483AbiLUGCC (ORCPT ); Wed, 21 Dec 2022 01:02:02 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:59174 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234470AbiLUGBn (ORCPT ); Wed, 21 Dec 2022 01:01:43 -0500 Received: from mail-pl1-x635.google.com (mail-pl1-x635.google.com [IPv6:2607:f8b0:4864:20::635]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 5578DE0EB for ; Tue, 20 Dec 2022 22:01:35 -0800 (PST) Received: by mail-pl1-x635.google.com with SMTP id d15so14548021pls.6 for ; Tue, 20 Dec 2022 22:01:35 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=4q1h/FltzRsnfoKTgYieWO+QDivMRlb3nPVnegVijrw=; b=qvyWkaPc2mWqmYZUiQwgi83zwsWommy6qCXbdOCAx0BGVDaGwsdStY6ZgNTuztkSdB vFsOmmu639lPnIjC6Oi2Yg9Jn8fgvKfiRoil4qTF8eE2fKY9YXsRg43LJOhdrNPBnHEm WqLaoM5oaCYUc9G5eQFjeSspwAKBI1KKJIfTEtJOv27q3gzAsp1gG0BpDT7pwDw5Ybhm z+U0DE9r7LxV04F3b1rdiP8/dzN/LRG8iCPOEJH52wZ53wL+gPuONp8sWeRBeQPfF7Op iMFXrVaXCSnnFovKG8zpRQ83A0CIfLh6j8FnoFFHCfyAsZolZY9r/HE4tMaGlpmZZUcm 6z/A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:mime-version: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=4q1h/FltzRsnfoKTgYieWO+QDivMRlb3nPVnegVijrw=; b=7p6bnWc11S7WhknwGnx6onjE1IsBpvyEXhQ1FJKKVUlgQJF2ZP7JyEZTIRK8/bN5u7 c5poZ6MrYtL6zTBcIZ1JqNw7mwcnlRxbFj2hZSMT+VRfkG+mOjCRVbnC2gK3SVRM3JJQ OuLtyZXc/oM91t///PqCV3LkoVQFH3eTxPh58Qi6Lg4kOqJCTPHvW3IZA7oaVErd5zdw E9dvjYKqc7VjPEDk+kbXZULEJBhj1Mwh/R1e/hyv1RH8OgfugvaOY5htagn2fB/jed5c umSX1LFsOsI7EpH1aIVfa/i436WfCenFVk2nJmCh2YXvO61WXrWrofwOhxMbDFpbGqFv pezw== X-Gm-Message-State: AFqh2kqjK2LY64hilu8tdTgD14b8qszm1yo0uz5lvSVRTi6QA9Tpn8dj v+ePmS89IpNpsGJ0Y5drguM= X-Google-Smtp-Source: AMrXdXtMWHYZDWMbr3SCf2WxP+u1fWAuFluUCB86aTREdxhvQzXKoWcNNFKrvZ5xojMwDA7x/jxPHg== X-Received: by 2002:a05:6a20:d807:b0:a8:79bc:dfae with SMTP id iv7-20020a056a20d80700b000a879bcdfaemr1303595pzb.20.1671602494878; Tue, 20 Dec 2022 22:01:34 -0800 (PST) Received: from vernon-pc.. ([114.231.52.81]) by smtp.gmail.com with ESMTPSA id w7-20020a626207000000b00562677968aesm9598886pfb.72.2022.12.20.22.01.32 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 20 Dec 2022 22:01:34 -0800 (PST) From: Vernon Yang To: Liam.Howlett@oracle.com, akpm@linux-foundation.org Cc: linux-mm@kvack.org, linux-kernel@vger.kernel.org, maple-tree@lists.infradead.org, Vernon Yang Subject: [PATCH v2 4/7] maple_tree: use macro MA_ROOT_PARENT instead of number Date: Wed, 21 Dec 2022 14:00:55 +0800 Message-Id: <20221221060058.609003-5-vernon2gm@gmail.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20221221060058.609003-1-vernon2gm@gmail.com> References: <20221221060058.609003-1-vernon2gm@gmail.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" When you need to compare whether node->parent is parent of the root node, using macro MA_ROOT_PARENT is easier to understand and for better readability. Reviewed-by: Liam R. Howlett Signed-off-by: Vernon Yang --- lib/maple_tree.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/lib/maple_tree.c b/lib/maple_tree.c index 3d45c515ed42..b3a215dd961e 100644 --- a/lib/maple_tree.c +++ b/lib/maple_tree.c @@ -503,8 +503,7 @@ static inline unsigned int mte_parent_slot(const struct= maple_enode *enode) { unsigned long val =3D (unsigned long)mte_to_node(enode)->parent; =20 - /* Root. */ - if (val & 1) + if (val & MA_ROOT_PARENT) return 0; =20 /* --=20 2.34.1 From nobody Wed Sep 17 08:58:10 2025 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 vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 2FC62C4332F for ; Wed, 21 Dec 2022 06:02:10 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234523AbiLUGCH (ORCPT ); Wed, 21 Dec 2022 01:02:07 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:59180 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234485AbiLUGBx (ORCPT ); Wed, 21 Dec 2022 01:01:53 -0500 Received: from mail-pg1-x52e.google.com (mail-pg1-x52e.google.com [IPv6:2607:f8b0:4864:20::52e]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 7C31C14D05 for ; Tue, 20 Dec 2022 22:01:38 -0800 (PST) Received: by mail-pg1-x52e.google.com with SMTP id 7so4710509pga.1 for ; Tue, 20 Dec 2022 22:01:38 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=aHRqJFCqqiUbAcLl4rJqQJzKFG6tPNSYjirqr984MSA=; b=O8AhDZ/k7Q9w4CuljbyvCn754AYl8IRAr+sz1YmGdipQW5IseqgATF+4k0SEDPRQ6f wepmg+rOixnKd/oqWfCRB78BNSf7HEMx1C13UfIuxxqc/OCZBFofhsQIEcKhs3kEaZ3P W9oj23ziWiUfbblsOtbCOspq01s6mUeR+hMvUJnI4IuHID8HXaZWFYxC5FaYFvktYfCZ EbAu+aX680QqWMqq9G/GNwTX+yK4bmYhph2fRkEVjA33PzI35wYhgI1rcoVryEAkW0ij WtfRkRjorH5TuDvAX5X44/3yXc6eloM9ig1e/aI8BG67m9AU4vYSVcfxTqDTz1fj5E8b 1rmw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:mime-version: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=aHRqJFCqqiUbAcLl4rJqQJzKFG6tPNSYjirqr984MSA=; b=tX1bwy1fPf1P0mr6pWZjci0lH5vzkRvnsx5BZPRSC4C7R2cH1+CIgWl2OoqqW8uLts W2ZFlBek7qp4NLN1MiyQPJxfdUMPB+kpbdPyrqd1MZyxq5pgCenwAVI3sjHusjOfEkim 5+hNL4V7JzEVpZ5qGEiTzROuJHL2tpkJ4waRObqOg4dLeW8tuaY6h9ve0EgY3Phxg8Ef /RZ8SmcXPdYiEHIA69XQUowCOWCbBJXD9WzkpBjrjYwTBXxf5d3j40ZnPud0jVTVNxU0 ndLE8U+/I4YgRNJ45ShCeLUQ/7ohdW1fICcnNLDRSwBxbwcoE5qjoN8ykRfY016va9ym 3i7w== X-Gm-Message-State: AFqh2kp5WdJ4whpicP5ikXAH/1pAtjZbMo5CSVCQNXohOlbJJbo/p2Dj ZlIzraZqjPTu3QgPg8JBndM= X-Google-Smtp-Source: AMrXdXtSazAK9U1vNS3/o6BIyP1/8lzeUvDoZaO03p3Z3P41jrM61NRwAal+lrvrY4+4kZW17syywg== X-Received: by 2002:a62:ab16:0:b0:56b:d68d:7136 with SMTP id p22-20020a62ab16000000b0056bd68d7136mr1120872pff.11.1671602497635; Tue, 20 Dec 2022 22:01:37 -0800 (PST) Received: from vernon-pc.. ([114.231.52.81]) by smtp.gmail.com with ESMTPSA id w7-20020a626207000000b00562677968aesm9598886pfb.72.2022.12.20.22.01.35 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 20 Dec 2022 22:01:37 -0800 (PST) From: Vernon Yang To: Liam.Howlett@oracle.com, akpm@linux-foundation.org Cc: linux-mm@kvack.org, linux-kernel@vger.kernel.org, maple-tree@lists.infradead.org, Vernon Yang Subject: [PATCH v2 5/7] maple_tree: remove the redundant code Date: Wed, 21 Dec 2022 14:00:56 +0800 Message-Id: <20221221060058.609003-6-vernon2gm@gmail.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20221221060058.609003-1-vernon2gm@gmail.com> References: <20221221060058.609003-1-vernon2gm@gmail.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" The macros CONFIG_DEBUG_MAPLE_TREE_VERBOSE no one uses, functions mas_dup_tree() and mas_dup_store() are not implemented, just function declaration, so drop it. Reviewed-by: Liam R. Howlett Signed-off-by: Vernon Yang --- include/linux/maple_tree.h | 4 ---- 1 file changed, 4 deletions(-) diff --git a/include/linux/maple_tree.h b/include/linux/maple_tree.h index 4ee5a969441c..815a27661517 100644 --- a/include/linux/maple_tree.h +++ b/include/linux/maple_tree.h @@ -12,7 +12,6 @@ #include #include /* #define CONFIG_MAPLE_RCU_DISABLED */ -/* #define CONFIG_DEBUG_MAPLE_TREE_VERBOSE */ =20 /* * Allocated nodes are mutable until they have been inserted into the tree, @@ -483,9 +482,6 @@ static inline bool mas_is_paused(struct ma_state *mas) return mas->node =3D=3D MAS_PAUSE; } =20 -void mas_dup_tree(struct ma_state *oldmas, struct ma_state *mas); -void mas_dup_store(struct ma_state *mas, void *entry); - /* * This finds an empty area from the highest address to the lowest. * AKA "Topdown" version, --=20 2.34.1 From nobody Wed Sep 17 08:58:10 2025 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 vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id C731FC4332F for ; Wed, 21 Dec 2022 06:02:21 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234465AbiLUGCU (ORCPT ); Wed, 21 Dec 2022 01:02:20 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:59716 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234508AbiLUGBz (ORCPT ); Wed, 21 Dec 2022 01:01:55 -0500 Received: from mail-pg1-x52e.google.com (mail-pg1-x52e.google.com [IPv6:2607:f8b0:4864:20::52e]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id EEE821EC78 for ; Tue, 20 Dec 2022 22:01:40 -0800 (PST) Received: by mail-pg1-x52e.google.com with SMTP id v3so9759175pgh.4 for ; Tue, 20 Dec 2022 22:01:40 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=pxb84ytAPFYreSOdPkhL3PM7KemIvxiY/1J13wK332c=; b=UjDk03Xng4Fdh5jRhus2wH9UUuHAQyoFWmA2K42x+nWA7pqpImyeM0Kt2r5uZQ0hXF vw9C9qsE1YdAAUSnNHaCc8Btp8sLRss51PLxbbpIe2YiycY8rITES89MtLAHVNd5vzum zGGUeuc8OrQQuOqapwjOl9rPfBtU6BXem5qzstlBpIJRxC5vKgsT8Aa2Tbc/O4Yq1HpW fQrUq/T9UadAmhL9DW39kwVKpbD21TMHt+o17qb5vLqtU5IWH1CCmhnY3HPHlm59W9pz VaxdRz/9zO3jznGR0DfTxjUts8mfxb+KUgaHEh0h5ET7bku0Tn1IK4kfxOUW4IgjFYM4 cjvw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:mime-version: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=pxb84ytAPFYreSOdPkhL3PM7KemIvxiY/1J13wK332c=; b=038AtODNL8FnJErGhObYRAQKsc5dY6vbOlcCC8PmpuZN5+wYpL7O+mTsytaDcN+aSu ZrRYABIM7DqTQzZNSUsOJWqwWvOAkJEeOBje5MjPHjxRLHyoujrlgUJlBR/W8IijI+vD x2GeIEoktAe3+WQceA73XkULe771n2fX+LwPKJbuHBedLaoc+q54V63zr4hRijXEovmM vszTGrKpL0tp8Y0RxmatSvZETfifV+Sqya9II6gOCpG7NRlInoWqCNMpn9z6JcP7fBFz f/iU++gWa/l4irL61Lqa1+k3AJK5sYCYBjQ+Ygs15nYY8wcxESqehufF8B5pgwgaql5g E0LA== X-Gm-Message-State: AFqh2kqPgMNKWBK8nowjLbwrkUwi5PWaa0YFE9KG7uHrqufRbPIi1gTw E+NCsPQDyRnAU4AD9bfrVns= X-Google-Smtp-Source: AMrXdXtMQNG4MLPAQuAxM6F8pv2SymackH14UvCmmp2Lj0VLowO3NVPJe1mW7SvC4gzZLgCzhayhhQ== X-Received: by 2002:aa7:81d4:0:b0:56e:a7a7:35a0 with SMTP id c20-20020aa781d4000000b0056ea7a735a0mr1036849pfn.25.1671602500364; Tue, 20 Dec 2022 22:01:40 -0800 (PST) Received: from vernon-pc.. ([114.231.52.81]) by smtp.gmail.com with ESMTPSA id w7-20020a626207000000b00562677968aesm9598886pfb.72.2022.12.20.22.01.37 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 20 Dec 2022 22:01:39 -0800 (PST) From: Vernon Yang To: Liam.Howlett@oracle.com, akpm@linux-foundation.org Cc: linux-mm@kvack.org, linux-kernel@vger.kernel.org, maple-tree@lists.infradead.org, Vernon Yang Subject: [PATCH v2 6/7] maple_tree: refine ma_state init from mas_start() Date: Wed, 21 Dec 2022 14:00:57 +0800 Message-Id: <20221221060058.609003-7-vernon2gm@gmail.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20221221060058.609003-1-vernon2gm@gmail.com> References: <20221221060058.609003-1-vernon2gm@gmail.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" If mas->node is an MAS_START, there are three cases, and they all assign different values to mas->node and mas->offset. So there is no need to set them to a default value before updating. Update them directly to make them easier to understand and for better readability. Reviewed-by: Liam R. Howlett Signed-off-by: Vernon Yang --- lib/maple_tree.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/lib/maple_tree.c b/lib/maple_tree.c index b3a215dd961e..5911211c8557 100644 --- a/lib/maple_tree.c +++ b/lib/maple_tree.c @@ -1329,7 +1329,7 @@ static void mas_node_count(struct ma_state *mas, int = count) * mas_start() - Sets up maple state for operations. * @mas: The maple state. * - * If mas->node =3D=3D MAS_START, then set the min, max, depth, and offset= to + * If mas->node =3D=3D MAS_START, then set the min, max and depth to * defaults. * * Return: @@ -1343,22 +1343,22 @@ static inline struct maple_enode *mas_start(struct = ma_state *mas) if (likely(mas_is_start(mas))) { struct maple_enode *root; =20 - mas->node =3D MAS_NONE; mas->min =3D 0; mas->max =3D ULONG_MAX; mas->depth =3D 0; - mas->offset =3D 0; =20 root =3D mas_root(mas); /* Tree with nodes */ if (likely(xa_is_node(root))) { mas->depth =3D 1; mas->node =3D mte_safe_root(root); + mas->offset =3D 0; return NULL; } =20 /* empty tree */ if (unlikely(!root)) { + mas->node =3D MAS_NONE; mas->offset =3D MAPLE_NODE_SLOTS; return NULL; } --=20 2.34.1 From nobody Wed Sep 17 08:58:10 2025 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 vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id C1136C4332F for ; Wed, 21 Dec 2022 06:02:31 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234453AbiLUGC3 (ORCPT ); Wed, 21 Dec 2022 01:02:29 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:59916 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234478AbiLUGCC (ORCPT ); Wed, 21 Dec 2022 01:02:02 -0500 Received: from mail-pf1-x42e.google.com (mail-pf1-x42e.google.com [IPv6:2607:f8b0:4864:20::42e]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 3741A20F7D for ; Tue, 20 Dec 2022 22:01:44 -0800 (PST) Received: by mail-pf1-x42e.google.com with SMTP id 21so9994759pfw.4 for ; Tue, 20 Dec 2022 22:01:44 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=ytBbvPTXR4FdqciS4jsfQvnjl2UrmH262qeoBNVrzHw=; b=jw0wbWgKyc3Q6Zq1TuhcRXITmEOfWs7TN0eWvllMPmMcHMAdVZWUm80Eh2mWdWnt7k hXWD+JrNkOB7hvw4ppRyxg2PVr0MhhrPZqgApkq2npstymirN6PCv2462HJ6G9D1STUX IqRMa/uqSTUy55DX8LFZnwAEvexbPqVRLeIjWBaJx1R3LS3f1IzRqCi019epBfNGsGBL 8TO6gv50pUT2bNAWYVMUDKBS3gslh86ihDiAylvYMCQcGV5SPvp9kupz0rQyLZ9vyjgs s5zMrlgBEyQHpeM/ggwOmZEed8IRBpvkydAMrfPH3Gs4smtBcmEx/TchhlNSmgITQid/ 4hyg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:mime-version: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=ytBbvPTXR4FdqciS4jsfQvnjl2UrmH262qeoBNVrzHw=; b=S/hyo0zJ8f3U4mQQrLpEULz6ObbJQOf4p70OwOrBu80mRhUSwrKHaOb7GebONPCgyR w53nnrECe/fxBO/vjOe83dySYTXG6l3s/HVqMraX1RCx24a/uBikrTv4WMYCO8mg8qDF a0dQkBmifeoraPyW1LHvenR5Bp6YVc88vFOfcZZhorz88lKCwM5VB+b6nuy8kwi2KKLk ddvosBxAYMJZgU8l0/wngMv8gg7rtfKQBA4fQt/uJn8xfYk1NvjYXkP9ybUX49R617TH b0a9fkg6vbBJY4DyTzZVL9Ix2wPuDfpQWX2ifOJvCTd4YBQuG5JWNqC2vVTVlIe32ByM cqdw== X-Gm-Message-State: AFqh2koqOCZaGidzQQ1qxyTv2Qfl7QliwCof2Yk3CzCPp8Fz8HX5e/gS i/axwx8YAu3DrnWuisF1skA= X-Google-Smtp-Source: AMrXdXsxGwqIM5xvXEW99PyYos0qHzvLtaE2c5N1DiiTeZRQgwkFsv40m2wKs3WF1Y5ZUax9VoVMjg== X-Received: by 2002:a62:6143:0:b0:577:3546:d7be with SMTP id v64-20020a626143000000b005773546d7bemr1140045pfb.30.1671602503240; Tue, 20 Dec 2022 22:01:43 -0800 (PST) Received: from vernon-pc.. ([114.231.52.81]) by smtp.gmail.com with ESMTPSA id w7-20020a626207000000b00562677968aesm9598886pfb.72.2022.12.20.22.01.40 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 20 Dec 2022 22:01:42 -0800 (PST) From: Vernon Yang To: Liam.Howlett@oracle.com, akpm@linux-foundation.org Cc: linux-mm@kvack.org, linux-kernel@vger.kernel.org, maple-tree@lists.infradead.org, Vernon Yang Subject: [PATCH v2 7/7] maple_tree: refine mab_calc_split function Date: Wed, 21 Dec 2022 14:00:58 +0800 Message-Id: <20221221060058.609003-8-vernon2gm@gmail.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20221221060058.609003-1-vernon2gm@gmail.com> References: <20221221060058.609003-1-vernon2gm@gmail.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" Invert the conditional judgment of the mid_split, to focus the return statement in the last statement, which is easier to understand and for better readability. Signed-off-by: Vernon Yang Reviewed-by: Liam R. Howlett --- lib/maple_tree.c | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/lib/maple_tree.c b/lib/maple_tree.c index 5911211c8557..5e1a9d39b330 100644 --- a/lib/maple_tree.c +++ b/lib/maple_tree.c @@ -1882,10 +1882,9 @@ static inline int mab_calc_split(struct ma_state *ma= s, =20 /* Avoid ending a node on a NULL entry */ split =3D mab_no_null_split(bn, split, slot_count); - if (!(*mid_split)) - return split; =20 - *mid_split =3D mab_no_null_split(bn, *mid_split, slot_count); + if (unlikely(*mid_split)) + *mid_split =3D mab_no_null_split(bn, *mid_split, slot_count); =20 return split; } --=20 2.34.1