lkml.org 
[lkml]   [2005]   [Mar]   [7]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [patch 2/5] setup_per_zone_lowmem_reserve() oops fix
On Mon, Mar 07, 2005 at 07:10:05PM +1100, Nick Piggin wrote:
> akpm@osdl.org wrote:
> >If you do 'echo 0 0 > /proc/sys/vm/lowmem_reserve_ratio' the kernel gets a
> >divide-by-zero.
> >
> >Prevent that, and fiddle with some whitespace too.
> >
> >Signed-off-by: Andrew Morton <akpm@osdl.org>
>
> Can we instead have a patch that makes the value zero turn off the
> lowmem reserve entirely if it is set to zero?
>
> Just now I was just testing, and found no easy way to do this other
> than to make the value large enough that the reserve is insignificant.
>
> So the loop would be something like:
>
> for (idx = j-1; idx >= 0; idx--) {
> struct zone *lower_zone;
> lower_zone = pgdat->node_zones + idx;
>
> lower_zone->lowmem_reserve[j] = 0;
> if (sysctl_lowmem_reserve_ratio[idx] > 0)
> lower_zone->lowmem_reserve[j] =
> present_pages /
> sysctl_lowmem_reserve_ratio[idx];
>
> present_pages += lower_zone->present_pages;
> }

Looks good to me. I noticed the divide by zero myself once, and I
also considered changing it so that zero disables it. Could you send a
full patch to Andrew? Thanks.
-
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/

\
 
 \ /
  Last update: 2005-03-22 14:10    [W:1.032 / U:0.032 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site