提交 937a94c9 编写于 作者: J Jacobo Giralt 提交者: Linus Torvalds

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: NJacobo 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: NAndrew Morton <akpm@linux-foundation.org>
Signed-off-by: NLinus Torvalds <torvalds@linux-foundation.org>
上级 90a5d5af
...@@ -269,12 +269,12 @@ static int migrate_page_move_mapping(struct address_space *mapping, ...@@ -269,12 +269,12 @@ static int migrate_page_move_mapping(struct address_space *mapping,
radix_tree_replace_slot(pslot, newpage); 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. * 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 * If moved to a different zone then also account
...@@ -334,9 +334,7 @@ int migrate_huge_page_move_mapping(struct address_space *mapping, ...@@ -334,9 +334,7 @@ int migrate_huge_page_move_mapping(struct address_space *mapping,
radix_tree_replace_slot(pslot, newpage); radix_tree_replace_slot(pslot, newpage);
page_unfreeze_refs(page, expected_count); page_unfreeze_refs(page, expected_count - 1);
__put_page(page);
spin_unlock_irq(&mapping->tree_lock); spin_unlock_irq(&mapping->tree_lock);
return 0; return 0;
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册