linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
From: "Liam R. Howlett" <Liam.Howlett@oracle.com>
To: maple-tree@lists.infradead.org, linux-mm@kvack.org,
	linux-kernel@vger.kernel.org,
	Andrew Morton <akpm@linux-foundation.org>,
	Stable@vger.kernel.org, zhangpeng.00@bytedance.com,
	snild@sony.com
Cc: "Liam R. Howlett" <Liam.Howlett@oracle.com>
Subject: [PATCH v2 0/2] Fix mas_skip_node() for mas_empty_area()
Date: Tue,  7 Mar 2023 13:02:45 -0500	[thread overview]
Message-ID: <20230307180247.2220303-1-Liam.Howlett@oracle.com> (raw)

Andrew, this should replace these patches in mm-hotfixes-unstable:
400922513f30 ("maple_tree: fix mas_skip_node() end slot detection")
4d4ec28ef3a4 ("test_maple_tree: add more testing for mas_empty_area()")

mas_empty_area() was incorrectly returning an error when there was room.
The issue was tracked down to mas_skip_node() using the incorrect
end-of-slot count.  Instead of using the nodes hard limit, the limit of
data should be used.

mas_skip_node() was also setting the min and max to that of the child
node, which was unnecessary.  Within these limits being set, there was
also a bug that corrupted the maple state's max if the offset was set to
the maximum node pivot.  The bug was without consequence unless there
was a sufficient gap in the next child node which would cause an error
to be returned.

This patch set fixes these errors by removing the limit setting from
mas_skip_node() and uses the mas_data_end() for slot limits, and adds
tests for all failures discovered.

Liam R. Howlett (2):
  maple_tree: Fix mas_skip_node() end slot detection
  test_maple_tree: Add more testing for mas_empty_area()

 lib/maple_tree.c      | 24 +++++-----------------
 lib/test_maple_tree.c | 48 +++++++++++++++++++++++++++++++++++++++++++
 2 files changed, 53 insertions(+), 19 deletions(-)

-- 
2.39.2



             reply	other threads:[~2023-03-07 18:03 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-03-07 18:02 Liam R. Howlett [this message]
2023-03-07 18:02 ` [PATCH v2 1/2] maple_tree: Fix mas_skip_node() end slot detection Liam R. Howlett
2023-03-08  8:49   ` Snild Dolkow
2023-03-07 18:02 ` [PATCH v2 2/2] test_maple_tree: Add more testing for mas_empty_area() 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=20230307180247.2220303-1-Liam.Howlett@oracle.com \
    --to=liam.howlett@oracle.com \
    --cc=Stable@vger.kernel.org \
    --cc=akpm@linux-foundation.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mm@kvack.org \
    --cc=maple-tree@lists.infradead.org \
    --cc=snild@sony.com \
    --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