All of lore.kernel.org
 help / color / mirror / Atom feed
From: Martin Bligh <mbligh@google.com>
To: Andrew Morton <akpm@osdl.org>,
	Linux Kernel Mailing List <linux-kernel@vger.kernel.org>,
	Linux Memory Management <linux-mm@kvack.org>
Subject: [PATCH] Use min of two prio settings in calculating distress for reclaim
Date: Mon, 16 Oct 2006 18:30:39 -0700	[thread overview]
Message-ID: <4534323F.5010103@google.com> (raw)

[-- Attachment #1: Type: text/plain, Size: 551 bytes --]

Another bug is that if try_to_free_pages / balance_pgdat are called
with a gfp_mask specifying GFP_IO and/or GFP_FS, they may reclaim
the requisite number of pages, and reset prev_priority to DEF_PRIORITY.

However, another reclaimer without those gfp_mask flags set may still
be struggling to reclaim pages. The easy fix for this is to key the
distress calculation not off zone->prev_priority, but also take into
account the local caller's priority by using:
min(zone->prev_priority, sc->priority)

Signed-off-by: Martin J. Bligh <mbligh@google.com>

[-- Attachment #2: 2.6.18-min_prio --]
[-- Type: text/plain, Size: 1479 bytes --]

diff -aurpN -X /home/mbligh/.diff.exclude linux-2.6.18/mm/vmscan.c 2.6.18-min_prio/mm/vmscan.c
--- linux-2.6.18/mm/vmscan.c	2006-09-20 12:24:42.000000000 -0700
+++ 2.6.18-min_prio/mm/vmscan.c	2006-10-16 18:16:39.000000000 -0700
@@ -713,7 +713,7 @@ done:
  * But we had to alter page->flags anyway.
  */
 static void shrink_active_list(unsigned long nr_pages, struct zone *zone,
-				struct scan_control *sc)
+				struct scan_control *sc, int priority)
 {
 	unsigned long pgmoved;
 	int pgdeactivate = 0;
@@ -734,7 +734,7 @@ static void shrink_active_list(unsigned 
 		 * `distress' is a measure of how much trouble we're having
 		 * reclaiming pages.  0 -> no problems.  100 -> great trouble.
 		 */
-		distress = 100 >> zone->prev_priority;
+		distress = 100 >> min(zone->prev_priority, priority);
 
 		/*
 		 * The point of this algorithm is to decide when to start
@@ -885,7 +885,7 @@ static unsigned long shrink_zone(int pri
 			nr_to_scan = min(nr_active,
 					(unsigned long)sc->swap_cluster_max);
 			nr_active -= nr_to_scan;
-			shrink_active_list(nr_to_scan, zone, sc);
+			shrink_active_list(nr_to_scan, zone, sc, priority);
 		}
 
 		if (nr_inactive) {
@@ -1315,7 +1315,7 @@ static unsigned long shrink_all_zones(un
 			if (zone->nr_scan_active >= nr_pages || pass > 3) {
 				zone->nr_scan_active = 0;
 				nr_to_scan = min(nr_pages, zone->nr_active);
-				shrink_active_list(nr_to_scan, zone, sc);
+				shrink_active_list(nr_to_scan, zone, sc, prio);
 			}
 		}
 

             reply	other threads:[~2006-10-17  1:30 UTC|newest]

Thread overview: 17+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2006-10-17  1:30 Martin Bligh [this message]
2006-10-17  6:33 ` [PATCH] Use min of two prio settings in calculating distress for reclaim Nick Piggin
2006-10-17  6:33   ` Nick Piggin
2006-10-17  6:43   ` Martin J. Bligh
2006-10-17  6:43     ` Martin J. Bligh
2006-10-17  6:56     ` Nick Piggin
2006-10-17  6:56       ` Nick Piggin
2006-10-17 13:52       ` Martin J. Bligh
2006-10-17 13:52         ` Martin J. Bligh
2006-10-17 16:43         ` Nick Piggin
2006-10-17 16:43           ` Nick Piggin
2006-10-17 16:58           ` Martin Bligh
2006-10-17 16:58             ` Martin Bligh
2006-10-17 17:14             ` Nick Piggin
2006-10-17 17:14               ` Nick Piggin
2006-10-17  6:50   ` Andrew Morton
2006-10-17  6:50     ` Andrew Morton

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=4534323F.5010103@google.com \
    --to=mbligh@google.com \
    --cc=akpm@osdl.org \
    --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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.