lkml.org 
[lkml]   [2009]   [Apr]   [29]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [PATCH] mm: prevent divide error for small values of vm_dirty_bytes
On Wed, 29 Apr 2009, Andrea Righi wrote:

> On Wed, Apr 29, 2009 at 10:44:36AM +0200, Peter Zijlstra wrote:
> > On Wed, 2009-04-29 at 10:29 +0200, Andrea Righi wrote:
> > > Avoid to set less than two pages for vm_dirty_byte: this is necessary to avoid
> > > potential division by 0 (like the following) in get_dirty_limits().
> >
> > isn't changing the .extra1 in the sysctl table a better fix?
>
> I thought about that and probably you're right. But, in the first case
> if the user writes a value < 2*PAGE_SIZE vm_dirty_bytes is explicitly
> set to 2*PAGE_SIZE. In the other case the value is just ignored.
>
> Maybe the second case could generate some unexpected behaviours for
> the user. For example, the user writes X < 2*PAGE_SIZE to
> /proc/sys/vm/dirty_bytes, and could think that the system has started to
> use this new configuration, but it isn't actually.
>
> So, probably the best way is to change .extra1 and add a note in the
> documentation (see below).
>

This is only caused by bdi, not by the dirty ratio itself; shouldn't the
appropriate fix be in calc_period_shift()? In other words, allow
dirty thresholds to be less than 2 * PAGE_SIZE but prevent the bdi
fraction from having a zero denominator?


\
 
 \ /
  Last update: 2009-04-29 22:05    [W:0.096 / U:0.208 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site