[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Count swap faults which need to read data from the swap area asmajor faults



Hi, 

Right now we are not accounting faults which nee to read data from swap as
major faults. 

The following patch should fix that. 

Against -ac28. (probably applies against 2.4.3-ac2) 

--- linux/mm/memory.c.orig	Tue Apr  3 21:30:03 2001
+++ linux/mm/memory.c	Tue Apr  3 21:32:18 2001
@@ -1112,6 +1112,7 @@
 {
 	struct page *page;
 	pte_t pte;
+	int ret = 1;
 
 	spin_unlock(&mm->page_table_lock);
 	page = lookup_swap_cache(entry);
@@ -1125,6 +1126,9 @@
 			return -1;
 		}
 
+		/* Had to read the page from swap area: Major fault */
+		ret = 2;
+
 		flush_page_to_ram(page);
 		flush_icache_page(vma, page);
 	}
@@ -1160,7 +1164,7 @@
 
 	/* No need to invalidate - it was non-present before */
 	update_mmu_cache(vma, address, pte);
-	return 1;	/* Minor fault */
+	return ret;
 }
 
 /*

--
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.eu.org/Linux-MM/