public inbox for linux-btrfs@vger.kernel.org
 help / color / mirror / Atom feed
From: Qu Wenruo <quwenruo.btrfs@gmx.com>
To: ChenXiaoSong <chenxiaosong2@huawei.com>,
	clm@fb.com, josef@toxicpanda.com, dsterba@suse.com
Cc: linux-btrfs@vger.kernel.org, linux-kernel@vger.kernel.org,
	zhangxiaoxu5@huawei.com, yanaijie@huawei.com, wqu@suse.com
Subject: Re: [PATCH v4 1/3] btrfs: add might_sleep() to some places in update_qgroup_limit_item()
Date: Wed, 16 Nov 2022 16:43:50 +0800	[thread overview]
Message-ID: <3918175e-dddd-2a55-32c4-c07de78ff4cb@gmx.com> (raw)
In-Reply-To: <e058c1b9-7f57-11da-6ad1-6387604813c5@huawei.com>



On 2022/11/16 16:09, ChenXiaoSong wrote:
> 在 2022/11/16 6:48, Qu Wenruo 写道:
>> Looks good.
>>
>> We may want to add more in other locations, but this is really a good 
>> start.
>>
>> Reviewed-by: Qu Wenruo <wqu@suse.com>
>>
>> Thanks,
>> Qu
> 
> If I just add might_sleep() in btrfs_alloc_path() and 
> btrfs_search_slot(), is it reasonable?

Adding it to btrfs_search_slot() is definitely correct.

But why for btrfs_alloc_path()? Wouldn't kmem_cache_zalloc() itself 
already do the might_sleep_if() somewhere?

I just looked the call chain, and indeed it is doing the check already:

btrfs_alloc_path()
|- kmem_cache_zalloc()
    |- kmem_cache_alloc()
       |- __kmem_cache_alloc_lru()
          |- slab_alloc()
             |- slab_alloc_node()
                |- slab_pre_alloc_hook()
                   |- might_alloc()
                      |- might_sleep_if()

Thanks,
Qu

> 
> Or just add might_sleep() to one place in update_qgroup_limit_item() ?

  reply	other threads:[~2022-11-16  8:44 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-11-15 17:17 [PATCH v4 0/3] btrfs: fix sleep from invalid context bug in update_qgroup_limit_item() ChenXiaoSong
2022-11-15 17:17 ` [PATCH v4 1/3] btrfs: add might_sleep() to some places " ChenXiaoSong
2022-11-15 17:41   ` David Sterba
2022-11-15 22:48   ` Qu Wenruo
2022-11-16  8:09     ` ChenXiaoSong
2022-11-16  8:43       ` Qu Wenruo [this message]
2022-11-16 12:24         ` David Sterba
2022-11-16 12:26           ` Qu Wenruo
2022-11-15 17:17 ` [PATCH v4 2/3] btrfs: qgroup: introduce btrfs_update_quoto_limit() helper ChenXiaoSong
2022-11-15 17:33   ` David Sterba
2022-11-15 17:17 ` [PATCH v4 3/3] btrfs: qgroup: fix sleep from invalid context bug in update_qgroup_limit_item() ChenXiaoSong
2022-11-15 16:22   ` ChenXiaoSong
2022-11-15 22:50   ` Qu Wenruo

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=3918175e-dddd-2a55-32c4-c07de78ff4cb@gmx.com \
    --to=quwenruo.btrfs@gmx.com \
    --cc=chenxiaosong2@huawei.com \
    --cc=clm@fb.com \
    --cc=dsterba@suse.com \
    --cc=josef@toxicpanda.com \
    --cc=linux-btrfs@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=wqu@suse.com \
    --cc=yanaijie@huawei.com \
    --cc=zhangxiaoxu5@huawei.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