Skip to contentSkip to conversation

memory balancing highmem/dma fixes against pre6

PATCH Andrea Arcangeli 1 participant 1 message Oct 9, 2001

Subsystems (8)
lore
Share & tools
lore
#0 lore raw

Here it is how I fixed the highmem faliures in 2.4.11pre6aa1. I think you won't like some of the things I did sorry. Also temporarly removed the oom killer again, until I hook it into a better place (not kswpad) and I don't kill in function of the size of the task that I'd hate on my machines where big but innocent things runs all the time.

This seems to work just fine here with highmem emulation, and the refill_inactive and friends are now highmem aware and this fixes the problem completly in the testing I did (and it's certainly much more efficient than looping over and over again always doing the wrong thing for a long time). Now I think real hardware will like it as well, but that still has to be demonstrated.

But now the memory balancing seems completly relaible and swap behaviour seems really nice. cache behaviour should be the same as 2.4.11pre6 except I don't penalize readahead compared to "used once" data and I avoid rolling over the inactive list in case there's no readahead for example.

I also avoided the decreasing priority per Linus's suggestion to avoid banging too much on the inactive list while we swapout.

include/linux/mmzone.h +1 -0
diff -urN 2.4.11pre6/include/linux/mmzone.h vm/include/linux/mmzone.h
@@ -41,6 +41,7 @@
 	unsigned long		free_pages;
 	unsigned long		pages_min, pages_low, pages_high;
 	int			need_balance;
+	int			nr_active_pages, nr_inactive_pages;
 
 	/*
 	 * free areas of different sizes
include/linux/swap.h +69 -6

110 lines not on this page · raw message

mm/filemap.c +9 -2
diff -urN 2.4.11pre6/mm/filemap.c vm/mm/filemap.c
@@ -1633,7 +1633,7 @@
 	 * and possibly copy it over to another page..
 	 */
 	old_page = page;
-	mark_page_accessed(page);
+	activate_page(page);
 	if (no_share) {
 		struct page *new_page = alloc_page(GFP_HIGHUSER);
 
@@ -2746,8 +2746,15 @@
 		}
 unlock:
 		kunmap(page);
+
+		/*
+		 * Mark the page accessed if we wrote the
+		 * beginning or we just did an lseek.
+		 */
+		if (!offset || !file->f_reada)
+			mark_page_accessed(page);
+
 		/* Mark it unlocked again and drop the page.. */
-		SetPageReferenced(page);
 		UnlockPage(page);
 		page_cache_release(page);
 
mm/oom_kill.c +0 -64

67 lines not on this page · raw message

mm/page_alloc.c +49 -38

136 lines not on this page · raw message

mm/swap.c +2 -0
diff -urN 2.4.11pre6/mm/swap.c vm/mm/swap.c
@@ -54,6 +54,7 @@
 		del_page_from_active_list(page);
 		add_page_to_inactive_list(page);
 	}
+	ClearPageReferenced(page);
 }	
 
 void deactivate_page(struct page * page)
@@ -79,6 +80,7 @@
 	spin_lock(&pagemap_lru_lock);
 	activate_page_nolock(page);
 	spin_unlock(&pagemap_lru_lock);
+	SetPageReferenced(page);
 }
 
 /**
mm/vmscan.c +65 -43

218 lines not on this page · raw message

Andrea