patch-2.4.15 linux/mm/swap.c

Next file: linux/mm/vmscan.c
Previous file: linux/mm/shmem.c
Back to the patch index
Back to the overall index

diff -u --recursive --new-file v2.4.14/linux/mm/swap.c linux/mm/swap.c
@@ -38,7 +38,7 @@
  */
 static inline void activate_page_nolock(struct page * page)
 {
-	if (PageInactive(page)) {
+	if (PageLRU(page) && !PageActive(page)) {
 		del_page_from_inactive_list(page);
 		add_page_to_active_list(page);
 	}
@@ -57,7 +57,7 @@
  */
 void lru_cache_add(struct page * page)
 {
-	if (!PageActive(page) && !PageInactive(page)) {
+	if (!TestSetPageLRU(page)) {
 		spin_lock(&pagemap_lru_lock);
 		add_page_to_inactive_list(page);
 		spin_unlock(&pagemap_lru_lock);
@@ -73,12 +73,12 @@
  */
 void __lru_cache_del(struct page * page)
 {
-	if (PageActive(page)) {
-		del_page_from_active_list(page);
-	} else if (PageInactive(page)) {
-		del_page_from_inactive_list(page);
-	} else {
-//		printk("VM: __lru_cache_del, found unknown page ?!\n");
+	if (TestClearPageLRU(page)) {
+		if (PageActive(page)) {
+			del_page_from_active_list(page);
+		} else {
+			del_page_from_inactive_list(page);
+		}
 	}
 }
 

FUNET's LINUX-ADM group, linux-adm@nic.funet.fi
TCL-scripts by Sam Shen (who was at: slshen@lbl.gov)