mm: migrate: One less atomic operation
PATCH 1/1 mm: migrate: One less atomic operation
I think I used an old e-mail address for Nick (got it from git blame), I'm changing it now, sorry for the noise!
Regards,
Jacobo Giralt.
2011/11/5 Jacobo Giralt <[email protected]>:
Quoted 54 lines
From
3754c8617ef4377ce2ca2e3b28bdc28f8de1aa0dMon Sep 17 00:00:00 2001
From: Jacobo Giralt <[email protected]>
Date: Sat, 5 Nov 2011 13:12:50 +0100
Subject: [PATCH] mm: migrate: One less atomic operation
migrate_page_move_mappingdrops 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 <[email protected]>---
mm/migrate.c | 10 ++++------1 files changed, 4 insertions(+), 6 deletions(-)mm/migrate.c +4
-7@@ -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; --1.7.5.4
Andrew Morton
maintainerQuoted 5 lines · On Sat, 05 Nov 2011 15:38:17 +0100 Jacobo Giralt <[email protected]>…
Quoted 1 line
From
3754c8617ef4377ce2ca2e3b28bdc28f8de1aa0dMon Sep 17 00:00:00 2001From: Jacobo Giralt <[email protected]>
Date: Sat, 5 Nov 2011 13:12:50 +0100
Subject: [PATCH] mm: migrate: One less atomic operation
Quoted 7 lines
migrate_page_move_mappingdrops 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.
Fair enough.
urgh, you made me look at stuff :(
page_unfreeze_refs() and set_page_refcounted() are fishily similar.
page_unfreeze_refs() should use set_page_count().
set_page_count() is defined in the wrong file.
set_page_refcounted() should use page_count().
iow, a bit of a mess.