aboutsummaryrefslogtreecommitdiffstats
path: root/mm
diff options
context:
space:
mode:
authorLi Xinhai <lixinhai.lxh@gmail.com>2020-10-13 16:55:39 -0700
committerLinus Torvalds <torvalds@linux-foundation.org>2020-10-13 18:38:33 -0700
commit6a654e36fa51a4ae1f109b0b30a23d3f097b3d8a (patch)
treeb4938765fbf634e41ebfb6fbe4dd2fe2878fcaf8 /mm
parentmm: document semantics of ZONE_MOVABLE (diff)
downloadlinux-dev-6a654e36fa51a4ae1f109b0b30a23d3f097b3d8a.tar.xz
linux-dev-6a654e36fa51a4ae1f109b0b30a23d3f097b3d8a.zip
mm, isolation: avoid checking unmovable pages across pageblock boundary
In has_unmovable_pages(), the page parameter would not always be the first page within a pageblock (see how the page pointer is passed in from start_isolate_page_range() after call __first_valid_page()), so that would cause checking unmovable pages span two pageblocks. After this patch, the checking is enforced within one pageblock no matter the page is first one or not, and obey the semantics of this function. This issue is found by code inspection. Michal said "this might lead to false negatives when an unrelated block would cause an isolation failure". Signed-off-by: Li Xinhai <lixinhai.lxh@gmail.com> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Reviewed-by: Oscar Salvador <osalvador@suse.de> Acked-by: Michal Hocko <mhocko@suse.com> Cc: David Hildenbrand <david@redhat.com> Link: https://lkml.kernel.org/r/20200824065811.383266-1-lixinhai.lxh@gmail.com Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'mm')
-rw-r--r--mm/page_alloc.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/mm/page_alloc.c b/mm/page_alloc.c
index ff0b14b0e8d7..b9f9b51e0342 100644
--- a/mm/page_alloc.c
+++ b/mm/page_alloc.c
@@ -8234,6 +8234,7 @@ struct page *has_unmovable_pages(struct zone *zone, struct page *page,
{
unsigned long iter = 0;
unsigned long pfn = page_to_pfn(page);
+ unsigned long offset = pfn % pageblock_nr_pages;
if (is_migrate_cma_page(page)) {
/*
@@ -8247,7 +8248,7 @@ struct page *has_unmovable_pages(struct zone *zone, struct page *page,
return page;
}
- for (; iter < pageblock_nr_pages; iter++) {
+ for (; iter < pageblock_nr_pages - offset; iter++) {
if (!pfn_valid_within(pfn + iter))
continue;