* [PATCH v2] maple_tree: document that "last" in mtree_insert_range() is inclusive
@ 2026-05-12 21:56 Steven Rostedt
2026-05-13 0:40 ` Liam R. Howlett
2026-05-14 1:42 ` SeongJae Park
0 siblings, 2 replies; 5+ messages in thread
From: Steven Rostedt @ 2026-05-12 21:56 UTC (permalink / raw)
To: Liam R. Howlett, LKML, linux-mm, Alice Ryhl, Andrew Ballance,
maple-tree, Andrew Morton, Matthew Wilcox, SeongJae Park
From: Steven Rostedt <rostedt@goodmis.org>
The kernel doc of mtree_insert_range() does not state if the address
represented by the "last" parameter is inclusive or exclusive. This can
lead to bugs by code that assumes it is exclusive. Explicitly state that
the parameter is inclusive.
Signed-off-by: Steven Rostedt <rostedt@goodmis.org>
---
Changes since v1: https://patch.msgid.link/20260506105218.2d027cc0@fedora
- Use "(inclusive)" instead of adding '[' ']' around "end". (Alice Ryhl)
- Add "from [first, last]" in the short description. (Liam Howlett)
lib/maple_tree.c | 7 +++++--
1 file changed, 5 insertions(+), 2 deletions(-)
diff --git a/lib/maple_tree.c b/lib/maple_tree.c
index d18d7ed9ab67..7f6c9b729a1a 100644
--- a/lib/maple_tree.c
+++ b/lib/maple_tree.c
@@ -5727,13 +5727,16 @@ int mtree_store(struct maple_tree *mt, unsigned long index, void *entry,
EXPORT_SYMBOL(mtree_store);
/**
- * mtree_insert_range() - Insert an entry at a given range if there is no value.
+ * mtree_insert_range() - Insert an entry from [first, last] at a given range
+ * if there is no value.
* @mt: The maple tree
* @first: The start of the range
- * @last: The end of the range
+ * @last: The end of the range (inclusive)
* @entry: The entry to store
* @gfp: The GFP_FLAGS to use for allocations.
*
+ * Note that @last is inclusive. That is, @last = @first + length - 1;
+ *
* Return: 0 on success, -EEXISTS if the range is occupied, -EINVAL on invalid
* request, -ENOMEM if memory could not be allocated.
*/
--
2.53.0
^ permalink raw reply related [flat|nested] 5+ messages in thread
* Re: [PATCH v2] maple_tree: document that "last" in mtree_insert_range() is inclusive
2026-05-12 21:56 [PATCH v2] maple_tree: document that "last" in mtree_insert_range() is inclusive Steven Rostedt
@ 2026-05-13 0:40 ` Liam R. Howlett
2026-05-14 1:42 ` SeongJae Park
1 sibling, 0 replies; 5+ messages in thread
From: Liam R. Howlett @ 2026-05-13 0:40 UTC (permalink / raw)
To: Steven Rostedt
Cc: LKML, linux-mm, Alice Ryhl, Andrew Ballance, maple-tree,
Andrew Morton, Matthew Wilcox, SeongJae Park
On 26/05/12 05:56PM, Steven Rostedt wrote:
> From: Steven Rostedt <rostedt@goodmis.org>
>
> The kernel doc of mtree_insert_range() does not state if the address
> represented by the "last" parameter is inclusive or exclusive. This can
> lead to bugs by code that assumes it is exclusive. Explicitly state that
> the parameter is inclusive.
>
> Signed-off-by: Steven Rostedt <rostedt@goodmis.org>
Thanks, this looks good.
Reviewed-by: "Liam R. Howlett" <liam@infradead.org>
> ---
> Changes since v1: https://patch.msgid.link/20260506105218.2d027cc0@fedora
>
> - Use "(inclusive)" instead of adding '[' ']' around "end". (Alice Ryhl)
>
> - Add "from [first, last]" in the short description. (Liam Howlett)
>
> lib/maple_tree.c | 7 +++++--
> 1 file changed, 5 insertions(+), 2 deletions(-)
>
> diff --git a/lib/maple_tree.c b/lib/maple_tree.c
> index d18d7ed9ab67..7f6c9b729a1a 100644
> --- a/lib/maple_tree.c
> +++ b/lib/maple_tree.c
> @@ -5727,13 +5727,16 @@ int mtree_store(struct maple_tree *mt, unsigned long index, void *entry,
> EXPORT_SYMBOL(mtree_store);
>
> /**
> - * mtree_insert_range() - Insert an entry at a given range if there is no value.
> + * mtree_insert_range() - Insert an entry from [first, last] at a given range
> + * if there is no value.
> * @mt: The maple tree
> * @first: The start of the range
> - * @last: The end of the range
> + * @last: The end of the range (inclusive)
> * @entry: The entry to store
> * @gfp: The GFP_FLAGS to use for allocations.
> *
> + * Note that @last is inclusive. That is, @last = @first + length - 1;
> + *
> * Return: 0 on success, -EEXISTS if the range is occupied, -EINVAL on invalid
> * request, -ENOMEM if memory could not be allocated.
> */
> --
> 2.53.0
>
>
> --
> maple-tree mailing list
> maple-tree@lists.infradead.org
> https://lists.infradead.org/mailman/listinfo/maple-tree
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH v2] maple_tree: document that "last" in mtree_insert_range() is inclusive
2026-05-12 21:56 [PATCH v2] maple_tree: document that "last" in mtree_insert_range() is inclusive Steven Rostedt
2026-05-13 0:40 ` Liam R. Howlett
@ 2026-05-14 1:42 ` SeongJae Park
2026-05-14 14:07 ` Steven Rostedt
1 sibling, 1 reply; 5+ messages in thread
From: SeongJae Park @ 2026-05-14 1:42 UTC (permalink / raw)
To: Steven Rostedt
Cc: SeongJae Park, Liam R. Howlett, LKML, linux-mm, Alice Ryhl,
Andrew Ballance, maple-tree, Andrew Morton, Matthew Wilcox
On Tue, 12 May 2026 17:56:23 -0400 Steven Rostedt <rostedt@kernel.org> wrote:
> From: Steven Rostedt <rostedt@goodmis.org>
>
> The kernel doc of mtree_insert_range() does not state if the address
> represented by the "last" parameter is inclusive or exclusive. This can
> lead to bugs by code that assumes it is exclusive. Explicitly state that
> the parameter is inclusive.
>
> Signed-off-by: Steven Rostedt <rostedt@goodmis.org>
Acked-by: SeongJae Park <sj@kernel.org>
> ---
> Changes since v1: https://patch.msgid.link/20260506105218.2d027cc0@fedora
>
> - Use "(inclusive)" instead of adding '[' ']' around "end". (Alice Ryhl)
>
> - Add "from [first, last]" in the short description. (Liam Howlett)
>
> lib/maple_tree.c | 7 +++++--
> 1 file changed, 5 insertions(+), 2 deletions(-)
>
> diff --git a/lib/maple_tree.c b/lib/maple_tree.c
> index d18d7ed9ab67..7f6c9b729a1a 100644
> --- a/lib/maple_tree.c
> +++ b/lib/maple_tree.c
> @@ -5727,13 +5727,16 @@ int mtree_store(struct maple_tree *mt, unsigned long index, void *entry,
> EXPORT_SYMBOL(mtree_store);
>
> /**
> - * mtree_insert_range() - Insert an entry at a given range if there is no value.
> + * mtree_insert_range() - Insert an entry from [first, last] at a given range
> + * if there is no value.
It feels "at a given range" bit repetitive to me. s/at a given range// ?
Thanks,
SJ
[...]
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH v2] maple_tree: document that "last" in mtree_insert_range() is inclusive
2026-05-14 1:42 ` SeongJae Park
@ 2026-05-14 14:07 ` Steven Rostedt
2026-05-14 14:23 ` SeongJae Park
0 siblings, 1 reply; 5+ messages in thread
From: Steven Rostedt @ 2026-05-14 14:07 UTC (permalink / raw)
To: SeongJae Park
Cc: Liam R. Howlett, LKML, linux-mm, Alice Ryhl, Andrew Ballance,
maple-tree, Andrew Morton, Matthew Wilcox
On Wed, 13 May 2026 18:42:04 -0700
SeongJae Park <sj@kernel.org> wrote:
> > /**
> > - * mtree_insert_range() - Insert an entry at a given range if there is no value.
> > + * mtree_insert_range() - Insert an entry from [first, last] at a given range
> > + * if there is no value.
>
> It feels "at a given range" bit repetitive to me. s/at a given range// ?
>
I just added what Liam suggested. Should I send a v3?
-- Steve
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH v2] maple_tree: document that "last" in mtree_insert_range() is inclusive
2026-05-14 14:07 ` Steven Rostedt
@ 2026-05-14 14:23 ` SeongJae Park
0 siblings, 0 replies; 5+ messages in thread
From: SeongJae Park @ 2026-05-14 14:23 UTC (permalink / raw)
To: Steven Rostedt
Cc: SeongJae Park, Liam R. Howlett, LKML, linux-mm, Alice Ryhl,
Andrew Ballance, maple-tree, Andrew Morton, Matthew Wilcox
On Thu, 14 May 2026 10:07:23 -0400 Steven Rostedt <rostedt@kernel.org> wrote:
> On Wed, 13 May 2026 18:42:04 -0700
> SeongJae Park <sj@kernel.org> wrote:
>
> > > /**
> > > - * mtree_insert_range() - Insert an entry at a given range if there is no value.
> > > + * mtree_insert_range() - Insert an entry from [first, last] at a given range
> > > + * if there is no value.
> >
> > It feels "at a given range" bit repetitive to me. s/at a given range// ?
> >
>
> I just added what Liam suggested.
Liam's suggestion was very sligtly different.
: Something like this:
:
: mtree_insert_range() - Insert an entry from [first, last] if there isn't
: an entry within that range.
So I assumed you intentionally reworded it, but might forgot erasing 'at a
given range'. English is never my mother tongue language, but Geminit also
told me dropping 'at a given range' makes it bit easier to read. Hence I just
wanted to check if this is intentional.
> Should I send a v3?
The current wording works for me. English is never my mother tongue langauage,
so I cannot judge. I just wanted to make sure this is the intended change. So
I will leave the decision to you and others.
If we decide to rewording, I think Andrew could help without asking you to
resned v3 for such a minor change.
Thanks,
SJ
[...]
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2026-05-14 14:23 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-05-12 21:56 [PATCH v2] maple_tree: document that "last" in mtree_insert_range() is inclusive Steven Rostedt
2026-05-13 0:40 ` Liam R. Howlett
2026-05-14 1:42 ` SeongJae Park
2026-05-14 14:07 ` Steven Rostedt
2026-05-14 14:23 ` SeongJae Park
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox