linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
From: Arjan van de Ven <arjanv@redhat.com>
To: linux-mm@kvack.org
Subject: Swap progress accounting
Date: Mon, 23 Jul 2001 06:15:12 -0400	[thread overview]
Message-ID: <20010723061512.A21588@devserv.devel.redhat.com> (raw)

Hi,

Currently, calling swap_out() on a zone doesn't count progress, and the
result can be that you swap_out() a lot of pages, and still return "no
progress possible" to try_to_free_pages(), which in turn makes a GFP_KERNEL
allocation fail (and that can kill init).

The patch below makes it count as progress, so at least the page allocator
will keep trying harder in this case (and more importantly, will start the
io on the swappage if needed etc) 

Comments? 

Greetings,
   Arjan van de Ven



--- linux/mm/vmscan.c.org	Sun Jul 22 21:06:21 2001
+++ linux/mm/vmscan.c	Sun Jul 22 21:16:41 2001
@@ -288,7 +288,7 @@
 	return nr;
 }
 
-static void swap_out(zone_t *zone, unsigned int priority, int gfp_mask)
+static int swap_out(zone_t *zone, unsigned int priority, int gfp_mask)
 {
 	int counter;
 	int retval = 0;
@@ -321,10 +321,11 @@
 		retval |= swap_out_mm(zone, mm, swap_amount(mm));
 		mmput(mm);
 	} while (--counter >= 0);
-	return;
+	return retval;
 
 empty:
 	spin_unlock(&mmlist_lock);
+	return retval;
 }
 
 
@@ -949,7 +950,8 @@
 		}
 
 		/* Walk the VM space for a bit.. */
-		swap_out(NULL, DEF_PRIORITY, gfp_mask);
+		if (swap_out(NULL, DEF_PRIORITY, gfp_mask))
+			count--; /* count swap progress as progress */
 
 		count -= refill_inactive_scan(NULL, DEF_PRIORITY, count);
 		if (count <= 0)
@@ -973,7 +975,8 @@
 	maxtry = (1 << DEF_PRIORITY);
 
 	do {
-		swap_out(zone, DEF_PRIORITY, gfp_mask);
+		if (swap_out(zone, DEF_PRIORITY, gfp_mask))
+			count--; /* count swap progress as progress */
 
 		count -= refill_inactive_scan(zone, DEF_PRIORITY, count);
 

--
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/

             reply	other threads:[~2001-07-23 10:15 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2001-07-23 10:15 Arjan van de Ven [this message]
2001-07-23 17:26 ` Rik van Riel
2001-07-23 18:35   ` Rik van Riel
2001-07-23 18:41     ` Stephen C. Tweedie
2001-07-23 18:46       ` 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=20010723061512.A21588@devserv.devel.redhat.com \
    --to=arjanv@redhat.com \
    --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