From: Peter Zijlstra <a.p.zijlstra@chello.nl>
To: Miklos Szeredi <miklos@szeredi.hu>
Cc: akpm@linux-foundation.org, dgc@sgi.com, linux-kernel@vger.kernel.org
Subject: Re: [patch 1/3] fix illogical behavior in balance_dirty_pages()
Date: Sun, 25 Mar 2007 13:50:54 +0200 [thread overview]
Message-ID: <1174823454.5149.13.camel@lappy> (raw)
In-Reply-To: <E1HVQzy-0007jO-00@dorka.pomaz.szeredi.hu>
On Sun, 2007-03-25 at 13:34 +0200, Miklos Szeredi wrote:
> > >
> > > Please have a look at this:
> > > http://lkml.org/lkml/2007/3/19/220
> >
> >
> >
> > > + if (bdi_nr_reclaimable + bdi_stat(bdi, BDI_WRITEBACK) <=
> > > + bdi_thresh)
> > > + break;
> > >
> >
> > Yes, this will resolve the deadlock as well, where balance_dirty_pages()
> > is currently looping forever with:
>
> Almost.
>
> This
>
> > - if (nr_reclaimable) {
> > + if (bdi_nr_reclaimable) {
> > writeback_inodes(&wbc);
>
> still makes it loop forever if bdi_nr_reclaimable == 0, since the exit
> condition is not checked.
>
> Shouldn't it break out of the loop if bdi_stat(bdi, BDI_WRITEBACK) <=
> bdi_thresh in this case?
for (;;) {
struct writeback_control wbc = {
.bdi = bdi,
.sync_mode = WB_SYNC_NONE,
.older_than_this = NULL,
.nr_to_write = write_chunk,
.range_cyclic = 1,
};
get_dirty_limits(&background_thresh, &dirty_thresh,
&bdi_thresh, bdi);
bdi_nr_reclaimable = bdi_stat(bdi, BDI_DIRTY) +
bdi_stat(bdi, BDI_UNSTABLE);
(A) if (bdi_nr_reclaimable + bdi_stat(bdi, BDI_WRITEBACK) <=
bdi_thresh)
break;
/* Note: nr_reclaimable denotes nr_dirty + nr_unstable.
* Unstable writes are a feature of certain networked
* filesystems (i.e. NFS) in which data may have been
* written to the server's write cache, but has not yet
* been flushed to permanent storage.
*/
(B) if (bdi_nr_reclaimable) {
writeback_inodes(&wbc);
get_dirty_limits(&background_thresh, &dirty_thresh,
&bdi_thresh, bdi);
bdi_nr_reclaimable = bdi_stat(bdi, BDI_DIRTY) +
bdi_stat(bdi, BDI_UNSTABLE);
(C) if (bdi_nr_reclaimable + bdi_stat(bdi, BDI_WRITEBACK) <=
bdi_thresh)
break;
pages_written += write_chunk - wbc.nr_to_write;
if (pages_written >= write_chunk)
break; /* We've done our duty */
}
congestion_wait(WRITE, HZ/10);
}
I'm thinking that if bdi_nr_reclaimable == 0, A reduces to
bdi_stat(bdi, BDI_WRITEBACK) <= bdi_thresh and we're still out of the
loop, no?
next prev parent reply other threads:[~2007-03-25 11:51 UTC|newest]
Thread overview: 22+ messages / expand[flat|nested] mbox.gz Atom feed top
2007-03-24 21:55 [patch 1/3] fix illogical behavior in balance_dirty_pages() Miklos Szeredi
2007-03-24 21:57 ` [patch 2/3] remove throttle_vm_writeout() Miklos Szeredi
2007-03-25 23:41 ` Andrew Morton
2007-03-26 8:35 ` Miklos Szeredi
2007-03-24 21:58 ` [patch 3/3] balance dirty pages from loop device Miklos Szeredi
2007-03-25 10:03 ` [patch 1/3] fix illogical behavior in balance_dirty_pages() Peter Zijlstra
2007-03-25 11:12 ` Miklos Szeredi
2007-03-25 11:34 ` Miklos Szeredi
2007-03-25 11:50 ` Peter Zijlstra [this message]
2007-03-25 20:41 ` Miklos Szeredi
2007-03-25 23:35 ` Andrew Morton
2007-03-26 8:26 ` Miklos Szeredi
2007-03-26 9:01 ` Andrew Morton
2007-03-26 9:20 ` Miklos Szeredi
2007-03-26 9:32 ` Andrew Morton
2007-03-26 9:48 ` Miklos Szeredi
2007-03-26 9:32 ` Miklos Szeredi
2007-03-26 10:08 ` Andrew Morton
2007-03-26 13:30 ` Peter Zijlstra
2007-03-27 0:30 ` David Chinner
2007-03-27 0:23 ` David Chinner
-- strict thread matches above, loose matches on Subject: below --
2007-04-03 18:40 Kris Corwin
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=1174823454.5149.13.camel@lappy \
--to=a.p.zijlstra@chello.nl \
--cc=akpm@linux-foundation.org \
--cc=dgc@sgi.com \
--cc=linux-kernel@vger.kernel.org \
--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 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.