linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
From: Wei Yang <richard.weiyang@gmail.com>
To: "Liam R. Howlett" <Liam.Howlett@oracle.com>,
	Wei Yang <richard.weiyang@gmail.com>,
	akpm@linux-foundation.org, maple-tree@lists.infradead.org,
	linux-mm@kvack.org, Lorenzo Stoakes <lorenzo.stoakes@oracle.com>,
	Sidhartha Kumar <sidhartha.kumar@oracle.com>
Subject: Re: [PATCH 2/3] maple_tree: not possible to be a root node after loop
Date: Thu, 21 Nov 2024 07:13:31 +0000	[thread overview]
Message-ID: <20241121071331.fj4fymnjkw2iksqx@master> (raw)
In-Reply-To: <lxlovw66eg7xsdfvym73v4jtaj6x5zrebecxp5k4pkds3jgvko@uioiaiobb5kc>

On Tue, Nov 19, 2024 at 09:12:31AM -0500, Liam R. Howlett wrote:
>* Wei Yang <richard.weiyang@gmail.com> [241118 21:10]:
>> On Mon, Nov 18, 2024 at 03:49:55PM -0500, Liam R. Howlett wrote:
>> >* Wei Yang <richard.weiyang@gmail.com> [241115 20:48]:
>> >> Empty tree and single entry tree is handled else whether, so the maple
>> >> tree here must be a tree with nodes.
>> >> 
>> >> If the height is 1 and we found the gap, it will jump to *done* since it
>> >> is also a leaf.
>> >> If the height is more than one, and there may be an available range, we
>> >> will descend the tree, which is not root anymore.
>> >> 
>> >> If there is no available range, we will set error and return.
>> >
>> >Isn't this needed for the overflow case?  That is, if there is a range
>> >that ends at ULONG_MAX, then we will break from the loop on the offset
>> >limit, but not check for root, return false, and continue to loop.
>> >
>> 
>> I may not follow you correctly.
>> 
>> If there is an available range that ends at ULONG_MAX for a root node, we
>> break the loop with two conditions:
>> 
>>   * the root node is a leaf node, then we will set found to true
>>   * the root node has children, then descend to a non-root node
>> 
>> Not sure this is the case you mentioned.
>
>I am concerned of the case where there isn't a gap in the last slot of a
>leaf root node.  Examining it, I think we are okay.
>
>next_slot:
>                min = pivot + 1; <-----min = 0, overflow.

Oh, this overflow.

>                if (mas->last <= pivot) { <-- still okay.
>                        mas_set_err(mas, -EBUSY);
>                        return true;
>                }

Thanks.

So it looks good to you ?

-- 
Wei Yang
Help you, Help me


  reply	other threads:[~2024-11-21  7:13 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-11-16  1:48 [PATCH 0/3] mas_anode_descend() related cleanup Wei Yang
2024-11-16  1:48 ` [PATCH 1/3] maple_tree: index has been checked to be smaller than pivot Wei Yang
2024-11-18 20:53   ` Liam R. Howlett
2024-11-16  1:48 ` [PATCH 2/3] maple_tree: not possible to be a root node after loop Wei Yang
2024-11-18 20:49   ` Liam R. Howlett
2024-11-19  2:10     ` Wei Yang
2024-11-19 14:12       ` Liam R. Howlett
2024-11-21  7:13         ` Wei Yang [this message]
2024-11-22 15:17           ` Liam R. Howlett
2024-11-16  1:48 ` [PATCH 3/3] maple_tree: we don't set offset to MAPLE_NODE_SLOTS on error Wei Yang
2024-11-18 20:50   ` Liam R. Howlett
2024-11-19  2:15     ` Wei Yang
2024-11-19 13:58       ` Liam R. Howlett
2024-11-21  7:15         ` Wei Yang
2024-11-22 15:18           ` 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=20241121071331.fj4fymnjkw2iksqx@master \
    --to=richard.weiyang@gmail.com \
    --cc=Liam.Howlett@oracle.com \
    --cc=akpm@linux-foundation.org \
    --cc=linux-mm@kvack.org \
    --cc=lorenzo.stoakes@oracle.com \
    --cc=maple-tree@lists.infradead.org \
    --cc=sidhartha.kumar@oracle.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