linux-btrfs.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Anand Jain <anand.jain@oracle.com>
To: dsterba@suse.cz
Cc: David Sterba <dsterba@suse.com>, linux-btrfs@vger.kernel.org
Subject: Re: [PATCH 3/4] btrfs: switch GFP_NOFS to GFP_KERNEL in scrub_setup_recheck_block
Date: Fri, 21 Oct 2022 10:34:07 +0800	[thread overview]
Message-ID: <ccd4f8c7-8897-838c-1bb3-9837567d2d57@oracle.com> (raw)
In-Reply-To: <20221020163511.GM13389@twin.jikos.cz>



On 21/10/2022 00:35, David Sterba wrote:
> On Thu, Oct 20, 2022 at 03:27:31PM +0800, Anand Jain wrote:
>> On 18/10/2022 22:27, David Sterba wrote:
>>> There's only one caller that calls scrub_setup_recheck_block in the
>>> memalloc_nofs_save/_restore protection so it's effectively already
>>> GFP_NOFS and it's safe to use GFP_KERNEL.
>>>
>>> Signed-off-by: David Sterba <dsterba@suse.com>
>>> ---
>>>    fs/btrfs/scrub.c | 4 ++--
>>>    1 file changed, 2 insertions(+), 2 deletions(-)
>>>
>>> diff --git a/fs/btrfs/scrub.c b/fs/btrfs/scrub.c
>>> index 9e3b2e60e571..2fc70a2cc7fe 100644
>>> --- a/fs/btrfs/scrub.c
>>> +++ b/fs/btrfs/scrub.c
>>> @@ -1491,7 +1491,7 @@ static int scrub_setup_recheck_block(struct scrub_block *original_sblock,
>>>    			return -EIO;
>>>    		}
>>>    
>>> -		recover = kzalloc(sizeof(struct scrub_recover), GFP_NOFS);
>>> +		recover = kzalloc(sizeof(struct scrub_recover), GFP_KERNEL);
>>
>>
>> I didn't get why GFP_KERNEL is better here, or would it make any
>> difference, given that we are already (and rightly) in the
>> memalloc_nofs_save() scope.
> 
> You said what's the reason, so I can only repeat the patterns:
> 
> 1) plain GFP_NOFS, with notice that it does not work with kvalloc
> 2) memalloc_nofs_save/k.alloc(GFP_KERNEL)/memalloc_nofs_restore
> 
> I.e. GFP_NOFS in the memalloc_nofs_ protection is redundant because we
> get th NOFS protection and can safely use GFP_KERNEL. 



> Because we want to
> minimize use of GFP_NOFS or completely switch to scoped nofs, but this
> requires other changes and we do that incrementally.

  Ok. Got it.

  reply	other threads:[~2022-10-21  2:34 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-10-18 14:27 [PATCH 0/4] Parameter cleanup David Sterba
2022-10-18 14:27 ` [PATCH 1/4] btrfs: sink gfp_t parameter to btrfs_backref_iter_alloc David Sterba
2022-10-20  5:56   ` Anand Jain
2022-10-18 14:27 ` [PATCH 2/4] btrfs: sink gfp_t parameter to btrfs_qgroup_trace_extent David Sterba
2022-10-20  6:01   ` Anand Jain
2022-10-20 16:39     ` David Sterba
2022-10-18 14:27 ` [PATCH 3/4] btrfs: switch GFP_NOFS to GFP_KERNEL in scrub_setup_recheck_block David Sterba
2022-10-20  7:27   ` Anand Jain
2022-10-20 16:35     ` David Sterba
2022-10-21  2:34       ` Anand Jain [this message]
2022-10-18 14:27 ` [PATCH 4/4] btrfs: sink gfp_t parameter to alloc_scrub_sector David Sterba
2022-10-20  7:30   ` Anand Jain
2022-10-19 10:28 ` [PATCH 0/4] Parameter cleanup Johannes Thumshirn
2022-10-19 15:16   ` David Sterba
2022-10-19 15:23     ` Johannes Thumshirn
2022-10-19 16:05       ` David Sterba

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=ccd4f8c7-8897-838c-1bb3-9837567d2d57@oracle.com \
    --to=anand.jain@oracle.com \
    --cc=dsterba@suse.com \
    --cc=dsterba@suse.cz \
    --cc=linux-btrfs@vger.kernel.org \
    /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).