Re: [patch 2/5] setup_per_zone_lowmem_reserve() oops fix

2005-03-07 Thread Andrea Arcangeli
On Mon, Mar 07, 2005 at 12:20:48AM -0800, Andrew Morton wrote:
> I haven't thought about it yet, but there must be some way to avoid leaving
> huge amounts of lowmem free.  It should be OK to allow lowmem to be fully
> used, as long as there's sufficent reclaimable stuff in there - slab,
> blockdev pagecache, etc.  (Assuming nothing sane mmaps blockdevs.  INND
> does).  Dunno

Then mlock will have to unmap and migrate the cache, it's just much more
complicated, but it's certainly doable.
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [patch 2/5] setup_per_zone_lowmem_reserve() oops fix

2005-03-07 Thread Andrea Arcangeli
On Mon, Mar 07, 2005 at 07:10:05PM +1100, Nick Piggin wrote:
> [EMAIL PROTECTED] 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 <[EMAIL PROTECTED]>
> 
> 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 [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [patch 2/5] setup_per_zone_lowmem_reserve() oops fix

2005-03-07 Thread Andrew Morton
Nick Piggin <[EMAIL PROTECTED]> wrote:
>
> [EMAIL PROTECTED] 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 <[EMAIL PROTECTED]>
> 
> Can we instead have a patch that makes the value zero turn off the
> lowmem reserve entirely if it is set to zero?

That would make sense, I guess.

> 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.

Me too.  I use 1000 to get my 50MB of pagecache back.

I haven't thought about it yet, but there must be some way to avoid leaving
huge amounts of lowmem free.  It should be OK to allow lowmem to be fully
used, as long as there's sufficent reclaimable stuff in there - slab,
blockdev pagecache, etc.  (Assuming nothing sane mmaps blockdevs.  INND
does).  Dunno

-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [patch 2/5] setup_per_zone_lowmem_reserve() oops fix

2005-03-07 Thread Nick Piggin
[EMAIL PROTECTED] 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 <[EMAIL PROTECTED]>
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;
}

-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [patch 2/5] setup_per_zone_lowmem_reserve() oops fix

2005-03-07 Thread Nick Piggin
[EMAIL PROTECTED] 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 [EMAIL PROTECTED]
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;
}

-
To unsubscribe from this list: send the line unsubscribe linux-kernel in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [patch 2/5] setup_per_zone_lowmem_reserve() oops fix

2005-03-07 Thread Andrew Morton
Nick Piggin [EMAIL PROTECTED] wrote:

 [EMAIL PROTECTED] 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 [EMAIL PROTECTED]
 
 Can we instead have a patch that makes the value zero turn off the
 lowmem reserve entirely if it is set to zero?

That would make sense, I guess.

 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.

Me too.  I use 1000 to get my 50MB of pagecache back.

I haven't thought about it yet, but there must be some way to avoid leaving
huge amounts of lowmem free.  It should be OK to allow lowmem to be fully
used, as long as there's sufficent reclaimable stuff in there - slab,
blockdev pagecache, etc.  (Assuming nothing sane mmaps blockdevs.  INND
does).  Dunno

-
To unsubscribe from this list: send the line unsubscribe linux-kernel in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [patch 2/5] setup_per_zone_lowmem_reserve() oops fix

2005-03-07 Thread Andrea Arcangeli
On Mon, Mar 07, 2005 at 07:10:05PM +1100, Nick Piggin wrote:
 [EMAIL PROTECTED] 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 [EMAIL PROTECTED]
 
 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 [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [patch 2/5] setup_per_zone_lowmem_reserve() oops fix

2005-03-07 Thread Andrea Arcangeli
On Mon, Mar 07, 2005 at 12:20:48AM -0800, Andrew Morton wrote:
 I haven't thought about it yet, but there must be some way to avoid leaving
 huge amounts of lowmem free.  It should be OK to allow lowmem to be fully
 used, as long as there's sufficent reclaimable stuff in there - slab,
 blockdev pagecache, etc.  (Assuming nothing sane mmaps blockdevs.  INND
 does).  Dunno

Then mlock will have to unmap and migrate the cache, it's just much more
complicated, but it's certainly doable.
-
To unsubscribe from this list: send the line unsubscribe linux-kernel in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [patch 2/5] setup_per_zone_lowmem_reserve() oops fix

2005-03-06 Thread Greg KH
On Fri, Mar 04, 2005 at 01:16:55PM -0800, [EMAIL PROTECTED] 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.

Due to the whitespace fiddling, I'd say no to this patch, based on the
"criteria".

thanks,

greg k-h
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [patch 2/5] setup_per_zone_lowmem_reserve() oops fix

2005-03-06 Thread Greg KH
On Fri, Mar 04, 2005 at 01:16:55PM -0800, [EMAIL PROTECTED] 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.

Due to the whitespace fiddling, I'd say no to this patch, based on the
criteria.

thanks,

greg k-h
-
To unsubscribe from this list: send the line unsubscribe linux-kernel in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/