All of lore.kernel.org
 help / color / mirror / Atom feed
From: Miao Xie <miaox@cn.fujitsu.com>
To: Itaru Kitayama <kitayama@cl.bb4u.ne.jp>
Cc: Chris Mason <chris.mason@oracle.com>,
	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 19:44:06 +0800	[thread overview]
Message-ID: <4D8F2306.6070206@cn.fujitsu.com> (raw)
In-Reply-To: <20110327200910.021b545b.kitayama@cl.bb4u.ne.jp>

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.

Thanks
Miao

> itaru
> 
> --
> To unsubscribe from this list: send the line "unsubscribe linux-btrfs" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html
> 


  reply	other threads:[~2011-03-27 11:44 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 [this message]
2011-03-27 11:42         ` Chris Mason

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=4D8F2306.6070206@cn.fujitsu.com \
    --to=miaox@cn.fujitsu.com \
    --cc=chris.mason@oracle.com \
    --cc=dave@jikos.cz \
    --cc=kitayama@cl.bb4u.ne.jp \
    --cc=linux-btrfs@vger.kernel.org \
    --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 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.