@@ -1997,32 +1997,20 @@ static struct page *alloc_misplaced_dst_page(struct page *page,
1997
1997
unsigned long data )
1998
1998
{
1999
1999
int nid = (int ) data ;
2000
- struct page * newpage ;
2001
-
2002
- newpage = __alloc_pages_node (nid ,
2003
- (GFP_HIGHUSER_MOVABLE |
2004
- __GFP_THISNODE | __GFP_NOMEMALLOC |
2005
- __GFP_NORETRY | __GFP_NOWARN ) &
2006
- ~__GFP_RECLAIM , 0 );
2007
-
2008
- return newpage ;
2009
- }
2010
-
2011
- static struct page * alloc_misplaced_dst_page_thp (struct page * page ,
2012
- unsigned long data )
2013
- {
2014
- int nid = (int ) data ;
2015
- struct page * newpage ;
2016
-
2017
- newpage = alloc_pages_node (nid , (GFP_TRANSHUGE_LIGHT | __GFP_THISNODE ),
2018
- HPAGE_PMD_ORDER );
2019
- if (!newpage )
2020
- goto out ;
2021
-
2022
- prep_transhuge_page (newpage );
2000
+ int order = compound_order (page );
2001
+ gfp_t gfp = __GFP_THISNODE ;
2002
+ struct folio * new ;
2003
+
2004
+ if (order > 0 )
2005
+ gfp |= GFP_TRANSHUGE_LIGHT ;
2006
+ else {
2007
+ gfp |= GFP_HIGHUSER_MOVABLE | __GFP_NOMEMALLOC | __GFP_NORETRY |
2008
+ __GFP_NOWARN ;
2009
+ gfp &= ~__GFP_RECLAIM ;
2010
+ }
2011
+ new = __folio_alloc_node (gfp , order , nid );
2023
2012
2024
- out :
2025
- return newpage ;
2013
+ return & new -> page ;
2026
2014
}
2027
2015
2028
2016
static int numamigrate_isolate_page (pg_data_t * pgdat , struct page * page )
@@ -2080,22 +2068,8 @@ int migrate_misplaced_page(struct page *page, struct vm_area_struct *vma,
2080
2068
int nr_remaining ;
2081
2069
unsigned int nr_succeeded ;
2082
2070
LIST_HEAD (migratepages );
2083
- new_page_t * new ;
2084
- bool compound ;
2085
2071
int nr_pages = thp_nr_pages (page );
2086
2072
2087
- /*
2088
- * PTE mapped THP or HugeTLB page can't reach here so the page could
2089
- * be either base page or THP. And it must be head page if it is
2090
- * THP.
2091
- */
2092
- compound = PageTransHuge (page );
2093
-
2094
- if (compound )
2095
- new = alloc_misplaced_dst_page_thp ;
2096
- else
2097
- new = alloc_misplaced_dst_page ;
2098
-
2099
2073
/*
2100
2074
* Don't migrate file pages that are mapped in multiple processes
2101
2075
* with execute permissions as they are probably shared libraries.
@@ -2116,9 +2090,9 @@ int migrate_misplaced_page(struct page *page, struct vm_area_struct *vma,
2116
2090
goto out ;
2117
2091
2118
2092
list_add (& page -> lru , & migratepages );
2119
- nr_remaining = migrate_pages (& migratepages , * new , NULL , node ,
2120
- MIGRATE_ASYNC , MR_NUMA_MISPLACED ,
2121
- & nr_succeeded );
2093
+ nr_remaining = migrate_pages (& migratepages , alloc_misplaced_dst_page ,
2094
+ NULL , node , MIGRATE_ASYNC ,
2095
+ MR_NUMA_MISPLACED , & nr_succeeded );
2122
2096
if (nr_remaining ) {
2123
2097
if (!list_empty (& migratepages )) {
2124
2098
list_del (& page -> lru );
0 commit comments