]> git.proxmox.com Git - mirror_ubuntu-kernels.git/commitdiff
mm/page_idle.c: skip offline pages
authorSeongJae Park <sjpark@amazon.de>
Mon, 8 Jun 2020 04:40:04 +0000 (21:40 -0700)
committerLinus Torvalds <torvalds@linux-foundation.org>
Mon, 8 Jun 2020 18:05:55 +0000 (11:05 -0700)
'Idle page tracking' users can pass random pfn that might be mapped to an
offline page.  To avoid accessing such pages, this commit modifies the
'page_idle_get_page()' to use 'pfn_to_online_page()' instead of
'pfn_valid()' and 'pfn_to_page()' combination, so that the pfn mapped to
an offline page can be skipped.

Reported-by: David Hildenbrand <david@redhat.com>
Signed-off-by: SeongJae Park <sjpark@amazon.de>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Reviewed-by: David Hildenbrand <david@redhat.com>
Reviewed-by: Pankaj Gupta <pankaj.gupta.linux@gmail.com>
Link: http://lkml.kernel.org/r/20200605092502.18018-2-sjpark@amazon.com
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
mm/page_idle.c

index 295512465065967edddd4d2f3700dec6b38e441e..057c61df12dba277af673ee2c5e68ab6232fa9a6 100644 (file)
@@ -4,6 +4,7 @@
 #include <linux/fs.h>
 #include <linux/sysfs.h>
 #include <linux/kobject.h>
+#include <linux/memory_hotplug.h>
 #include <linux/mm.h>
 #include <linux/mmzone.h>
 #include <linux/pagemap.h>
  */
 static struct page *page_idle_get_page(unsigned long pfn)
 {
-       struct page *page;
+       struct page *page = pfn_to_online_page(pfn);
        pg_data_t *pgdat;
 
-       if (!pfn_valid(pfn))
-               return NULL;
-
-       page = pfn_to_page(pfn);
        if (!page || !PageLRU(page) ||
            !get_page_unless_zero(page))
                return NULL;