lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <25ea9d02-a941-3ab6-8ffb-e6394e2bc027@bytedance.com>
Date:   Wed, 26 Apr 2023 13:27:57 +0800
From:   Peng Zhang <zhangpeng.00@...edance.com>
To:     "Liam R. Howlett" <Liam.Howlett@...cle.com>
Cc:     linux-kernel@...r.kernel.org, linux-mm@...ck.org,
        maple-tree@...ts.infradead.org,
        Andrew Morton <akpm@...ux-foundation.org>
Subject: Re: [PATCH 03/34] maple_tree: Avoid unnecessary ascending


在 2023/4/25 22:09, Liam R. Howlett 写道:
> The maple tree node limits are implied by the parent.  When walking up
> the tree, the limit may not be known until a slot that does not have
> implied limits are encountered.  However, if the node is the left-most
> or right-most node, the walking up to find that limit can be skipped.
>
> This commit also fixes the debug/testing code that was not setting the
> limit on walking down the tree as that optimization is not compatible
> with this change.
>
> Signed-off-by: Liam R. Howlett <Liam.Howlett@...cle.com>
Reviewed-by: Peng Zhang <zhangpeng.00@...edance.com>
> ---
>   lib/maple_tree.c                 | 6 ++++++
>   tools/testing/radix-tree/maple.c | 4 ++++
>   2 files changed, 10 insertions(+)
>
> diff --git a/lib/maple_tree.c b/lib/maple_tree.c
> index ac0245dd88dad..60bae5be008a6 100644
> --- a/lib/maple_tree.c
> +++ b/lib/maple_tree.c
> @@ -1132,6 +1132,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:

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ