Re: [PATCH v24 2/5] fs/proc/task_mmu: Implement IOCTL to get and optionally clear info about PTEs

From: Muhammad Usama Anjum
Date: Tue Jul 11 2023 - 23:17:53 EST


On 7/12/23 12:42 AM, Andrei Vagin wrote:
> On Tue, Jul 11, 2023 at 5:53 AM Muhammad Usama Anjum
> <usama.anjum@xxxxxxxxxxxxx> wrote:
>
> <snip>
>
>> +static int pagemap_scan_pte_hole(unsigned long addr, unsigned long end,
>> + int depth, struct mm_walk *walk)
>> +{
>> + unsigned long n_pages = (end - addr)/PAGE_SIZE;
>> + struct pagemap_scan_private *p = walk->private;
>> + struct vm_area_struct *vma = walk->vma;
>> + int ret = 0;
>> +
>> + if (!vma)
>> + return 0;
>> +
>> + if (IS_PM_SCAN_GET(p->flags)) {
>> + if (n_pages > p->max_pages - p->found_pages)
>> + n_pages = p->max_pages - p->found_pages;
>> +
>> + ret = pagemap_scan_output(PM_SCAN_FLAGS(false, false, false,
>> + false, false), p, addr, n_pages);
>
> Why do we report holes unconditionally?
It seems I've missed the filtering part for holes. It got missed and no
test/reviewer caught it earlier. I'll add it pretty quickly.

Are you satisfied with the remaining patch and can you sent reviewed/acked
by tag?

>
>> + }
>> +
>> + if (IS_PM_SCAN_WP(p->flags) &&
>> + uffd_wp_range(vma, addr, end - addr, true) < 0)
>> + ret = -EINVAL;
>> +
>> + return ret;
>> +}
>
> Thanks,
> Andrei

--
BR,
Muhammad Usama Anjum