public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH] mm: migrate: One less atomic operation
@ 2011-11-05 14:38 Jacobo Giralt
  2011-11-05 14:48 ` Jacobo Giralt
  2011-11-08 22:57 ` Andrew Morton
  0 siblings, 2 replies; 3+ messages in thread
From: Jacobo Giralt @ 2011-11-05 14:38 UTC (permalink / raw)
  To: linux-mm, linux-kernel; +Cc: akpm, mgorman, minchan.kim, hughd, hannes, npiggin

>From 3754c8617ef4377ce2ca2e3b28bdc28f8de1aa0d Mon Sep 17 00:00:00 2001
From: Jacobo Giralt <jacobo.giralt@gmail.com>
Date: Sat, 5 Nov 2011 13:12:50 +0100
Subject: [PATCH] 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>
---
 mm/migrate.c |   10 ++++------
 1 files changed, 4 insertions(+), 6 deletions(-)

diff --git a/mm/migrate.c b/mm/migrate.c
index 33358f8..46d04a0 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;
-- 
1.7.5.4




^ permalink raw reply related	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2011-11-08 22:57 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2011-11-05 14:38 [PATCH] mm: migrate: One less atomic operation Jacobo Giralt
2011-11-05 14:48 ` Jacobo Giralt
2011-11-08 22:57 ` Andrew Morton

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox