From: Jacobo Giralt Date: Wed, 16 Nov 2011 23:41:25 +0000 (+1100) Subject: mm: migrate: one less atomic operation X-Git-Tag: next-20111118~1^2~69 X-Git-Url: https://git.karo-electronics.de/?a=commitdiff_plain;h=13d4cba7b2819346dec26588693fa59ffdecb6c2;p=karo-tx-linux.git 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 Cc: Mel Gorman Cc: Minchan Kim Cc: Johannes Weiner Signed-off-by: Andrew Morton --- diff --git a/mm/migrate.c b/mm/migrate.c index 578e29174fa6..1d3c578992b1 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;