summaryrefslogtreecommitdiffstats
path: root/mm/migrate.c
diff options
context:
space:
mode:
Diffstat (limited to 'mm/migrate.c')
-rw-r--r--mm/migrate.c14
1 files changed, 7 insertions, 7 deletions
diff --git a/mm/migrate.c b/mm/migrate.c
index 181f5d2718a9..ac6f4939bb59 100644
--- a/mm/migrate.c
+++ b/mm/migrate.c
@@ -100,7 +100,7 @@ int isolate_movable_page(struct page *page, isolate_mode_t mode)
100 /* 100 /*
101 * Check PageMovable before holding a PG_lock because page's owner 101 * Check PageMovable before holding a PG_lock because page's owner
102 * assumes anybody doesn't touch PG_lock of newly allocated page 102 * assumes anybody doesn't touch PG_lock of newly allocated page
103 * so unconditionally grapping the lock ruins page's owner side. 103 * so unconditionally grabbing the lock ruins page's owner side.
104 */ 104 */
105 if (unlikely(!__PageMovable(page))) 105 if (unlikely(!__PageMovable(page)))
106 goto out_putpage; 106 goto out_putpage;
@@ -374,7 +374,7 @@ unlock:
374} 374}
375#endif 375#endif
376 376
377static int expected_page_refs(struct page *page) 377static int expected_page_refs(struct address_space *mapping, struct page *page)
378{ 378{
379 int expected_count = 1; 379 int expected_count = 1;
380 380
@@ -384,7 +384,7 @@ static int expected_page_refs(struct page *page)
384 */ 384 */
385 expected_count += is_device_private_page(page); 385 expected_count += is_device_private_page(page);
386 expected_count += is_device_public_page(page); 386 expected_count += is_device_public_page(page);
387 if (page_mapping(page)) 387 if (mapping)
388 expected_count += hpage_nr_pages(page) + page_has_private(page); 388 expected_count += hpage_nr_pages(page) + page_has_private(page);
389 389
390 return expected_count; 390 return expected_count;
@@ -405,7 +405,7 @@ int migrate_page_move_mapping(struct address_space *mapping,
405 XA_STATE(xas, &mapping->i_pages, page_index(page)); 405 XA_STATE(xas, &mapping->i_pages, page_index(page));
406 struct zone *oldzone, *newzone; 406 struct zone *oldzone, *newzone;
407 int dirty; 407 int dirty;
408 int expected_count = expected_page_refs(page) + extra_count; 408 int expected_count = expected_page_refs(mapping, page) + extra_count;
409 409
410 if (!mapping) { 410 if (!mapping) {
411 /* Anonymous page without mapping */ 411 /* Anonymous page without mapping */
@@ -750,7 +750,7 @@ static int __buffer_migrate_page(struct address_space *mapping,
750 return migrate_page(mapping, newpage, page, mode); 750 return migrate_page(mapping, newpage, page, mode);
751 751
752 /* Check whether page does not have extra refs before we do more work */ 752 /* Check whether page does not have extra refs before we do more work */
753 expected_count = expected_page_refs(page); 753 expected_count = expected_page_refs(mapping, page);
754 if (page_count(page) != expected_count) 754 if (page_count(page) != expected_count)
755 return -EAGAIN; 755 return -EAGAIN;
756 756
@@ -911,7 +911,7 @@ static int fallback_migrate_page(struct address_space *mapping,
911 */ 911 */
912 if (page_has_private(page) && 912 if (page_has_private(page) &&
913 !try_to_release_page(page, GFP_KERNEL)) 913 !try_to_release_page(page, GFP_KERNEL))
914 return -EAGAIN; 914 return mode == MIGRATE_SYNC ? -EAGAIN : -EBUSY;
915 915
916 return migrate_page(mapping, newpage, page, mode); 916 return migrate_page(mapping, newpage, page, mode);
917} 917}
@@ -1287,7 +1287,7 @@ static int unmap_and_move_huge_page(new_page_t get_new_page,
1287 struct anon_vma *anon_vma = NULL; 1287 struct anon_vma *anon_vma = NULL;
1288 1288
1289 /* 1289 /*
1290 * Movability of hugepages depends on architectures and hugepage size. 1290 * Migratability of hugepages depends on architectures and their size.
1291 * This check is necessary because some callers of hugepage migration 1291 * This check is necessary because some callers of hugepage migration
1292 * like soft offline and memory hotremove don't walk through page 1292 * like soft offline and memory hotremove don't walk through page
1293 * tables or check whether the hugepage is pmd-based or not before 1293 * tables or check whether the hugepage is pmd-based or not before