@@ -185,8 +185,8 @@ void putback_movable_pages(struct list_head *l)
185
185
unlock_page (page );
186
186
put_page (page );
187
187
} else {
188
- dec_node_page_state ( page , NR_ISOLATED_ANON +
189
- page_is_file_cache (page ));
188
+ mod_node_page_state ( page_pgdat ( page ) , NR_ISOLATED_ANON +
189
+ page_is_file_cache (page ), - hpage_nr_pages ( page ) );
190
190
putback_lru_page (page );
191
191
}
192
192
}
@@ -1146,8 +1146,8 @@ static ICE_noinline int unmap_and_move(new_page_t get_new_page,
1146
1146
* as __PageMovable
1147
1147
*/
1148
1148
if (likely (!__PageMovable (page )))
1149
- dec_node_page_state ( page , NR_ISOLATED_ANON +
1150
- page_is_file_cache (page ));
1149
+ mod_node_page_state ( page_pgdat ( page ) , NR_ISOLATED_ANON +
1150
+ page_is_file_cache (page ), - hpage_nr_pages ( page ) );
1151
1151
}
1152
1152
1153
1153
/*
@@ -1421,7 +1421,17 @@ static struct page *new_page_node(struct page *p, unsigned long private,
1421
1421
if (PageHuge (p ))
1422
1422
return alloc_huge_page_node (page_hstate (compound_head (p )),
1423
1423
pm -> node );
1424
- else
1424
+ else if (thp_migration_supported () && PageTransHuge (p )) {
1425
+ struct page * thp ;
1426
+
1427
+ thp = alloc_pages_node (pm -> node ,
1428
+ (GFP_TRANSHUGE | __GFP_THISNODE ) & ~__GFP_RECLAIM ,
1429
+ HPAGE_PMD_ORDER );
1430
+ if (!thp )
1431
+ return NULL ;
1432
+ prep_transhuge_page (thp );
1433
+ return thp ;
1434
+ } else
1425
1435
return __alloc_pages_node (pm -> node ,
1426
1436
GFP_HIGHUSER_MOVABLE | __GFP_THISNODE , 0 );
1427
1437
}
@@ -1448,15 +1458,19 @@ static int do_move_page_to_node_array(struct mm_struct *mm,
1448
1458
for (pp = pm ; pp -> node != MAX_NUMNODES ; pp ++ ) {
1449
1459
struct vm_area_struct * vma ;
1450
1460
struct page * page ;
1461
+ struct page * head ;
1462
+ unsigned int follflags ;
1451
1463
1452
1464
err = - EFAULT ;
1453
1465
vma = find_vma (mm , pp -> addr );
1454
1466
if (!vma || pp -> addr < vma -> vm_start || !vma_migratable (vma ))
1455
1467
goto set_status ;
1456
1468
1457
1469
/* FOLL_DUMP to ignore special (like zero) pages */
1458
- page = follow_page (vma , pp -> addr ,
1459
- FOLL_GET | FOLL_SPLIT | FOLL_DUMP );
1470
+ follflags = FOLL_GET | FOLL_DUMP ;
1471
+ if (!thp_migration_supported ())
1472
+ follflags |= FOLL_SPLIT ;
1473
+ page = follow_page (vma , pp -> addr , follflags );
1460
1474
1461
1475
err = PTR_ERR (page );
1462
1476
if (IS_ERR (page ))
@@ -1466,7 +1480,6 @@ static int do_move_page_to_node_array(struct mm_struct *mm,
1466
1480
if (!page )
1467
1481
goto set_status ;
1468
1482
1469
- pp -> page = page ;
1470
1483
err = page_to_nid (page );
1471
1484
1472
1485
if (err == pp -> node )
@@ -1481,16 +1494,22 @@ static int do_move_page_to_node_array(struct mm_struct *mm,
1481
1494
goto put_and_set ;
1482
1495
1483
1496
if (PageHuge (page )) {
1484
- if (PageHead (page ))
1497
+ if (PageHead (page )) {
1485
1498
isolate_huge_page (page , & pagelist );
1499
+ err = 0 ;
1500
+ pp -> page = page ;
1501
+ }
1486
1502
goto put_and_set ;
1487
1503
}
1488
1504
1489
- err = isolate_lru_page (page );
1505
+ pp -> page = compound_head (page );
1506
+ head = compound_head (page );
1507
+ err = isolate_lru_page (head );
1490
1508
if (!err ) {
1491
- list_add_tail (& page -> lru , & pagelist );
1492
- inc_node_page_state (page , NR_ISOLATED_ANON +
1493
- page_is_file_cache (page ));
1509
+ list_add_tail (& head -> lru , & pagelist );
1510
+ mod_node_page_state (page_pgdat (head ),
1511
+ NR_ISOLATED_ANON + page_is_file_cache (head ),
1512
+ hpage_nr_pages (head ));
1494
1513
}
1495
1514
put_and_set :
1496
1515
/*
0 commit comments