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, Apr 29, 2009 at 02:26:11AM -0700, David Rientjes wrote:
> On Wed, 29 Apr 2009, 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().
> >
>
> Where exactly is the divide by 0 in get_dirty_limits()?

in the evaluation of the BDI's share ratio:
...
if (bdi) {
u64 bdi_dirty;
long numerator, denominator;
/*
* Calculate this BDI's share of the dirty ratio.
*/
bdi_writeout_fraction(bdi, &numerator, &denominator);
bdi_dirty = (dirty * (100 - bdi_min_ratio)) / 100;
bdi_dirty *= numerator;
do_div(bdi_dirty, denominator);
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
...
More exactly:
/home/righiandr/Software/linux/git/linux-2.6/mm/page-writeback.c:474
1186: 48 89 f0 mov %rsi,%rax
1189: 48 f7 f7 div %rdi

And looking at the trace:

[ 49.952195] RAX: 00000000000000c0 RBX: ffff88001de03b80 RCX: 28f5c28f5c28f5c3
[ 49.952195] RDX: 0000000000000000 RSI: 00000000000000c0 RDI: 0000000000000000
^^^^^^^^^^^^^^^^^^^^^
> Is this because we forced the background threshold to be half of the dirty
> threshold when its setting is greater?

No (see above).

-Andrea


\
 
 \ /
  Last update: 2009-04-29 11:43    [from the cache]
©2003-2011 Jasper Spaans