Linux Headquarters
[ Register ]
[ About us ] [ Home Page ]

Advertisement
[ Kernel ] [ Documentation ] [ Links ] [ Books ]

Advertisement

Kernel v2.4.6 /mm/swap_state.c

Filename:/mm/swap_state.c
Lines Added:24
Lines Deleted:0
Also changed in: (Previous) 2.4.6-pre9  2.4.6-pre8  2.4.6-pre7  2.4.6-pre6  2.4.6-pre5  2.4.6-pre4 
(Following) 2.4.6-ac3  2.4.6-ac4  2.4.6-ac5  2.4.7-pre4  2.4.7-pre5  2.4.7-pre6 

Location
[  2.4.6
  [  mm
     o  swap_state.c

Patch

diff -u --recursive --new-file v2.4.5/linux/mm/swap_state.c linux/mm/swap_state.c
--- v2.4.5/linux/mm/swap_state.c   Thu May 24 15:20:18 2001
+++ linux/mm/swap_state.c   Mon Jun 11 19:15:27 2001
@@ -145,6 +145,30 @@
    UnlockPage(page);
 }
 
+/* 
+ * Perform a free_page(), also freeing any swap cache associated with
+ * this page if it is the last user of the page. Can not do a lock_page,
+ * as we are holding the page_table_lock spinlock.
+ */
+void free_page_and_swap_cache(struct page *page)
+{
+   /* 
+    * If we are the only user, then try to free up the swap cache. 
+    * 
+    * Its ok to check for PageSwapCache without the page lock
+    * here because we are going to recheck again inside 
+    * exclusive_swap_page() _with_ the lock. 
+    *                - Marcelo
+    */
+   if (PageSwapCache(page) && !TryLockPage(page)) {
+      if (exclusive_swap_page(page))
+         delete_from_swap_cache_nolock(page);
+      UnlockPage(page);
+   }
+   page_cache_release(page);
+}
+
+
 /*
  * Lookup a swap entry in the swap cache. A found page will be returned
  * unlocked and with its refcount incremented - we rely on the kernel


Comments: webmaster (at) linuxhq.com.
Advertising: banners (at) linuxhq.com.
Compilation ©1998-2008 Linux Headquarters, Inc.