On Wed, Aug 16, 2023 at 03:38:10PM +0500, Muhammad Usama Anjum wrote: > The PAGEMAP_SCAN IOCTL on the pagemap file can be used to get or optionally > clear the info about page table entries. [...] > --- a/fs/proc/task_mmu.c > +++ b/fs/proc/task_mmu.c [...] > +static long do_pagemap_scan(struct mm_struct *mm, unsigned long uarg) > +{ [...] > + for (walk_start = p.arg.start; walk_start < p.arg.end; > + walk_start = p.arg.walk_end) { [...] > + /* The walk_end isn't set when ret is zero */ > + if (!p.arg.walk_end) > + p.arg.walk_end = p.arg.end; This is now redundant with the `if` after the loop. [1] > + if (ret != -ENOSPC) > + break; > + > + if (p.arg.vec_len == 0 || p.found_pages == p.arg.max_pages) > + break; > + } > + > + /* ENOSPC signifies early stop (buffer full) from the walk. */ > + if (!ret || ret == -ENOSPC) > + ret = n_ranges_out; > + > + if (!p.arg.walk_end) > + p.arg.walk_end = p.arg.end; [1] The one above. Best Regards Michał Mirosław