linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
From: "Liam R. Howlett" <Liam.Howlett@Oracle.com>
To: Peng Zhang <zhangpeng.00@bytedance.com>
Cc: akpm@linux-foundation.org, linux-mm@kvack.org,
	linux-kernel@vger.kernel.org, maple-tree@lists.infradead.org
Subject: Re: [RESEND PATCH 2/8] maple_tree: don't use MAPLE_ARANGE64_META_MAX to indicate no gap
Date: Fri, 7 Jul 2023 11:18:36 -0400	[thread overview]
Message-ID: <20230707151836.stxta46buk3qpuxr@revolver> (raw)
In-Reply-To: <20230707101057.29326-3-zhangpeng.00@bytedance.com>

* Peng Zhang <zhangpeng.00@bytedance.com> [230707 06:11]:
> Do not use a special offset to indicate that there is no gap. When there
> is no gap, offset can point to any valid slots because its gap is 0.
> 
> Signed-off-by: Peng Zhang <zhangpeng.00@bytedance.com>

Reviewed-by: Liam R. Howlett <Liam.Howlett@oracle.com>

> ---
>  include/linux/maple_tree.h |  2 --
>  lib/maple_tree.c           | 13 ++-----------
>  2 files changed, 2 insertions(+), 13 deletions(-)
> 
> diff --git a/include/linux/maple_tree.h b/include/linux/maple_tree.h
> index e18ecbefc7f7..4e004d86c780 100644
> --- a/include/linux/maple_tree.h
> +++ b/include/linux/maple_tree.h
> @@ -29,14 +29,12 @@
>  #define MAPLE_NODE_SLOTS	31	/* 256 bytes including ->parent */
>  #define MAPLE_RANGE64_SLOTS	16	/* 256 bytes */
>  #define MAPLE_ARANGE64_SLOTS	10	/* 240 bytes */
> -#define MAPLE_ARANGE64_META_MAX	15	/* Out of range for metadata */
>  #define MAPLE_ALLOC_SLOTS	(MAPLE_NODE_SLOTS - 1)
>  #else
>  /* 32bit sizes */
>  #define MAPLE_NODE_SLOTS	63	/* 256 bytes including ->parent */
>  #define MAPLE_RANGE64_SLOTS	32	/* 256 bytes */
>  #define MAPLE_ARANGE64_SLOTS	21	/* 240 bytes */
> -#define MAPLE_ARANGE64_META_MAX	31	/* Out of range for metadata */
>  #define MAPLE_ALLOC_SLOTS	(MAPLE_NODE_SLOTS - 2)
>  #endif /* defined(CONFIG_64BIT) || defined(BUILD_VDSO32_64) */
>  
> diff --git a/lib/maple_tree.c b/lib/maple_tree.c
> index f55e59bd9122..6a8982146338 100644
> --- a/lib/maple_tree.c
> +++ b/lib/maple_tree.c
> @@ -1610,8 +1610,6 @@ ma_max_gap(struct maple_node *node, unsigned long *gaps, enum maple_type mt,
>   * mas_max_gap() - find the largest gap in a non-leaf node and set the slot.
>   * @mas: The maple state.
>   *
> - * If the metadata gap is set to MAPLE_ARANGE64_META_MAX, there is no gap.
> - *
>   * Return: The gap value.
>   */
>  static inline unsigned long mas_max_gap(struct ma_state *mas)
> @@ -1628,9 +1626,6 @@ static inline unsigned long mas_max_gap(struct ma_state *mas)
>  	node = mas_mn(mas);
>  	MAS_BUG_ON(mas, mt != maple_arange_64);
>  	offset = ma_meta_gap(node, mt);
> -	if (offset == MAPLE_ARANGE64_META_MAX)
> -		return 0;
> -
>  	gaps = ma_gaps(node, mt);
>  	return gaps[offset];
>  }
> @@ -1662,10 +1657,7 @@ static inline void mas_parent_gap(struct ma_state *mas, unsigned char offset,
>  ascend:
>  	MAS_BUG_ON(mas, pmt != maple_arange_64);
>  	meta_offset = ma_meta_gap(pnode, pmt);
> -	if (meta_offset == MAPLE_ARANGE64_META_MAX)
> -		meta_gap = 0;
> -	else
> -		meta_gap = pgaps[meta_offset];
> +	meta_gap = pgaps[meta_offset];
>  
>  	pgaps[offset] = new;
>  
> @@ -1678,7 +1670,6 @@ static inline void mas_parent_gap(struct ma_state *mas, unsigned char offset,
>  
>  		ma_set_meta_gap(pnode, pmt, offset);
>  	} else if (new < meta_gap) {
> -		meta_offset = 15;
>  		new = ma_max_gap(pnode, pgaps, pmt, &meta_offset);
>  		ma_set_meta_gap(pnode, pmt, meta_offset);
>  	}
> @@ -2076,7 +2067,7 @@ static inline void mab_mas_cp(struct maple_big_node *b_node,
>  	end = j - 1;
>  	if (likely(!ma_is_leaf(mt) && mt_is_alloc(mas->tree))) {
>  		unsigned long max_gap = 0;
> -		unsigned char offset = 15;
> +		unsigned char offset = 0;
>  
>  		gaps = ma_gaps(node, mt);
>  		do {
> -- 
> 2.20.1
> 


  reply	other threads:[~2023-07-07 15:19 UTC|newest]

Thread overview: 24+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-07-07 10:10 [RESEND PATCH 0/8] Improve the validation for maple tree and some cleanup Peng Zhang
2023-07-07 10:10 ` [RESEND PATCH 1/8] maple_tree: set the node limit when creating a new root node Peng Zhang
2023-07-07 15:18   ` Liam R. Howlett
2023-07-10 15:05     ` Liam R. Howlett
2023-07-10 15:07       ` Liam R. Howlett
2023-07-07 10:10 ` [RESEND PATCH 2/8] maple_tree: don't use MAPLE_ARANGE64_META_MAX to indicate no gap Peng Zhang
2023-07-07 15:18   ` Liam R. Howlett [this message]
2023-07-07 10:10 ` [RESEND PATCH 3/8] maple_tree: make mas_validate_gaps() to check metadata Peng Zhang
2023-07-07 14:45   ` Liam R. Howlett
2023-07-10  9:44     ` Peng Zhang
2023-07-10 13:57       ` Liam R. Howlett
2023-07-07 10:10 ` [RESEND PATCH 4/8] maple_tree: fix mas_validate_child_slot() to check last missed slot Peng Zhang
2023-07-07 15:18   ` Liam R. Howlett
2023-07-07 10:10 ` [RESEND PATCH 5/8] maple_tree: make mas_validate_limits() check root node and node limit Peng Zhang
2023-07-07 14:58   ` Liam R. Howlett
2023-07-10  9:11     ` Peng Zhang
2023-07-07 10:10 ` [RESEND PATCH 6/8] maple_tree: update mt_validate() Peng Zhang
2023-07-07 15:02   ` Liam R. Howlett
2023-07-10  9:47     ` Peng Zhang
2023-07-07 10:10 ` [RESEND PATCH 7/8] maple_tree: replace mas_logical_pivot() with mas_safe_pivot() Peng Zhang
2023-07-07 15:19   ` Liam R. Howlett
2023-07-07 10:10 ` [RESEND PATCH 8/8] maple_tree: drop mas_first_entry() Peng Zhang
2023-07-07 15:19   ` Liam R. Howlett
2023-07-07 13:48 ` [RESEND PATCH 0/8] Improve the validation for maple tree and some cleanup Liam R. Howlett

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20230707151836.stxta46buk3qpuxr@revolver \
    --to=liam.howlett@oracle.com \
    --cc=akpm@linux-foundation.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mm@kvack.org \
    --cc=maple-tree@lists.infradead.org \
    --cc=zhangpeng.00@bytedance.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox