Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

tools/vm/page-types: remove dependency on opt_file for idle page tracking

Idle page tracking can also be used for process address space, not only
file mappings.

Without this change, using with '-i' option for process address space
encounters below errors reported.

$ sudo ./page-types -p $(pidof bash) -i
mark page idle: Bad file descriptor
mark page idle: Bad file descriptor
mark page idle: Bad file descriptor
mark page idle: Bad file descriptor
...

Link: https://lkml.kernel.org/r/20210917032826.10669-1-changbin.du@gmail.com
Signed-off-by: Changbin Du <changbin.du@gmail.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>

authored by

Changbin Du and committed by
Linus Torvalds
ebaeab2f d09c3872

+1 -1
+1 -1
tools/vm/page-types.c
··· 1331 1331 if (opt_list && opt_list_mapcnt) 1332 1332 kpagecount_fd = checked_open(PROC_KPAGECOUNT, O_RDONLY); 1333 1333 1334 - if (opt_mark_idle && opt_file) 1334 + if (opt_mark_idle) 1335 1335 page_idle_fd = checked_open(SYS_KERNEL_MM_PAGE_IDLE, O_RDWR); 1336 1336 1337 1337 if (opt_list && opt_pid)