public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH] mm: swap prefetch fix lowmem reserve calc
@ 2006-05-18  5:58 Con Kolivas
  2006-05-18  7:18 ` Nick Piggin
  0 siblings, 1 reply; 3+ messages in thread
From: Con Kolivas @ 2006-05-18  5:58 UTC (permalink / raw)
  To: linux kernel mailing list, ck list, Andrew Morton; +Cc: Nick Piggin

When examining the free limits in swap_prefetch we should ensure the largest
lowmem_reserve for each zone is free.

Signed-off-by: Con Kolivas <kernel@kolivas.org>

---
 mm/swap_prefetch.c |   14 +++++++++++++-
 1 files changed, 13 insertions(+), 1 deletion(-)

Index: linux-2.6.17-rc4-mm1/mm/swap_prefetch.c
===================================================================
--- linux-2.6.17-rc4-mm1.orig/mm/swap_prefetch.c	2006-05-18 15:48:22.000000000 +1000
+++ linux-2.6.17-rc4-mm1/mm/swap_prefetch.c	2006-05-18 15:52:42.000000000 +1000
@@ -258,6 +258,18 @@ static void clear_current_prefetch_free(
 	}
 }
 
+static inline unsigned long largest_lowmem_reserve(struct zone *z)
+{
+	unsigned long ret = 0;
+	unsigned int idx = zone_idx(z);
+
+	while (!is_highmem_idx(idx)) {
+		idx++;
+		ret = max(ret, z->lowmem_reserve[idx]);
+	}
+	return ret;
+}
+
 /*
  * This updates the high and low watermarks of amount of free ram in each
  * node used to start and stop prefetching. We prefetch from pages_high * 4
@@ -276,7 +288,7 @@ static void examine_free_limits(void)
 
 		ns = &sp_stat.node[z->zone_pgdat->node_id];
 		idx = zone_idx(z);
-		ns->lowfree[idx] = z->pages_high * 3 + z->lowmem_reserve[idx];
+		ns->lowfree[idx] = z->pages_high * 3 + largest_lowmem_reserve(z);
 		ns->highfree[idx] = ns->lowfree[idx] + z->pages_high;
 
 		if (z->free_pages > ns->highfree[idx]) {

-- 
-ck

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH] mm: swap prefetch fix lowmem reserve calc
  2006-05-18  5:58 [PATCH] mm: swap prefetch fix lowmem reserve calc Con Kolivas
@ 2006-05-18  7:18 ` Nick Piggin
  2006-05-18  7:42   ` [PATCH][respin] " Con Kolivas
  0 siblings, 1 reply; 3+ messages in thread
From: Nick Piggin @ 2006-05-18  7:18 UTC (permalink / raw)
  To: Con Kolivas; +Cc: linux kernel mailing list, ck list, Andrew Morton

Con Kolivas wrote:
> When examining the free limits in swap_prefetch we should ensure the largest
> lowmem_reserve for each zone is free.
> 
> Signed-off-by: Con Kolivas <kernel@kolivas.org>
> 
> ---
>  mm/swap_prefetch.c |   14 +++++++++++++-
>  1 files changed, 13 insertions(+), 1 deletion(-)
> 
> Index: linux-2.6.17-rc4-mm1/mm/swap_prefetch.c
> ===================================================================
> --- linux-2.6.17-rc4-mm1.orig/mm/swap_prefetch.c	2006-05-18 15:48:22.000000000 +1000
> +++ linux-2.6.17-rc4-mm1/mm/swap_prefetch.c	2006-05-18 15:52:42.000000000 +1000
> @@ -258,6 +258,18 @@ static void clear_current_prefetch_free(
>  	}
>  }
>  
> +static inline unsigned long largest_lowmem_reserve(struct zone *z)
> +{
> +	unsigned long ret = 0;
> +	unsigned int idx = zone_idx(z);
> +
> +	while (!is_highmem_idx(idx)) {
> +		idx++;
> +		ret = max(ret, z->lowmem_reserve[idx]);
> +	}
> +	return ret;
> +}
> +
>  /*
>   * This updates the high and low watermarks of amount of free ram in each
>   * node used to start and stop prefetching. We prefetch from pages_high * 4
> @@ -276,7 +288,7 @@ static void examine_free_limits(void)
>  
>  		ns = &sp_stat.node[z->zone_pgdat->node_id];
>  		idx = zone_idx(z);
> -		ns->lowfree[idx] = z->pages_high * 3 + z->lowmem_reserve[idx];
> +		ns->lowfree[idx] = z->pages_high * 3 + largest_lowmem_reserve(z);
>  		ns->highfree[idx] = ns->lowfree[idx] + z->pages_high;

Anonymous memory is GFP_HIGHUSER, yeah? Anything wrong with

-		ns->lowfree[idx] = z->pages_high * 3 + z->lowmem_reserve[idx];
+		ns->lowfree[idx] = z->pages_high * 3 + z->lowmem_reserve[ZONE_HIGHMEM];


-- 
SUSE Labs, Novell Inc.
Send instant messages to your online friends http://au.messenger.yahoo.com 

^ permalink raw reply	[flat|nested] 3+ messages in thread

* [PATCH][respin] mm: swap prefetch fix lowmem reserve calc
  2006-05-18  7:18 ` Nick Piggin
@ 2006-05-18  7:42   ` Con Kolivas
  0 siblings, 0 replies; 3+ messages in thread
From: Con Kolivas @ 2006-05-18  7:42 UTC (permalink / raw)
  To: Nick Piggin; +Cc: linux kernel mailing list, ck list, Andrew Morton

On Thursday 18 May 2006 17:18, Nick Piggin wrote:
> Anonymous memory is GFP_HIGHUSER, yeah? Anything wrong with
>
> -		ns->lowfree[idx] = z->pages_high * 3 + z->lowmem_reserve[idx];
> +		ns->lowfree[idx] = z->pages_high * 3 + z->lowmem_reserve[ZONE_HIGHMEM];

I guess not, thanks!
---

Correct the effect lowmem_reserve has on calculation of free limits
in swap_prefetch.

Signed-off-by: Con Kolivas <kernel@kolivas.org>

---
 mm/swap_prefetch.c |    3 ++-
 1 files changed, 2 insertions(+), 1 deletion(-)

Index: linux-2.6.17-rc4-mm1/mm/swap_prefetch.c
===================================================================
--- linux-2.6.17-rc4-mm1.orig/mm/swap_prefetch.c	2006-05-18 15:48:22.000000000 +1000
+++ linux-2.6.17-rc4-mm1/mm/swap_prefetch.c	2006-05-18 17:24:44.000000000 +1000
@@ -276,7 +276,8 @@ static void examine_free_limits(void)
 
 		ns = &sp_stat.node[z->zone_pgdat->node_id];
 		idx = zone_idx(z);
-		ns->lowfree[idx] = z->pages_high * 3 + z->lowmem_reserve[idx];
+		ns->lowfree[idx] = z->pages_high * 3 +
+			z->lowmem_reserve[ZONE_HIGHMEM];
 		ns->highfree[idx] = ns->lowfree[idx] + z->pages_high;
 
 		if (z->free_pages > ns->highfree[idx]) {

-- 
-ck

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2006-05-18  7:42 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2006-05-18  5:58 [PATCH] mm: swap prefetch fix lowmem reserve calc Con Kolivas
2006-05-18  7:18 ` Nick Piggin
2006-05-18  7:42   ` [PATCH][respin] " Con Kolivas

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox