Re: [PATCH v24 2/5] fs/proc/task_mmu: Implement IOCTL to get and optionally clear info about PTEs
From: Andrei Vagin
Date: Tue Jul 11 2023 - 15:43:02 EST
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?
> + }
> +
> + if (IS_PM_SCAN_WP(p->flags) &&
> + uffd_wp_range(vma, addr, end - addr, true) < 0)
> + ret = -EINVAL;
> +
> + return ret;
> +}
Thanks,
Andrei