summaryrefslogtreecommitdiffstats
path: root/mm/migrate.c
diff options
context:
space:
mode:
authorJacobo Giralt <jacobo.giralt@gmail.com>2012-01-11 00:07:11 +0100
committerLinus Torvalds <torvalds@linux-foundation.org>2012-01-11 01:30:41 +0100
commit937a94c9db30a818baa5e2c09dbf4589251355c3 (patch)
treec038d9689edf1f03467227959f66c3ef750a9572 /mm/migrate.c
parentmm-tracepoint: fix documentation and examples (diff)
downloadlinux-937a94c9db30a818baa5e2c09dbf4589251355c3.tar.xz
linux-937a94c9db30a818baa5e2c09dbf4589251355c3.zip
mm: migrate: one less atomic operation
migrate_page_move_mapping() drops a reference from the old page after unfreezing its counter. Both operations can be merged into a single atomic operation by directly unfreezing to one less reference. The same applies to migrate_huge_page_move_mapping(). Signed-off-by: Jacobo Giralt <jacobo.giralt@gmail.com> Cc: Mel Gorman <mel@csn.ul.ie> Cc: Minchan Kim <minchan.kim@gmail.com> Cc: Johannes Weiner <jweiner@redhat.com> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to '')
-rw-r--r--mm/migrate.c10
1 files changed, 4 insertions, 6 deletions
diff --git a/mm/migrate.c b/mm/migrate.c
index 177aca424a06..594dc375d0f9 100644
--- a/mm/migrate.c
+++ b/mm/migrate.c
@@ -269,12 +269,12 @@ static int migrate_page_move_mapping(struct address_space *mapping,
radix_tree_replace_slot(pslot, newpage);
- page_unfreeze_refs(page, expected_count);
/*
- * Drop cache reference from old page.
+ * Drop cache reference from old page by unfreezing
+ * to one less reference.
* We know this isn't the last reference.
*/
- __put_page(page);
+ page_unfreeze_refs(page, expected_count - 1);
/*
* If moved to a different zone then also account
@@ -334,9 +334,7 @@ int migrate_huge_page_move_mapping(struct address_space *mapping,
radix_tree_replace_slot(pslot, newpage);
- page_unfreeze_refs(page, expected_count);
-
- __put_page(page);
+ page_unfreeze_refs(page, expected_count - 1);
spin_unlock_irq(&mapping->tree_lock);
return 0;