ANBZ: #80
Move the page refcount failure statistics to the correct place, since
the file pages also need consider mapping and PagePrivate setting.
Signed-off-by: Baolin Wang <baolin.wang(a)linux.alibaba.com>
---
mm/migrate.c | 8 ++++----
1 file changed, 4 insertions(+), 4 deletions(-)
diff --git a/mm/migrate.c b/mm/migrate.c
index 1ce6cf4..99dc52e 100644
--- a/mm/migrate.c
+++ b/mm/migrate.c
@@ -458,13 +458,12 @@ int migrate_page_move_mapping(struct address_space *mapping,
expected_count += is_device_private_page(page);
expected_count += is_device_public_page(page);
- if (page_count(page) != expected_count)
- count_vm_events(PGMIGRATE_REFCOUNT_FAIL, hpage_nr_pages(page));
-
if (!mapping) {
/* Anonymous page without mapping */
- if (page_count(page) != expected_count)
+ if (page_count(page) != expected_count) {
+ count_vm_events(PGMIGRATE_REFCOUNT_FAIL, hpage_nr_pages(page));
return -EAGAIN;
+ }
/* No turning back from here */
newpage->index = page->index;
@@ -488,6 +487,7 @@ int migrate_page_move_mapping(struct address_space *mapping,
radix_tree_deref_slot_protected(pslot,
&mapping->i_pages.xa_lock) != page) {
xa_unlock_irq(&mapping->i_pages);
+ count_vm_events(PGMIGRATE_REFCOUNT_FAIL, hpage_nr_pages(page));
return -EAGAIN;
}
--
1.8.3.1