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>
---
Changes from v1:
- Add page count failure stats when failed to freeze the page count.
---
mm/migrate.c | 9 +++++----
1 file changed, 5 insertions(+), 4 deletions(-)
diff --git a/mm/migrate.c b/mm/migrate.c
index 1ce6cf4..1128642c 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,11 +487,13 @@ 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;
}
if (!page_ref_freeze(page, expected_count)) {
xa_unlock_irq(&mapping->i_pages);
+ count_vm_events(PGMIGRATE_REFCOUNT_FAIL, hpage_nr_pages(page));
return -EAGAIN;
}
--
1.8.3.1