All of lore.kernel.org
 help / color / mirror / Atom feed
From: Andrea Righi <righi.andrea@gmail.com>
To: David Rientjes <rientjes@google.com>
Cc: akpm@linux-foundation.org, Peter Zijlstra <peterz@infradead.org>,
	Dave Chinner <david@fromorbit.com>,
	Christoph Lameter <cl@linux-foundation.org>,
	linux-kernel@vger.kernel.org
Subject: Re: [PATCH] mm: prevent divide error for small values of vm_dirty_bytes
Date: Wed, 29 Apr 2009 11:40:44 +0200	[thread overview]
Message-ID: <20090429094043.GC3151@linux> (raw)
In-Reply-To: <alpine.DEB.2.00.0904290224260.31490@chino.kir.corp.google.com>

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

      reply	other threads:[~2009-04-29  9:41 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-04-29  8:29 [PATCH] mm: prevent divide error for small values of vm_dirty_bytes Andrea Righi
2009-04-29  8:44 ` Peter Zijlstra
2009-04-29  9:34   ` Andrea Righi
2009-04-29 20:02     ` David Rientjes
2009-04-29 21:46     ` Andrew Morton
2009-05-01 14:56       ` Andrea Righi
2009-05-01 19:53         ` Andrew Morton
2009-04-29  9:26 ` David Rientjes
2009-04-29  9:40   ` Andrea Righi [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20090429094043.GC3151@linux \
    --to=righi.andrea@gmail.com \
    --cc=akpm@linux-foundation.org \
    --cc=cl@linux-foundation.org \
    --cc=david@fromorbit.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=peterz@infradead.org \
    --cc=rientjes@google.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.