public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Peter Zijlstra <peterz@infradead.org>
To: lkml@pengaru.com
Cc: linux-kernel@vger.kernel.org,
	Wu Fengguang <fengguang.wu@intel.com>, miklos <miklos@szeredi.hu>
Subject: Re: bdi_min_ratio never shrinks, ultimately preventing valid setting of min_ratio
Date: Thu, 02 Jun 2011 23:25:58 +0200	[thread overview]
Message-ID: <1307049958.2497.726.camel@laptop> (raw)
In-Reply-To: <20110602183244.GB5753@shells.gnugeneration.com>

On Thu, 2011-06-02 at 13:32 -0500, lkml@pengaru.com wrote:
> > > There is no place in this listing where the value is decremented by the
> > > respective bdi's min_ratio when a bdi is torn down. 
> > 
> > There is, adding a negative number is equal to a subtraction.
> > 
> >                 min_ratio -= bdi->min_ratio;
> >                 if (bdi_min_ratio + min_ratio < 100) {
> >                         bdi_min_ratio += min_ratio;
> >                         bdi->min_ratio += min_ratio;
> >                 }
> > 
> > is the relevant piece, note that bdi->min_ratio is the current setting,
> > this makes min_ratio the difference between the new and old setting, and
> > adding this to both bdi_min_ratio (the global sum) and bdi->min_ratio
> > dtrt regardless if the new value is larger or smaller than the old
> > value.
> 
> This accounts for the repeated setting of min_ratio on the same bdi.  But
> does bdi_set_min_ratio() get entered with a min_ratio of 0 on bdi removal?
> If not, we leak the non-zero min_ratio of a removed bdi.

That does not appear to be the case, good catch. Would you be bitten by
that particular scenario? If so, does the below cure things for you?

---
 mm/backing-dev.c |    1 +
 1 files changed, 1 insertions(+), 0 deletions(-)

diff --git a/mm/backing-dev.c b/mm/backing-dev.c
index f032e6e..e56fe35 100644
--- a/mm/backing-dev.c
+++ b/mm/backing-dev.c
@@ -606,6 +606,7 @@ static void bdi_prune_sb(struct backing_dev_info *bdi)
 void bdi_unregister(struct backing_dev_info *bdi)
 {
 	if (bdi->dev) {
+		bdi_set_min_ratio(bdi, 0);
 		trace_writeback_bdi_unregister(bdi);
 		bdi_prune_sb(bdi);
 		del_timer_sync(&bdi->wb.wakeup_timer);



  reply	other threads:[~2011-06-02 21:22 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-06-01  0:28 bdi_min_ratio never shrinks, ultimately preventing valid setting of min_ratio lkml
2011-06-02 11:43 ` Peter Zijlstra
2011-06-02 18:32   ` lkml
2011-06-02 21:25     ` Peter Zijlstra [this message]
2011-06-08  0:13       ` Andrew Morton
2011-06-08  9:25         ` Peter Zijlstra
2011-06-08 10:45           ` Peter Zijlstra

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=1307049958.2497.726.camel@laptop \
    --to=peterz@infradead.org \
    --cc=fengguang.wu@intel.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=lkml@pengaru.com \
    --cc=miklos@szeredi.hu \
    /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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox