Skip to contentSkip to conversation

revert migrate_move_mapping to use direct radix tree slot update

PATCH In review Lee Schermerhorn 2 participants 4 messages Sep 13, 2006

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 revert migrate_move_mapping to use direct radix tree slot update

Now that the problem with the rcu radix tree replace slot function has been fixed, we can, if Christoph agrees:

Revert migrate_page_move_mapping() to use direct radix tree slot replacement. Fix up variable types to match modified interfaces to radix_tree_{deref|replace}_slot().

 mm/migrate.c |   23 ++++++++++++-----------
 1 files changed, 12 insertions(+), 11 deletions(-)
mm/migrate.c +12 -11
Index: linux-2.6.18-rc6-mm2/mm/migrate.c
===================================================================
@@ -294,8 +294,7 @@ out:
 static int migrate_page_move_mapping(struct address_space *mapping,
 		struct page *newpage, struct page *page)
 {
-	struct page *current_page;
-	long index;
+	void **pslot;
 
 	if (!mapping) {
 		/* Anonymous page */
@@ -306,14 +305,11 @@ static int migrate_page_move_mapping(str
 
 	write_lock_irq(&mapping->tree_lock);
 
-	index = page_index(page);
-
-	current_page = (struct page *)radix_tree_lookup(
-						&mapping->page_tree,
-						index);
+	pslot = radix_tree_lookup_slot(&mapping->page_tree,
+ 					page_index(page));
 
 	if (page_count(page) != 2 + !!PagePrivate(page) ||
-			current_page != page) {
+			(struct page *)radix_tree_deref_slot(pslot) != page) {
 		write_unlock_irq(&mapping->tree_lock);
 		return -EAGAIN;
 	}
@@ -321,7 +317,7 @@ static int migrate_page_move_mapping(str
 	/*
 	 * Now we know that no one else is looking at the page.
 	 */
-	get_page(newpage);
+	get_page(newpage);	/* add cache reference */
 #ifdef CONFIG_SWAP
 	if (PageSwapCache(page)) {
 		SetPageSwapCache(newpage);
@@ -329,9 +325,14 @@ static int migrate_page_move_mapping(str
 	}
 #endif
 
-	radix_tree_delete(&mapping->page_tree, index);
-	radix_tree_insert(&mapping->page_tree, index, newpage);
+	radix_tree_replace_slot(pslot, newpage);
+
+	/*
+	 * Drop cache reference from old page.
+	 * We know this isn't the last reference.
+	 */
 	__put_page(page);
+
 	write_unlock_irq(&mapping->tree_lock);
 
 	return 0;

--
To unsubscribe, send a message with 'unsubscribe linux-mm' in the body to [email protected]. For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"[email protected]"> [email protected] </a>

Acked-by on v1 1/1
#1 lore raw
Quoted 2 lines · Lee Schermerhorn

Now that the problem with the rcu radix tree replace slot function has been fixed, we can, if Christoph agrees:

Instead of a new patch we could simply drop the patch

page-migration-replace-radix_tree_lookup_slot-with-radix_tree_lockup.patch

from Andrew's tree.

--
To unsubscribe, send a message with 'unsubscribe linux-mm' in the body to [email protected]. For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"[email protected]"> [email protected] </a>

#2 lore raw
Quoted 10 lines · Christoph Lameter
Quoted 2 lines · Lee Schermerhorn

Now that the problem with the rcu radix tree replace slot function has been fixed, we can, if Christoph agrees:

Instead of a new patch we could simply drop the patch

page-migration-replace-radix_tree_lookup_slot-with-radix_tree_lockup.patch

from Andrew's tree.

If you want to do it that way, I'll need to supply another patch to clean up the compiler warnings [I think they were just warnings] resulting from the change [at your suggestion ;-)] in the interface to the radix tree functions.

Lee

--
To unsubscribe, send a message with 'unsubscribe linux-mm' in the body to [email protected]. For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"[email protected]"> [email protected] </a>

#3 lore raw
Quoted 4 lines · Lee Schermerhorn

If you want to do it that way, I'll need to supply another patch to clean up the compiler warnings [I think they were just warnings] resulting from the change [at your suggestion ;-)] in the interface to the radix tree functions.

That would be nice.

--
To unsubscribe, send a message with 'unsubscribe linux-mm' in the body to [email protected]. For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"[email protected]"> [email protected] </a>