Re: [PATCH v1 04/16] mm/memory: simplify calculation in unmap_mapping_range_tree()

David Hildenbrand (Arm)
2026-03-11T08:09:59Z

>
>> - start = ((zba - vba) << PAGE_SHIFT) + vma->vm_start;
>> - size = (zea - zba + 1) << PAGE_SHIFT;
>> + const pgoff_t start_idx = max(first_index, vma->vm_pgoff);
>> + const pgoff_t end_idx = min(last_index, vma_last_pgoff(vma)) + 1;
>
> I guess since 'end' is by-convention the +1 of last this is fine

Exactly, the calculation itself is not changed.

The +1 was previously hiding inside the "(zea - zba + 1)"

Thanks!

--
Cheers,

David