patch-2.4.10 linux/mm/swap.c

Next file: linux/mm/swap_state.c
Previous file: linux/mm/slab.c
Back to the patch index
Back to the overall index

diff -u --recursive --new-file v2.4.9/linux/mm/swap.c linux/mm/swap.c
@@ -24,50 +24,13 @@
 #include <asm/uaccess.h> /* for copy_to/from_user */
 #include <asm/pgtable.h>
 
-/*
- * We identify three levels of free memory.  We never let free mem
- * fall below the freepages.min except for atomic allocations.  We
- * start background swapping if we fall below freepages.high free
- * pages, and we begin intensive swapping below freepages.low.
- *
- * Actual initialization is done in mm/page_alloc.c
- */
-freepages_t freepages = {
-	0,	/* freepages.min */
-	0,	/* freepages.low */
-	0	/* freepages.high */
-};
-
 /* How many pages do we try to swap or page in/out together? */
 int page_cluster;
 
-/*
- * This variable contains the amount of page steals the system
- * is doing, averaged over a minute. We use this to determine how
- * many inactive pages we should have.
- *
- * In reclaim_page and __alloc_pages: memory_pressure++
- * In __free_pages_ok: memory_pressure--
- * In recalculate_vm_stats the value is decayed (once a second)
- */
-int memory_pressure;
-
 /* We track the number of pages currently being asynchronously swapped
    out, so that we don't try to swap TOO many pages out at once */
 atomic_t nr_async_pages = ATOMIC_INIT(0);
 
-buffer_mem_t buffer_mem = {
-	2,	/* minimum percent buffer */
-	10,	/* borrow percent buffer */
-	60	/* maximum percent buffer */
-};
-
-buffer_mem_t page_cache = {
-	2,	/* minimum percent page cache */
-	15,	/* borrow percent page cache */
-	75	/* maximum */
-};
-
 pager_daemon_t pager_daemon = {
 	512,	/* base number for calculating the number of tries */
 	SWAP_CLUSTER_MAX,	/* minimum number of tries */
@@ -87,25 +50,9 @@
  */
 void deactivate_page_nolock(struct page * page)
 {
-	/*
-	 * One for the cache, one for the extra reference the
-	 * caller has and (maybe) one for the buffers.
-	 *
-	 * This isn't perfect, but works for just about everything.
-	 * Besides, as long as we don't move unfreeable pages to the
-	 * inactive_clean list it doesn't need to be perfect...
-	 */
-	int maxcount = (page->buffers ? 3 : 2);
-	page->age = 0;
-	ClearPageReferenced(page);
-
-	/*
-	 * Don't touch it if it's not on the active list.
-	 * (some pages aren't on any list at all)
-	 */
-	if (PageActive(page) && page_count(page) <= maxcount && !page_ramdisk(page)) {
+	if (PageActive(page)) {
 		del_page_from_active_list(page);
-		add_page_to_inactive_dirty_list(page);
+		add_page_to_inactive_list(page);
 	}
 }	
 
@@ -121,22 +68,10 @@
  */
 void activate_page_nolock(struct page * page)
 {
-	if (PageInactiveDirty(page)) {
-		del_page_from_inactive_dirty_list(page);
-		add_page_to_active_list(page);
-	} else if (PageInactiveClean(page)) {
-		del_page_from_inactive_clean_list(page);
+	if (PageInactive(page)) {
+		del_page_from_inactive_list(page);
 		add_page_to_active_list(page);
-	} else {
-		/*
-		 * The page was not on any list, so we take care
-		 * not to do anything.
-		 */
 	}
-
-	/* Make sure the page gets a fair chance at staying active. */
-	if (page->age < PAGE_AGE_START)
-		page->age = PAGE_AGE_START;
 }
 
 void activate_page(struct page * page)
@@ -152,11 +87,10 @@
  */
 void lru_cache_add(struct page * page)
 {
-	spin_lock(&pagemap_lru_lock);
 	if (!PageLocked(page))
 		BUG();
-	add_page_to_inactive_dirty_list(page);
-	page->age = 0;
+	spin_lock(&pagemap_lru_lock);
+	add_page_to_inactive_list(page);
 	spin_unlock(&pagemap_lru_lock);
 }
 
@@ -171,14 +105,11 @@
 {
 	if (PageActive(page)) {
 		del_page_from_active_list(page);
-	} else if (PageInactiveDirty(page)) {
-		del_page_from_inactive_dirty_list(page);
-	} else if (PageInactiveClean(page)) {
-		del_page_from_inactive_clean_list(page);
-	} else {
+	} else if (PageInactive(page)) {
+		del_page_from_inactive_list(page);
+	} else
 		printk("VM: __lru_cache_del, found unknown page ?!\n");
-	}
-	DEBUG_ADD_PAGE
+	DEBUG_LRU_PAGE(page);
 }
 
 /**
@@ -192,22 +123,6 @@
 	spin_lock(&pagemap_lru_lock);
 	__lru_cache_del(page);
 	spin_unlock(&pagemap_lru_lock);
-}
-
-/**
- * recalculate_vm_stats - recalculate VM statistics
- *
- * This function should be called once a second to recalculate
- * some useful statistics the VM subsystem uses to determine
- * its behaviour.
- */
-void recalculate_vm_stats(void)
-{
-	/*
-	 * Substract one second worth of memory_pressure from
-	 * memory_pressure.
-	 */
-	memory_pressure -= (memory_pressure >> INACTIVE_SHIFT);
 }
 
 /*

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