mm/hugetlb: filter out hugetlb pages if HUGEPAGE migration is not supported.
Subsystems (3)
PATCH 1/1 mm/hugetlb: filter out hugetlb pages if HUGEPAGE migration is not supported.
When scanning for movable pages, filter out Hugetlb pages if hugepage migration is not supported. Without this we hit infinte loop in __offline pages where we do
pfn = scan_movable_pages(start_pfn, end_pfn);
if (pfn) { /* We have movable pages */
ret = do_migrate_range(pfn, end_pfn);
goto repeat;
}We do support hugetlb migration ony if the hugetlb pages are at pmd level. Here we just check for Kernel config. The gigantic page size check is done in page_huge_active.
--- mm/memory_hotplug.c | 3 ++- mm/page_alloc.c | 4 ++++ 2 files changed, 6 insertions(+), 1 deletion(-)
mm/memory_hotplug.c +2 -1
@@ -1333,7 +1333,8 @@ static unsigned long scan_movable_pages(unsigned long start, unsigned long end)if (__PageMovable (page))return pfn;if (PageHuge (page)) { -if (page_huge_active (page)) +if (hugepage_migration_supported (page_hstate (page)) && +page_huge_active (page))return pfn;else pfn = round_up(pfn + 1,
mm/page_alloc.c +4 -0
@@ -7709,6 +7709,10 @@ bool has_unmovable_pages(struct zone *zone, struct page *page, int count,* handle each tail page individually in migration. */ if (PageHuge (page)) { + +if (!hugepage_migration_supported (page_hstate (page))) + goto unmovable; + iter =round_up (iter +1 ,1 <<compound_order (page)) -1 ;continue ; }
Signature · 1 line
2.17.1
Quoted 9 lines · Aneesh Kumar K.V
When scanning for movable pages, filter out Hugetlb pages if hugepage migration is not supported. Without this we hit infinte loop in
__offlinepages where we dopfn = scan_movable_pages(start_pfn, end_pfn); if (pfn) { /* We have movable pages */ ret = do_migrate_range(pfn, end_pfn); goto repeat; }
Quoted 3 lines
We do support hugetlb migration ony if the hugetlb pages are at pmd level. Here we just check for Kernel config. The gigantic page size check is done in
page_huge_active.
Well, this is a bit misleading. I would say that
Fix this by checking hugepage_migration_supported both in has_unmovable_pages which is the primary backoff mechanism for page offlining and for consistency reasons also into scan_movable_pages because it doesn't make any sense to return a pfn to non-migrateable huge page.
Quoted 4 lines
Acked-by Michal Hocko <[email protected]>Reported-by Haren Myneni <[email protected]>CC Naoya Horiguchi <[email protected]>Signed-off-by Aneesh Kumar K.V <[email protected]>
I would add
Not because the bug has been introduced by that commit but rather because the issue would be latent before that commit.
My Acked-by still holds.
Quoted 36 lines
--- mm/memory_hotplug.c | 3 ++- mm/page_alloc.c | 4 ++++ 2 files changed, 6 insertions(+), 1 deletion(-)mm/memory_hotplug.c +2
-1@@ -1333,7 +1333,8 @@ static unsigned long scan_movable_pages(unsigned long start, unsigned long end)if (__PageMovable (page))return pfn;if (PageHuge (page)) { -if (page_huge_active (page)) +if (hugepage_migration_supported (page_hstate (page)) && +page_huge_active (page))return pfn;else pfn = round_up(pfn + 1,mm/page_alloc.c +4
-0@@ -7709,6 +7709,10 @@ bool has_unmovable_pages(struct zone *zone, struct page *page, int count,* handle each tail page individually in migration. */ if (PageHuge (page)) { + +if (!hugepage_migration_supported (page_hstate (page))) + goto unmovable; + iter =round_up (iter +1 ,1 <<compound_order (page)) -1 ;continue ; }Signature · 1 line
2.17.1
Signature · 2 lines
Michal Hocko SUSE Labs
Naoya Horiguchi
Reviewed-byQuoted 26 lines · Michal Hocko
Quoted 9 lines · Aneesh Kumar K.V
When scanning for movable pages, filter out Hugetlb pages if hugepage migration is not supported. Without this we hit infinte loop in
__offlinepages where we dopfn = scan_movable_pages(start_pfn, end_pfn); if (pfn) { /* We have movable pages */ ret = do_migrate_range(pfn, end_pfn); goto repeat; }Quoted 3 lines
We do support hugetlb migration ony if the hugetlb pages are at pmd level. Here we just check for Kernel config. The gigantic page size check is done in
page_huge_active.Well, this is a bit misleading. I would say that
Fix this by checking
hugepage_migration_supportedboth inhas_unmovable_pageswhich is the primary backoff mechanism for page offlining and for consistency reasons also intoscan_movable_pagesbecause it doesn't make any sense to return a pfn to non-migrateable huge page.Quoted 4 lines
Acked-by Michal Hocko <[email protected]>Reported-by Haren Myneni <[email protected]>CC Naoya Horiguchi <[email protected]>Signed-off-by Aneesh Kumar K.V <[email protected]>
Quoted 7 lines
I would add
Fixes 72b39cfc4d75 ("mm, memory_hotplug: do not fail offlining too early")Not because the bug has been introduced by that commit but rather because the issue would be latent before that commit.
My Acked-by still holds.
Looks good to me (with Michal's update on description).
Quoted 42 lines
Quoted 37 lines
--- mm/memory_hotplug.c | 3 ++- mm/page_alloc.c | 4 ++++ 2 files changed, 6 insertions(+), 1 deletion(-)mm/memory_hotplug.c +2
-1@@ -1333,7 +1333,8 @@ static unsigned long scan_movable_pages(unsigned long start, unsigned long end)if (__PageMovable (page))return pfn;if (PageHuge (page)) { -if (page_huge_active (page)) +if (hugepage_migration_supported (page_hstate (page)) && +page_huge_active (page))return pfn;else pfn = round_up(pfn + 1,mm/page_alloc.c +4
-0@@ -7709,6 +7709,10 @@ bool has_unmovable_pages(struct zone *zone, struct page *page, int count,* handle each tail page individually in migration. */ if (PageHuge (page)) { + +if (!hugepage_migration_supported (page_hstate (page))) + goto unmovable; + iter =round_up (iter +1 ,1 <<compound_order (page)) -1 ;continue ; }Signature · 1 line
2.17.1Signature · 2 lines
Michal Hocko SUSE Labs