All of lore.kernel.org
 help / color / mirror / Atom feed
From: Nick Piggin <piggin@cyberone.com.au>
To: Andrew Morton <akpm@osdl.org>
Cc: linux-mm@kvack.org
Subject: [PATCH 5/5] mm improvements
Date: Wed, 04 Feb 2004 20:42:44 +1100	[thread overview]
Message-ID: <4020BE94.1040001@cyberone.com.au> (raw)
In-Reply-To: <4020BDCB.8030707@cyberone.com.au>

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

Nick Piggin wrote:

> 5/5: vm-tune-throttle.patch
>     Try to allocate a bit harder before giving up / throttling on
>     writeout.
>



[-- Attachment #2: vm-tune-throttle.patch --]
[-- Type: text/plain, Size: 3115 bytes --]


This patch causes try_to_free_pages to wakeup_bdflush even if it has
reclaimed the required # of pages on the first scan.

It allows two scans at the two lowest priorities before breaking out or
doing a blk_congestion_wait, for both try_to_free_pages and balance_pgdat.


 linux-2.6-npiggin/mm/vmscan.c |   38 +++++++++++++++++++++-----------------
 1 files changed, 21 insertions(+), 17 deletions(-)

diff -puN mm/vmscan.c~vm-tune-throttle mm/vmscan.c
--- linux-2.6/mm/vmscan.c~vm-tune-throttle	2004-02-04 14:09:46.000000000 +1100
+++ linux-2.6-npiggin/mm/vmscan.c	2004-02-04 14:09:46.000000000 +1100
@@ -930,22 +930,33 @@ int try_to_free_pages(struct zone **zone
 
 		if (nr_reclaimed >= nr_pages) {
 			ret = 1;
+			if (gfp_mask & __GFP_FS)
+				wakeup_bdflush(total_scanned);
 			goto out;
 		}
+
+		/* Don't stall on the first run - it might be bad luck */
+		if (likely(priority == DEF_PRIORITY))
+			continue;
+
+		/* Let the caller handle it */
 		if (!(gfp_mask & __GFP_FS))
-			break;		/* Let the caller handle it */
+			goto out;
+
 		/*
-		 * Try to write back as many pages as we just scanned.  Not
-		 * sure if that makes sense, but it's an attempt to avoid
-		 * creating IO storms unnecessarily
+		 * Try to write back as many pages as we just scanned.
+		 * Not sure if that makes sense, but it's an attempt
+		 * to avoid creating IO storms unnecessarily
 		 */
 		wakeup_bdflush(total_scanned);
 
 		/* Take a nap, wait for some writeback to complete */
 		blk_congestion_wait(WRITE, HZ/10);
 	}
-	if ((gfp_mask & __GFP_FS) && !(gfp_mask & __GFP_NORETRY))
+
+	if (!(gfp_mask & __GFP_NORETRY))
 		out_of_memory();
+
 out:
 	for (i = 0; zones[i] != 0; i++)
 		zones[i]->prev_priority = zones[i]->temp_priority;
@@ -1004,6 +1015,7 @@ static int balance_pgdat(pg_data_t *pgda
 				if (to_reclaim <= 0)
 					continue;
 			}
+			all_zones_ok = 0;
 			zone->temp_priority = priority;
 			reclaimed = shrink_zone(zone, GFP_KERNEL,
 					to_reclaim, &nr_scanned, ps, priority);
@@ -1017,16 +1029,6 @@ static int balance_pgdat(pg_data_t *pgda
 				continue;
 			if (zone->pages_scanned > zone->present_pages * 2)
 				zone->all_unreclaimable = 1;
-			/*
-			 * If this scan failed to reclaim `to_reclaim' or more
-			 * pages, we're getting into trouble.  Need to scan
-			 * some more, and throttle kswapd.   Note that this zone
-			 * may now have sufficient free pages due to freeing
-			 * activity by some other process.   That's OK - we'll
-			 * pick that info up on the next pass through the loop.
-			 */
-			if (reclaimed < to_reclaim)
-				all_zones_ok = 0;
 		}
 		if (nr_pages && to_free > 0)
 			continue;	/* swsusp: need to do more work */
@@ -1034,9 +1036,11 @@ static int balance_pgdat(pg_data_t *pgda
 			break;		/* kswapd: all done */
 		/*
 		 * OK, kswapd is getting into trouble.  Take a nap, then take
-		 * another pass across the zones.
+		 * another pass across the zones. Don't stall on the first
+		 * pass.
 		 */
-		blk_congestion_wait(WRITE, HZ/10);
+		if (priority < DEF_PRIORITY)
+			blk_congestion_wait(WRITE, HZ/10);
 	}
 
 	for (i = 0; i < pgdat->nr_zones; i++) {

_

  parent reply	other threads:[~2004-02-04  9:42 UTC|newest]

Thread overview: 40+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2004-02-04  9:39 [PATCH 0/5] mm improvements Nick Piggin
2004-02-04  9:40 ` [PATCH 1/5] " Nick Piggin
2004-02-04 19:45   ` Rik van Riel
2004-02-09  7:00     ` Nick Piggin
2004-02-09 21:56       ` Rik van Riel
2004-02-04  9:40 ` [PATCH 2/5] " Nick Piggin
2004-02-04 10:10   ` Andrew Morton
2004-02-04 10:15     ` Nick Piggin
2004-02-04 15:27     ` Rik van Riel
2004-02-05  2:18       ` Nick Piggin
2004-02-04  9:41 ` [PATCH 3/5] " Nick Piggin
2004-02-04 15:28   ` Rik van Riel
2004-02-04 16:45     ` Nikita Danilov
2004-02-04 18:53       ` Andrew Morton
2004-02-05  2:10       ` Nick Piggin
2004-02-04  9:42 ` [PATCH 4/5] " Nick Piggin
2004-02-04 10:11   ` Andrew Morton
2004-02-04 10:19     ` Nick Piggin
2004-02-04  9:42 ` Nick Piggin [this message]
2004-02-04 10:03   ` [PATCH 5/5] " Nick Piggin
2004-02-04 10:18   ` Andrew Morton
2004-02-04 10:22     ` Nick Piggin
2004-02-04 13:25 ` [PATCH 0/5] " Nikita Danilov
2004-02-04 13:53   ` Hugh Dickins
2004-02-04 14:03     ` Nikita Danilov
2004-02-04 15:03       ` Hugh Dickins
2004-02-04 15:19         ` Nikita Danilov
2004-02-05  2:13           ` Nick Piggin
2004-02-05 14:03             ` Nikita Danilov
2004-02-05 15:11               ` Nick Piggin
2004-02-05 15:15                 ` Nick Piggin
2004-02-05 15:20                   ` Nikita Danilov
2004-02-05 15:33                     ` Nick Piggin
2004-02-05 15:46                       ` Nikita Danilov
2004-02-05 15:56                         ` Nick Piggin
2004-02-05 16:03                           ` Nikita Danilov
2004-02-05 16:09                             ` Nick Piggin
2004-02-04 18:33     ` Andrew Morton
2004-02-04 20:54       ` Hugh Dickins
2004-02-04 21:04         ` 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=4020BE94.1040001@cyberone.com.au \
    --to=piggin@cyberone.com.au \
    --cc=akpm@osdl.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.