All of lore.kernel.org
 help / color / mirror / Atom feed
From: Andrew Morton <akpm@linux-foundation.org>
To: Miklos Szeredi <miklos@szeredi.hu>
Cc: linux-kernel@vger.kernel.org, linux-mm@kvack.org
Subject: Re: dirty balancing deadlock
Date: Sun, 18 Feb 2007 14:59:29 -0800	[thread overview]
Message-ID: <20070218145929.547c21c7.akpm@linux-foundation.org> (raw)
In-Reply-To: <E1HIurG-0005Bw-00@dorka.pomaz.szeredi.hu>

On Sun, 18 Feb 2007 23:50:14 +0100 Miklos Szeredi <miklos@szeredi.hu> wrote:

> > > I was testing the new fuse shared writable mmap support, and finding
> > > that bash-shared-mapping deadlocks (which isn't so strange ;).  What
> > > is more strange is that this is not an OOM situation at all, with
> > > plenty of free and cached pages.
> > > 
> > > A little more investigation shows that a similar deadlock happens
> > > reliably with bash-shared-mapping on a loopback mount, even if only
> > > half the total memory is used.
> > > 
> > > The cause is slightly different in the two cases:
> > > 
> > >   - loopback mount: allocation by the underlying filesystem is stalled
> > >     on throttle_vm_writeout()
> > > 
> > >   - fuse-loop: page dirtying on the underlying filesystem is stalled on
> > >     balance_dirty_pages()
> > > 
> > > In both cases the underlying fs is totally innocent, with no
> > > dirty/writback pages, yet it's waiting for the global dirty+writeback
> > > to go below the threshold, which obviously won't, until the
> > > allocation/dirtying succeeds.
> > > 
> > > I'm not quite sure what the solution is, and asking for thoughts.
> > 
> > But....  these things don't just throttle.  They also perform large amounts
> > of writeback, which causes the dirty levels to subside.
> > 
> > >From your description it appears that this writeback isn't happening, or
> > isn't working.  How come?
> 
>  - filesystems A and B
>  - write to A will end up as write to B
>  - dirty pages in A manage to go over dirty_threshold
>  - page writeback is started from A
>  - this triggers writeback for a couple of pages in B
>  - writeback finishes normally, but dirty+writeback pages are still
>    over threshold
>  - balance_dirty_pages in B gets stuck, nothing ever moves after this
> 
> At least this is my theory for what happens.
> 

Is B a real filesystem?  If so, writes to B will decrease the dirty memory
threshold.

The writeout code _should_ just sit there transferring dirtyiness from A to
B and cleaning pages via B, looping around, alternating between both.

What does sysrq-t say?

WARNING: multiple messages have this Message-ID (diff)
From: Andrew Morton <akpm@linux-foundation.org>
To: Miklos Szeredi <miklos@szeredi.hu>
Cc: linux-kernel@vger.kernel.org, linux-mm@kvack.org
Subject: Re: dirty balancing deadlock
Date: Sun, 18 Feb 2007 14:59:29 -0800	[thread overview]
Message-ID: <20070218145929.547c21c7.akpm@linux-foundation.org> (raw)
In-Reply-To: <E1HIurG-0005Bw-00@dorka.pomaz.szeredi.hu>

On Sun, 18 Feb 2007 23:50:14 +0100 Miklos Szeredi <miklos@szeredi.hu> wrote:

> > > I was testing the new fuse shared writable mmap support, and finding
> > > that bash-shared-mapping deadlocks (which isn't so strange ;).  What
> > > is more strange is that this is not an OOM situation at all, with
> > > plenty of free and cached pages.
> > > 
> > > A little more investigation shows that a similar deadlock happens
> > > reliably with bash-shared-mapping on a loopback mount, even if only
> > > half the total memory is used.
> > > 
> > > The cause is slightly different in the two cases:
> > > 
> > >   - loopback mount: allocation by the underlying filesystem is stalled
> > >     on throttle_vm_writeout()
> > > 
> > >   - fuse-loop: page dirtying on the underlying filesystem is stalled on
> > >     balance_dirty_pages()
> > > 
> > > In both cases the underlying fs is totally innocent, with no
> > > dirty/writback pages, yet it's waiting for the global dirty+writeback
> > > to go below the threshold, which obviously won't, until the
> > > allocation/dirtying succeeds.
> > > 
> > > I'm not quite sure what the solution is, and asking for thoughts.
> > 
> > But....  these things don't just throttle.  They also perform large amounts
> > of writeback, which causes the dirty levels to subside.
> > 
> > >From your description it appears that this writeback isn't happening, or
> > isn't working.  How come?
> 
>  - filesystems A and B
>  - write to A will end up as write to B
>  - dirty pages in A manage to go over dirty_threshold
>  - page writeback is started from A
>  - this triggers writeback for a couple of pages in B
>  - writeback finishes normally, but dirty+writeback pages are still
>    over threshold
>  - balance_dirty_pages in B gets stuck, nothing ever moves after this
> 
> At least this is my theory for what happens.
> 

Is B a real filesystem?  If so, writes to B will decrease the dirty memory
threshold.

The writeout code _should_ just sit there transferring dirtyiness from A to
B and cleaning pages via B, looping around, alternating between both.

What does sysrq-t say?

--
To unsubscribe, send a message with 'unsubscribe linux-mm' in
the body to majordomo@kvack.org.  For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"dont@kvack.org"> email@kvack.org </a>

  reply	other threads:[~2007-02-18 22:59 UTC|newest]

Thread overview: 52+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-02-18 18:28 dirty balancing deadlock Miklos Szeredi
2007-02-18 18:28 ` Miklos Szeredi
2007-02-18 20:53 ` Andrew Morton
2007-02-18 20:53   ` Andrew Morton
2007-02-18 21:25   ` Rik van Riel
2007-02-18 21:25     ` Rik van Riel
2007-02-18 22:54     ` Miklos Szeredi
2007-02-18 22:54       ` Miklos Szeredi
2007-02-18 22:50   ` Miklos Szeredi
2007-02-18 22:50     ` Miklos Szeredi
2007-02-18 22:59     ` Andrew Morton [this message]
2007-02-18 22:59       ` Andrew Morton
2007-02-18 23:22       ` Miklos Szeredi
2007-02-18 23:22         ` Miklos Szeredi
2007-02-18 23:59         ` Andrew Morton
2007-02-18 23:59           ` Andrew Morton
2007-02-19  0:25           ` Miklos Szeredi
2007-02-19  0:25             ` Miklos Szeredi
2007-02-19  0:30             ` Miklos Szeredi
2007-02-19  0:30               ` Miklos Szeredi
2007-02-19  0:45             ` Miklos Szeredi
2007-02-19  0:45               ` Miklos Szeredi
2007-02-19  0:45             ` Chris Mason
2007-02-19  0:45               ` Chris Mason
2007-02-19  0:54               ` Miklos Szeredi
2007-02-19  0:54                 ` Miklos Szeredi
2007-02-19  1:01                 ` Chris Mason
2007-02-19  1:01                   ` Chris Mason
2007-02-19  1:14                   ` Miklos Szeredi
2007-02-19  1:14                     ` Miklos Szeredi
2007-02-20  0:16                     ` Chris Mason
2007-02-20  0:16                       ` Chris Mason
2007-02-20  8:53                       ` Miklos Szeredi
2007-02-20  8:53                         ` Miklos Szeredi
2007-02-19 17:11           ` Miklos Szeredi
2007-02-19 17:11             ` Miklos Szeredi
2007-02-19 23:12             ` Miklos Szeredi
2007-02-19 23:12               ` Miklos Szeredi
2007-02-20  0:13             ` Chris Mason
2007-02-20  0:13               ` Chris Mason
2007-02-20  8:47               ` Miklos Szeredi
2007-02-20  8:47                 ` Miklos Szeredi
2007-02-20 11:30                 ` Chris Mason
2007-02-20 11:30                   ` Chris Mason
2007-02-21 21:36             ` Andrew Morton
2007-02-21 21:36               ` Andrew Morton
2007-02-22  7:42               ` Miklos Szeredi
2007-02-22  7:42                 ` Miklos Szeredi
2007-02-22  7:55                 ` Andrew Morton
2007-02-22  7:55                   ` Andrew Morton
2007-02-22  8:02                   ` Miklos Szeredi
2007-02-22  8:02                     ` Miklos Szeredi

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=20070218145929.547c21c7.akpm@linux-foundation.org \
    --to=akpm@linux-foundation.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mm@kvack.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.