On Tue, May 06, 2025 at 12:30:54PM -0700, Nicolin Chen wrote:

> So, if I understand it correctly, what we want to achieve is to
> have maple tree to manage all PFN ranges. And each range holds
> the same entry, a structure that we can use to verify the sanity
> of an mmap? Let's say for PFNs A->B, the tree should store the
> structure between index A and index B (inclusive)?

And tell you what has been mmap'd.

> If this is correct, mtree_alloc_range() that is given a range of
> [0, ULONG_MAX] would allocate the PFN range from the lowest index
> (i.e. 0) instead of PFN A?

mtree_alloc_range() returns a new range of PFNs that does not overlap
with any existing range. It should always be called on O->U32_MAX (for
32bit uapi compat) and it should always pick the range to use.

Jason

Reply via email to