Messages in this thread Patch in this message | | | From | Con Kolivas <> | Subject | [PATCH] mm: swap prefetch fix lowmem reserve calc | Date | Thu, 18 May 2006 15:58:57 +1000 |
| |
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 - To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
| |