public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Andrew Morton <akpm@linux-foundation.org>
To: Miklos Szeredi <miklos@szeredi.hu>
Cc: dgc@sgi.com, linux-kernel@vger.kernel.org
Subject: Re: [patch 1/3] fix illogical behavior in balance_dirty_pages()
Date: Mon, 26 Mar 2007 01:32:26 -0800	[thread overview]
Message-ID: <20070326013226.786e5b4e.akpm@linux-foundation.org> (raw)
In-Reply-To: <E1HVlN5-00016C-00@dorka.pomaz.szeredi.hu>

On Mon, 26 Mar 2007 11:20:11 +0200 Miklos Szeredi <miklos@szeredi.hu> wrote:

> > > > > It also makes a deadlock possible when one filesystem is writing data
> > > > > through another, and the balance_dirty_pages() for the lower
> > > > > filesystem is stalling the writeback for the upper filesystem's
> > > > > data (*).
> > > > 
> > > > I still don't understand this one.  I got lost when belatedly told that
> > > > i_mutex had something to do with it.
> > > 
> > > This deadlock only happens, if there's some bottleneck for writing
> > > data to the lower filesystem.   This bottleneck could be 
> > > 
> > >   - i_mutex, preventing parallel writes to the same inode
> > >   - limited number of filesystem threads
> > >   - limited request queue length in the upper filesystem
> > > 
> > > Imagine it this way: balance_dirty_pages() for the lower filesystem is
> > > stalling a write() because dirty pages in the upper filesystem are
> > > over the limit.  Because there's a bottleneck for writing to the lower
> > > filesystem, this is stalling _other_ writes from completing.  So
> > > there's no progress in writing back pages from the upper filesystem.
> > 
> > You mean that someone is stuck in balance_dirty_pages() against the lower
> > fs while holding locks which prevent writes into the upper fs from
> > succeeding?
> > 
> > Draw us a picture ;)
> 
> Well, not a picture, but a sort of indented call trace:
> 
>   [some process, which has a fuse file writably mmaped]
>   write fault on upper filesystem
>     balance_dirty_pages
>       loop...
>         submit write requests

This, I assume, is the upper fs

>   ---------------------------------
>   [fuse loopback fs thread 1]
>   read request from /dev/fuse
>   sys_write
>     mutex_lock(i_mutex)
>     ...
>        copy data to page cache
>        balance_dirty_pages
>           loop ...
>                 submit write requests
>                 write requests completed ...
>                 dirty still over limit ...
>            ... loop forever
> 
>   [fuse loopback fs thread 2]
>   read request from /dev/fuse
>   sys_write
>     mute_lock(i_mutex) blocks

And these, I assume, are handling what you term the lower fs.

> 
> The lower filesystem (e.g. ext3) has completed the single write
> request that was sent to it, and then it's just looping in
> balance_dirty_pages.  The upper (fuse) filesystem has all the dirty
> data (over the threshold), either still dirty or waiting in the
> request queue as writeback.
> 
> Does this help?

yup.

Interesting problem.  I don't suppose that it'd be appreiated if I were to
commend the use of O_DIRECT for handling the lower fs ;)

Let me think about that a bit, after I've made the latest shitpile people
have inflicted upon me begin to look like it has a chance of compiling.


  reply	other threads:[~2007-03-26  9:32 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
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 [this message]
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=20070326013226.786e5b4e.akpm@linux-foundation.org \
    --to=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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox