[2/2] mm,memory_hotplug: Drop redundant hugepage_migration_supported check
diff mbox series

Message ID 20190304085147.556-3-osalvador@suse.de
State New
Headers show
Series
  • Unlock 1GB-hugetlb on x86_64
Related show

Commit Message

Oscar Salvador March 4, 2019, 8:51 a.m. UTC
has_unmovable_pages() does alreay check whether the hugetlb page supports
migration, so all non-migrateable hugetlb pages should have been caught there.
Let us drop the check from scan_movable_pages() as is redundant.

Signed-off-by: Oscar Salvador <osalvador@suse.de>
Acked-by: Michal Hocko <mhocko@suse.com>
---
 mm/memory_hotplug.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

Comments

David Hildenbrand March 4, 2019, 9:17 a.m. UTC | #1
On 04.03.19 09:51, Oscar Salvador wrote:
> has_unmovable_pages() does alreay check whether the hugetlb page supports
> migration, so all non-migrateable hugetlb pages should have been caught there.
> Let us drop the check from scan_movable_pages() as is redundant.
> 
> Signed-off-by: Oscar Salvador <osalvador@suse.de>
> Acked-by: Michal Hocko <mhocko@suse.com>
> ---
>  mm/memory_hotplug.c | 3 +--
>  1 file changed, 1 insertion(+), 2 deletions(-)
> 
> diff --git a/mm/memory_hotplug.c b/mm/memory_hotplug.c
> index 0f479c710615..2dfd9a0b0832 100644
> --- a/mm/memory_hotplug.c
> +++ b/mm/memory_hotplug.c
> @@ -1346,8 +1346,7 @@ static unsigned long scan_movable_pages(unsigned long start, unsigned long end)
>  		if (!PageHuge(page))
>  			continue;
>  		head = compound_head(page);
> -		if (hugepage_migration_supported(page_hstate(head)) &&
> -		    page_huge_active(head))
> +		if (page_huge_active(head))
>  			return pfn;
>  		skip = (1 << compound_order(head)) - (page - head);
>  		pfn += skip - 1;
> 

Yes, it would actually be a BUG once we reach that point and we suddenly
have !hugepage_migration_supported() in my opinion.

Reviewed-by: David Hildenbrand <david@redhat.com>

Patch
diff mbox series

diff --git a/mm/memory_hotplug.c b/mm/memory_hotplug.c
index 0f479c710615..2dfd9a0b0832 100644
--- a/mm/memory_hotplug.c
+++ b/mm/memory_hotplug.c
@@ -1346,8 +1346,7 @@  static unsigned long scan_movable_pages(unsigned long start, unsigned long end)
 		if (!PageHuge(page))
 			continue;
 		head = compound_head(page);
-		if (hugepage_migration_supported(page_hstate(head)) &&
-		    page_huge_active(head))
+		if (page_huge_active(head))
 			return pfn;
 		skip = (1 << compound_order(head)) - (page - head);
 		pfn += skip - 1;