linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] use find_trylock_page in free_swap_and_cache instead of hand coding
@ 2004-10-15 10:45 Marcelo Tosatti
  2004-10-15 13:20 ` Hugh Dickins
  0 siblings, 1 reply; 5+ messages in thread
From: Marcelo Tosatti @ 2004-10-15 10:45 UTC (permalink / raw)
  To: linux-mm, akpm; +Cc: hugh

Hi,

This small cleanup to free_swap_and_cache() substitues a 
"lock - radix lookup - TestSetPageLocked - unlock" sequence
of instructions with "find_trylock_page()" (which does 
exactly that).

Please apply

--- rc4-mm1.orig/mm/swapfile.c	2004-10-15 01:03:11.000000000 -0300
+++ rc4-mm1/mm/swapfile.c	2004-10-15 09:24:05.696640488 -0300
@@ -391,14 +391,8 @@ void free_swap_and_cache(swp_entry_t ent
 
 	p = swap_info_get(entry);
 	if (p) {
-		if (swap_entry_free(p, swp_offset(entry)) == 1) {
-			read_lock_irq(&swapper_space.tree_lock);
-			page = radix_tree_lookup(&swapper_space.page_tree,
-				entry.val);
-			if (page && TestSetPageLocked(page))
-				page = NULL;
-			read_unlock_irq(&swapper_space.tree_lock);
-		}
+		if (swap_entry_free(p, swp_offset(entry)) == 1) 
+			page = find_trylock_page(&swapper_space, entry.val);
 		swap_info_put(p);
 	}
 	if (page) {
--
To unsubscribe, send a message with 'unsubscribe linux-mm' in
the body to majordomo@kvack.org.  For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"aart@kvack.org"> aart@kvack.org </a>

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

end of thread, other threads:[~2004-10-15 21:54 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2004-10-15 10:45 [PATCH] use find_trylock_page in free_swap_and_cache instead of hand coding Marcelo Tosatti
2004-10-15 13:20 ` Hugh Dickins
2004-10-15 18:35   ` Marcelo Tosatti
2004-10-15 21:54     ` Hugh Dickins
2004-10-15 21:09       ` Marcelo Tosatti

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