tools/vm/page-types: remove dependency on opt_file for idle page tracking
authorChangbin Du <changbin.du@gmail.com>
Fri, 24 Sep 2021 22:43:41 +0000 (15:43 -0700)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Sat, 9 Oct 2021 12:40:57 +0000 (14:40 +0200)
[ Upstream commit ebaeab2fe87987cef28eb5ab174c42cd28594387 ]

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>
Signed-off-by: Sasha Levin <sashal@kernel.org>
tools/vm/page-types.c

index 0517c74..f62f10c 100644 (file)
@@ -1331,7 +1331,7 @@ int main(int argc, char *argv[])
        if (opt_list && opt_list_mapcnt)
                kpagecount_fd = checked_open(PROC_KPAGECOUNT, O_RDONLY);
 
-       if (opt_mark_idle && opt_file)
+       if (opt_mark_idle)
                page_idle_fd = checked_open(SYS_KERNEL_MM_PAGE_IDLE, O_RDWR);
 
        if (opt_list && opt_pid)