From: SeongJae Park Date: Mon, 8 Jun 2020 04:40:04 +0000 (-0700) Subject: mm/page_idle.c: skip offline pages X-Git-Tag: v5.10.7~2398^2~51 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=92fb1db26eefc11554820f11ce8e92007da2fbf4;p=platform%2Fkernel%2Flinux-rpi.git mm/page_idle.c: skip offline pages '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 Signed-off-by: SeongJae Park Signed-off-by: Andrew Morton Reviewed-by: David Hildenbrand Reviewed-by: Pankaj Gupta Link: http://lkml.kernel.org/r/20200605092502.18018-2-sjpark@amazon.com Signed-off-by: Linus Torvalds --- diff --git a/mm/page_idle.c b/mm/page_idle.c index 2955124..057c61d 100644 --- a/mm/page_idle.c +++ b/mm/page_idle.c @@ -4,6 +4,7 @@ #include #include #include +#include #include #include #include @@ -30,13 +31,9 @@ */ 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;