Commit 937a94c9db30a818baa5e2c09dbf4589251355c3
Committed by
Linus Torvalds
1 parent
90a5d5af74
Exists in
master
and in
20 other branches
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>
Showing 1 changed file with 4 additions and 6 deletions Side-by-side Diff
mm/migrate.c
... | ... | @@ -269,12 +269,12 @@ |
269 | 269 | |
270 | 270 | radix_tree_replace_slot(pslot, newpage); |
271 | 271 | |
272 | - page_unfreeze_refs(page, expected_count); | |
273 | 272 | /* |
274 | - * Drop cache reference from old page. | |
273 | + * Drop cache reference from old page by unfreezing | |
274 | + * to one less reference. | |
275 | 275 | * We know this isn't the last reference. |
276 | 276 | */ |
277 | - __put_page(page); | |
277 | + page_unfreeze_refs(page, expected_count - 1); | |
278 | 278 | |
279 | 279 | /* |
280 | 280 | * If moved to a different zone then also account |
... | ... | @@ -334,9 +334,7 @@ |
334 | 334 | |
335 | 335 | radix_tree_replace_slot(pslot, newpage); |
336 | 336 | |
337 | - page_unfreeze_refs(page, expected_count); | |
338 | - | |
339 | - __put_page(page); | |
337 | + page_unfreeze_refs(page, expected_count - 1); | |
340 | 338 | |
341 | 339 | spin_unlock_irq(&mapping->tree_lock); |
342 | 340 | return 0; |