linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
From: Rik van Riel <riel@redhat.com>
To: Rik van Riel <riel@redhat.com>
Cc: linux-mm@kvack.org, linux-kernel@vger.kernel.org
Subject: [RFC PATCH 8/10] make split VM and lumpy reclaim work together
Date: Sat, 3 Nov 2007 19:03:54 -0400	[thread overview]
Message-ID: <20071103190354.2ef7f5e8@bree.surriel.com> (raw)
In-Reply-To: <20071103184229.3f20e2f0@bree.surriel.com>

Make lumpy reclaim and the split VM code work together better, by
allowing both file and anonymous pages to be relaimed together.

Will be merged into patch 6/10 soon, split out for the benefit of
people who have looked at the older code in the past.

Signed-off-by: Rik van Riel <riel@redhat.com>

Index: linux-2.6.23-mm1/mm/vmscan.c
===================================================================
--- linux-2.6.23-mm1.orig/mm/vmscan.c
+++ linux-2.6.23-mm1/mm/vmscan.c
@@ -752,10 +752,6 @@ static unsigned long isolate_lru_pages(u
 
 			cursor_page = pfn_to_page(pfn);
 
-			/* Don't lump pages of different types:  file vs anon */
-			if (!PageLRU(page) || (file != !!page_file_cache(cursor_page)))
-				break;
-
 			/* Check that we have not crossed a zone boundary. */
 			if (unlikely(page_zone_id(cursor_page) != zone_id))
 				continue;
@@ -799,16 +795,22 @@ static unsigned long isolate_pages_globa
  * clear_active_flags() is a helper for shrink_active_list(), clearing
  * any active bits from the pages in the list.
  */
-static unsigned long clear_active_flags(struct list_head *page_list)
+static unsigned long clear_active_flags(struct list_head *page_list,
+					unsigned int *count)
 {
 	int nr_active = 0;
+	int lru;
 	struct page *page;
 
-	list_for_each_entry(page, page_list, lru)
+	list_for_each_entry(page, page_list, lru) {
+		lru = page_file_cache(page);
 		if (PageActive(page)) {
+			lru += LRU_ACTIVE;
 			ClearPageActive(page);
 			nr_active++;
 		}
+		count[lru]++;
+	}
 
 	return nr_active;
 }
@@ -876,24 +878,25 @@ static unsigned long shrink_inactive_lis
 		unsigned long nr_scan;
 		unsigned long nr_freed;
 		unsigned long nr_active;
+		unsigned int count[NR_LRU_LISTS] = { 0, };
+		int mode = (sc->order > PAGE_ALLOC_COSTLY_ORDER) ?
+					ISOLATE_BOTH : ISOLATE_INACTIVE;
 
 		nr_taken = sc->isolate_pages(sc->swap_cluster_max,
-			     &page_list, &nr_scan, sc->order,
-			     (sc->order > PAGE_ALLOC_COSTLY_ORDER)?
-					     ISOLATE_BOTH : ISOLATE_INACTIVE,
+			     &page_list, &nr_scan, sc->order, mode,
 				zone, sc->mem_cgroup, 0, file);
-		nr_active = clear_active_flags(&page_list);
+		nr_active = clear_active_flags(&page_list, count);
 		__count_vm_events(PGDEACTIVATE, nr_active);
 
-		if (file) {
-			__mod_zone_page_state(zone, NR_ACTIVE_FILE, -nr_active);
-			__mod_zone_page_state(zone, NR_INACTIVE_FILE,
-						-(nr_taken - nr_active));
-		} else {
-			__mod_zone_page_state(zone, NR_ACTIVE_ANON, -nr_active);
-			__mod_zone_page_state(zone, NR_INACTIVE_ANON,
-						-(nr_taken - nr_active));
-		}
+		__mod_zone_page_state(zone, NR_ACTIVE_FILE,
+						-count[LRU_ACTIVE_FILE]);
+		__mod_zone_page_state(zone, NR_INACTIVE_FILE,
+						-count[LRU_INACTIVE_FILE]);
+		__mod_zone_page_state(zone, NR_ACTIVE_ANON,
+						-count[LRU_ACTIVE_ANON]);
+		__mod_zone_page_state(zone, NR_INACTIVE_ANON,
+						-count[LRU_INACTIVE_ANON]);
+
 		zone->pages_scanned += nr_scan;
 		spin_unlock_irq(&zone->lru_lock);
 
@@ -914,7 +917,7 @@ static unsigned long shrink_inactive_lis
 			 * The attempt at page out may have made some
 			 * of the pages active, mark them inactive again.
 			 */
-			nr_active = clear_active_flags(&page_list);
+			nr_active = clear_active_flags(&page_list, count);
 			count_vm_events(PGDEACTIVATE, nr_active);
 
 			nr_freed += shrink_page_list(&page_list, sc,
@@ -943,11 +946,11 @@ static unsigned long shrink_inactive_lis
 			VM_BUG_ON(PageLRU(page));
 			SetPageLRU(page);
 			list_del(&page->lru);
-			if (file) {
+			if (page_file_cache(page)) {
 				l += LRU_FILE;
-				zone->recent_rotated_file += sc->activated;
+				zone->recent_rotated_file++;
 			} else {
-				zone->recent_rotated_anon += sc->activated;
+				zone->recent_rotated_anon++;
 			}
 			if (PageActive(page))
 				l += LRU_ACTIVE;

--
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-mm.org/ .
Don't email: <a href=mailto:"dont@kvack.org"> email@kvack.org </a>

  parent reply	other threads:[~2007-11-03 23:03 UTC|newest]

Thread overview: 31+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-11-03 22:42 [RFC PATCH 0/10] split anon and file LRUs Rik van Riel
2007-11-03 22:54 ` [RFC PATCH 1/10] move isolate_lru_page to vmscan.c Rik van Riel
2007-11-07  2:13   ` Christoph Lameter
2007-11-03 22:54 ` [RFC PATCH 2/10] free swap space entries if vm_swap_full() Rik van Riel
2007-11-07  2:20   ` Christoph Lameter
2007-11-07  2:48     ` Rik van Riel
2007-11-03 22:55 ` [RFC PATCH 3/10] define page_file_cache Rik van Riel
2007-11-07  2:23   ` Christoph Lameter
2007-11-07  2:55     ` Rik van Riel
2007-11-07  3:02       ` Christoph Lameter
2007-11-07  3:17         ` Rik van Riel
2007-11-07  3:26           ` Christoph Lameter
2007-11-07 14:35             ` Rik van Riel
2007-11-07 18:06               ` Christoph Lameter
2007-11-07 18:17                 ` Rik van Riel
2007-11-07 18:18                   ` Christoph Lameter
2007-11-03 22:55 ` [RFC PATCH 4/10] debug page_file_cache Rik van Riel
2007-11-03 22:56 ` [RFC PATCH 5/10] use an indexed array for LRU lists and variables Rik van Riel
2007-11-03 23:01 ` [RFC PATCH 6/10] split anon and file LRUs Rik van Riel
2007-11-07  2:28   ` Christoph Lameter
2007-11-07  3:00     ` Rik van Riel
2007-11-03 23:02 ` [RFC PATCH 7/10] clean up the LRU array arithmetic Rik van Riel
2007-11-03 23:03 ` Rik van Riel [this message]
2007-11-03 23:04 ` [RFC PATCH 9/10] split VM and memory controllers Rik van Riel
2007-11-03 23:06 ` [RFC PATCH 10/10] add swapped in pages to the inactive list Rik van Riel
2007-11-07  2:11 ` [RFC PATCH 0/10] split anon and file LRUs Christoph Lameter
2007-11-07  2:23   ` Rik van Riel
2007-11-07  2:40     ` Christoph Lameter
2007-11-07  2:51       ` Rik van Riel
2007-11-07 17:59         ` Andrew Morton
2007-11-07 18:16           ` Rik van Riel

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20071103190354.2ef7f5e8@bree.surriel.com \
    --to=riel@redhat.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mm@kvack.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox