linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
From: yangerkun <yangerkun@huaweicloud.com>
To: "Liam R. Howlett" <Liam.Howlett@oracle.com>,
	Andrew Morton <akpm@linux-foundation.org>
Cc: maple-tree@lists.infradead.org, linux-mm@kvack.org,
	linux-kernel@vger.kernel.org, chuck.lever@oracle.com,
	brauner@kernel.org
Subject: Re: [PATCH 1/2] maple_tree: Fix mas_alloc_cyclic() second search
Date: Tue, 17 Dec 2024 19:27:07 +0800	[thread overview]
Message-ID: <30e13c1c-5dd7-da94-9d2a-6277ade3e9e4@huaweicloud.com> (raw)
In-Reply-To: <20241216190113.1226145-2-Liam.Howlett@oracle.com>



在 2024/12/17 3:01, Liam R. Howlett 写道:
> From: "Liam R. Howlett" <Liam.Howlett@Oracle.com>
> 
> The first search may leave the maple state in an error state.  Reset the
> maple state before the second search so that the search has a chance of
> executing correctly after an exhausted first search.
> 
> Link: https://lore.kernel.org/all/20241216060600.287B4C4CED0@smtp.kernel.org/
> Fixes: 9b6713cc7522 ("maple_tree: Add mtree_alloc_cyclic()")
> Cc: Yang Erkun <yangerkun@huaweicloud.com>
> Cc: chuck.lever@oracle.com
> Cc: brauner@kernel.org
> Signed-off-by: Liam R. Howlett <Liam.Howlett@Oracle.com>
> ---
>   lib/maple_tree.c | 3 +--
>   1 file changed, 1 insertion(+), 2 deletions(-)

This looks more clear!

Reviewed-by: Yang Erkun <yangerkun@huawei.com>

> 
> diff --git a/lib/maple_tree.c b/lib/maple_tree.c
> index 940d30653407b..f7153ade1be5f 100644
> --- a/lib/maple_tree.c
> +++ b/lib/maple_tree.c
> @@ -4335,7 +4335,6 @@ int mas_alloc_cyclic(struct ma_state *mas, unsigned long *startp,
>   {
>   	unsigned long min = range_lo;
>   	int ret = 0;
> -	struct ma_state m = *mas;
>   
>   	range_lo = max(min, *next);
>   	ret = mas_empty_area(mas, range_lo, range_hi, 1);
> @@ -4344,7 +4343,7 @@ int mas_alloc_cyclic(struct ma_state *mas, unsigned long *startp,
>   		ret = 1;
>   	}
>   	if (ret < 0 && range_lo > min) {
> -		*mas = m;
> +		mas_reset(mas);
>   		ret = mas_empty_area(mas, min, range_hi, 1);
>   		if (ret == 0)
>   			ret = 1;



  reply	other threads:[~2024-12-17 11:27 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-12-16 19:01 [PATCH 0/2] Fix mas_alloc_cyclic retry Liam R. Howlett
2024-12-16 19:01 ` [PATCH 1/2] maple_tree: Fix mas_alloc_cyclic() second search Liam R. Howlett
2024-12-17 11:27   ` yangerkun [this message]
2024-12-16 19:01 ` [PATCH 2/2] test_maple_tree: Test exhausted upper limit of mtree_alloc_cyclic() Liam R. Howlett
2024-12-17 11:41   ` yangerkun

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=30e13c1c-5dd7-da94-9d2a-6277ade3e9e4@huaweicloud.com \
    --to=yangerkun@huaweicloud.com \
    --cc=Liam.Howlett@oracle.com \
    --cc=akpm@linux-foundation.org \
    --cc=brauner@kernel.org \
    --cc=chuck.lever@oracle.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mm@kvack.org \
    --cc=maple-tree@lists.infradead.org \
    /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