From: Con Kolivas <kernel@kolivas.org>
To: Andrew Morton <akpm@osdl.org>
Cc: ck@vds.kolivas.org, Nick Piggin <nickpiggin@yahoo.com.au>,
linux list <linux-kernel@vger.kernel.org>,
linux-mm@kvack.org
Subject: [PATCH] mm: limit lowmem_reserve
Date: Thu, 6 Apr 2006 11:10:35 +1000 [thread overview]
Message-ID: <200604061110.35789.kernel@kolivas.org> (raw)
In-Reply-To: <200604041235.59876.kernel@kolivas.org>
It is possible with a low enough lowmem_reserve ratio to make
zone_watermark_ok always fail if the lower_zone is small enough.
Impose a lower limit on the ratio to only allow 1/4 of the lower_zone
size to be set as lowmem_reserve. This limit is hit in ZONE_DMA by changing
the default vmsplit on i386 even without changing the default sysctl values.
Signed-off-by: Con Kolivas <kernel@kolivas.org>
---
mm/page_alloc.c | 24 +++++++++++++++++++++---
1 files changed, 21 insertions(+), 3 deletions(-)
Index: linux-2.6.17-rc1-mm1/mm/page_alloc.c
===================================================================
--- linux-2.6.17-rc1-mm1.orig/mm/page_alloc.c 2006-04-06 10:32:31.000000000 +1000
+++ linux-2.6.17-rc1-mm1/mm/page_alloc.c 2006-04-06 11:09:17.000000000 +1000
@@ -2566,14 +2566,32 @@ static void setup_per_zone_lowmem_reserv
zone->lowmem_reserve[j] = 0;
for (idx = j-1; idx >= 0; idx--) {
+ unsigned long max_reserve;
+ unsigned long reserve;
struct zone *lower_zone;
+ lower_zone = pgdat->node_zones + idx;
+ /*
+ * Put an upper limit on the reserve at 1/4
+ * the lower_zone size. This prevents large
+ * zone size differences such as 3G VMSPLIT
+ * or low sysctl values from making
+ * zone_watermark_ok always fail. This
+ * enforces a lower limit on the reserve_ratio
+ */
+ max_reserve = lower_zone->present_pages / 4;
+
if (sysctl_lowmem_reserve_ratio[idx] < 1)
sysctl_lowmem_reserve_ratio[idx] = 1;
-
- lower_zone = pgdat->node_zones + idx;
- lower_zone->lowmem_reserve[j] = present_pages /
+ reserve = present_pages /
sysctl_lowmem_reserve_ratio[idx];
+ if (reserve > max_reserve) {
+ reserve = max_reserve;
+ sysctl_lowmem_reserve_ratio[idx] =
+ present_pages / max_reserve;
+ }
+
+ lower_zone->lowmem_reserve[j] = reserve;
present_pages += lower_zone->present_pages;
}
}
--
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>
next parent reply other threads:[~2006-04-06 1:10 UTC|newest]
Thread overview: 19+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <200604021401.13331.kernel@kolivas.org>
[not found] ` <200604031248.13532.kernel@kolivas.org>
[not found] ` <200604041235.59876.kernel@kolivas.org>
2006-04-06 1:10 ` Con Kolivas [this message]
2006-04-06 1:29 ` Respin: " Con Kolivas
2006-04-06 2:43 ` Andrew Morton
2006-04-06 2:55 ` Con Kolivas
2006-04-06 2:58 ` Con Kolivas
2006-04-06 3:40 ` Andrew Morton
2006-04-06 4:36 ` Con Kolivas
2006-04-06 4:52 ` Con Kolivas
2006-04-07 6:25 ` Nick Piggin
2006-04-07 9:02 ` Con Kolivas
2006-04-07 12:40 ` Nick Piggin
2006-04-08 0:15 ` Con Kolivas
2006-04-08 0:55 ` Nick Piggin
2006-04-08 1:01 ` Con Kolivas
2006-04-08 1:25 ` Nick Piggin
2006-05-17 14:11 ` Con Kolivas
2006-05-18 7:11 ` Nick Piggin
2006-05-18 7:21 ` Con Kolivas
2006-05-18 7:26 ` Nick Piggin
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=200604061110.35789.kernel@kolivas.org \
--to=kernel@kolivas.org \
--cc=akpm@osdl.org \
--cc=ck@vds.kolivas.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mm@kvack.org \
--cc=nickpiggin@yahoo.com.au \
/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