Re: Radix tree range entries

From: Matthew Wilcox
Date: Wed Feb 01 2017 - 17:23:39 EST


On Wed, Feb 01, 2017 at 10:48:08AM -0800, Dan Williams wrote:
> On Tue, Jan 31, 2017 at 8:59 AM, Matthew Wilcox <willy@xxxxxxxxxxxxx> wrote:
> > We have a confirmed customer in the shape of devm_memremap_pages(), so
> > add support for range entries. The documentation lists caveats on their
> > use, but none of these caveats apply to the one user.
> >
> > Signed-off-by: Matthew Wilcox <mawilcox@xxxxxxxxxxxxx>
>
> Thanks, I'll take a look. This will let me get rid of the order_at()
> hack I have in devm_memremap_pages(). I assume there's no requirement
> that 'start' be aligned to 'len' when calling
> radix_tree_insert_range()?

No alignment restrictions. If you find something that doesn't work,
let me know. From the test suite:

+ for (start = 0; start < 100; start++) {
+ for (len = 1; len < 100; len++) {
+ range_check_1(&tree, start, len);
+ }
+ }

The only restrictions I have is that len must be >0 and start+len
can't wrap past ~0UL. These seem like reasonable restrictions to me.
Maybe we have some users who want to change the index type from unsigned
long to unsigned long long, but I think 32-bit machines are dying out
fast enough that we don't care.