From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id A08CF2F8E82 for ; Sat, 9 May 2026 00:59:56 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1778288396; cv=none; b=vBoxjnwGR7b5xjIGnGvSF8r66Ab3/zF/cIlfVJrAozSK4czmwCEuMXXn2bl9j6JbJmM6FXvCTWTW00FA8MyB7TarwPyAz/vcnNwcQJOTdN6WyAdxbwde5Sz5lq8Qacxqvngm+crA6e7usyfNAIxP6tSYHfTmV+Bo88NMhsuX4c4= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1778288396; c=relaxed/simple; bh=yjiFUK+n//LLFgj6TBHhXK7CdomWPvW+obF90AU1dhQ=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=Nw/qUFbg1v7pyDct7MAW9pLakYRjV4zygoysJI/T18wPwVB+YeSF6mC1RSl+RA+KLu5T9HLaA3y/AjatSZGlNd32Y156+fDfeZZA85O/L9YSyAVYNXIBD1G20fdhwCLs0zgeTCOR4/5eVASA3t4S9zRRDZKFCffy68xwTZxSrAQ= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=N2gUWm2L; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="N2gUWm2L" Received: by smtp.kernel.org (Postfix) with ESMTPSA id E4ABCC2BCB0; Sat, 9 May 2026 00:59:55 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1778288396; bh=yjiFUK+n//LLFgj6TBHhXK7CdomWPvW+obF90AU1dhQ=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=N2gUWm2L9CLQRjAIk645TDmEFUXJRgZgVjTW7tZGi3+hadFP0TC+L20XOIhf17WoA l6myHQhkHNW4fbmZBZh8WdDLUOJdaslYfXQkVFrrZg8b4ug2SHr2KVNdRvpzKRplCt 8TKT8o1NlM6d4bAtqCjWG0cTHTFCbHILs+NWgaCY5Ma+dzlGoWOaIsRo+DXBjWALKe YRH4F6ozZlbYDffMBPkk3cr+H6gGOJDsTc7VBynl1eEjN6/JZhaSkAUpmjEFptDUym f3wVQIMVU7TLtyiHDFQDd5OVeJJdW38HXBQwoXGvtwj37X5F4PtFQYB9zMZcKvUVb0 1a4CwcdGUBWEg== From: SeongJae Park To: "Liam R. Howlett" Cc: SeongJae Park , Alice Ryhl , Steven Rostedt , LKML , linux-mm@kvack.org, Andrew Ballance , maple-tree@lists.infradead.org, Andrew Morton , Matthew Wilcox Subject: Re: [PATCH] maple_tree: document that "last" in mtree_insert_range() is inclusive Date: Fri, 8 May 2026 17:59:46 -0700 Message-ID: <20260509005947.84550-1-sj@kernel.org> X-Mailer: git-send-email 2.47.3 In-Reply-To: References: Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit On Fri, 8 May 2026 22:51:51 +0200 "Liam R. Howlett" wrote: > On 26/05/07 06:44AM, Alice Ryhl wrote: > > On Wed, May 06, 2026 at 10:52:18AM -0400, Steven Rostedt wrote: > > > From: Steven Rostedt > > > > > > 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, and add '[' and ']' around the word "end" to > > > also stress this point. > > > > > > Signed-off-by: Steven Rostedt > > > > Reviewed-by: Alice Ryhl > > > > > lib/maple_tree.c | 4 +++- > > > 1 file changed, 3 insertions(+), 1 deletion(-) > > > > > > diff --git a/lib/maple_tree.c b/lib/maple_tree.c > > > index 60ae5e6fc1ee..dc9591218446 100644 > > > --- a/lib/maple_tree.c > > > +++ b/lib/maple_tree.c > > > @@ -5730,10 +5730,12 @@ EXPORT_SYMBOL(mtree_store); > > > * mtree_insert_range() - Insert an entry 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 > > > * @entry: The entry to store > > > * @gfp: The GFP_FLAGS to use for allocations. > > > * > > > + * Note that @last is inclusive. That is, @last = @first + length - 1; > > > > How about writing it like this? > > > > * @first: The start of the range > > * @last: The end of the range (inclusive) > > > I like this. +1. I'm also wondering if it make sense to add '(inclusive)' for 'first', too. > > I think the range should be identified in the initial statement. > Something like this: > > mtree_insert_range() - Insert an entry from [first, last] if there isn't > an entry within that range. +1. Thanks, SJ [...]