linux-btrfs.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Chris Mason <chris.mason@oracle.com>
To: miaox <miaox@cn.fujitsu.com>
Cc: Itaru Kitayama <kitayama@cl.bb4u.ne.jp>,
	Linux Btrfs <linux-btrfs@vger.kernel.org>,
	Ito <t-itoh@jp.fujitsu.com>, David Sterba <dave@jikos.cz>
Subject: Re: [PATCH V5 2/2] btrfs: implement delayed inode items operation
Date: Sun, 27 Mar 2011 07:42:46 -0400	[thread overview]
Message-ID: <1301226036-sup-3753@think> (raw)
In-Reply-To: <4D8F2306.6070206@cn.fujitsu.com>

Excerpts from Miao Xie's message of 2011-03-27 07:44:06 -0400:
> On sun, 27 Mar 2011 20:09:10 +0900, Itaru Kitayama wrote:
> > Hi Miao,
> > 
> > On Sun, 27 Mar 2011 15:00:00 +0800
> > Miao Xie <miaox@cn.fujitsu.com> wrote:
> > 
> >> I got it. It is because the allocation flag of the metadata's page cache, which is stored in
> >> the btree inode's i_mapping, was set to be GFP_HIGHUSER_MOVABLE. So if we allocate pages for
> >> btree's page cache, this lockdep warning will be triggered.
> >>
> >> I think even without my patch, this lockdep warning can also be triggered, btrfs_evict_inode()
> >> do the similar operations like what I do in the btrfs_destroy_inode(). 
> >>   Task1                    Kswap0 task
> >>   open()
> >>     ...
> >>     btrfs_search_slot()
> >>       ...
> >>       btrfs_cow_block()
> >>     ...
> >>     alloc_page()
> >>       wait for reclaiming
> >>                     shrink_slab()
> >>                       ...
> >>                       shrink_icache_memory()
> >>                         ...
> >>                         btrfs_evict_inode()
> >>                           ...
> >>                           btrfs_search_slot()
> >>
> >> If the path is locked by task1, the deadlock happens.
> > 
> > Ok. balance_pgdat() calls shrink_slab() with GFP_KERNEL so it's still possible for the kswapd0 
> > to call prune_icache(), no? I still see the lockdep warning even with your patch that clears
> > __GFP_FS in open_ctree().
> 
> sorry for my mistake. The above explanation is wrong, it has no business with kswap thread.
> The correct explanation is
> 
>    Task1
>    open()
>      ...
>      btrfs_search_slot()
>        ...
>        btrfs_cow_block()
>      ...
>      alloc_page()
>        do_try_to_free_pages()
>          shrink_slab()
>            ...
>            shrink_icache_memory()
>          ...
>          btrfs_evict_inode()
>            ...
>            btrfs_search_slot()
> 
> If the path is locked by task1, the deadlock happens.
> 
> So balance_pgdat() is impossible to trigger the lockdep.
> (My clearing __GFP_FS patch's changelog is also wrong.)
> 
> I see, except btree's page cache, free space cache's page cache is also special,
> can not use __GFP_FS flag.

Ok, I've got your first patch already, I'll add a hunk for the free
space cache too.  Most of the allocations we're doing are explicitly
with GFP_NOFS, so it is just supporting allocations and readahead that
should be causing trouble.

Thanks!

-chris

      reply	other threads:[~2011-03-27 11:42 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-03-24 11:41 [PATCH V5 2/2] btrfs: implement delayed inode items operation Miao Xie
2011-03-24 23:55 ` David Sterba
2011-03-26 23:58 ` Chris Mason
2011-03-27  5:30 ` Itaru Kitayama
2011-03-27  7:00   ` Miao Xie
2011-03-27 11:09     ` Itaru Kitayama
2011-03-27 11:44       ` Miao Xie
2011-03-27 11:42         ` Chris Mason [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=1301226036-sup-3753@think \
    --to=chris.mason@oracle.com \
    --cc=dave@jikos.cz \
    --cc=kitayama@cl.bb4u.ne.jp \
    --cc=linux-btrfs@vger.kernel.org \
    --cc=miaox@cn.fujitsu.com \
    --cc=t-itoh@jp.fujitsu.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).