Linux RAID subsystem development
 help / color / mirror / Atom feed
From: Jan Kara <jack@suse.cz>
To: Michal Hocko <mhocko@kernel.org>
Cc: linux-fsdevel@vger.kernel.org, linux-raid@vger.kernel.org,
	linux-kernel@vger.kernel.org, Song Liu <song@kernel.org>,
	Yu Kuai <yukuai3@huawei.com>,
	Alexander Viro <viro@zeniv.linux.org.uk>,
	Christian Brauner <brauner@kernel.org>, Jan Kara <jack@suse.cz>,
	Michal Hocko <mhocko@suse.com>
Subject: Re: [PATCH] fs: drop GFP_NOFAIL mode from alloc_page_buffers
Date: Thu, 29 Aug 2024 21:17:46 +0200	[thread overview]
Message-ID: <20240829191746.tsrojxj3kntt4jhp@quack3> (raw)
In-Reply-To: <20240829130640.1397970-1-mhocko@kernel.org>

On Thu 29-08-24 15:06:40, Michal Hocko wrote:
> From: Michal Hocko <mhocko@suse.com>
> 
> There is only one called of alloc_page_buffers and it doesn't require
> __GFP_NOFAIL so drop this allocation mode.
> 
> Signed-off-by: Michal Hocko <mhocko@suse.com>

Looks good. Feel free to add:

Reviewed-by: Jan Kara <jack@suse.cz>

Although even better fix would be to convert the last remaining caller of
alloc_page_buffers() to folio_alloc_buffers()... But that may be more
difficult.

								Honza


> ---
>  drivers/md/md-bitmap.c      | 2 +-
>  fs/buffer.c                 | 5 +----
>  include/linux/buffer_head.h | 3 +--
>  3 files changed, 3 insertions(+), 7 deletions(-)
> 
> while looking at GFP_NOFAIL users I have encountered this left over.
> 
> diff --git a/drivers/md/md-bitmap.c b/drivers/md/md-bitmap.c
> index 08232d8dc815..db5330d97348 100644
> --- a/drivers/md/md-bitmap.c
> +++ b/drivers/md/md-bitmap.c
> @@ -360,7 +360,7 @@ static int read_file_page(struct file *file, unsigned long index,
>  	pr_debug("read bitmap file (%dB @ %llu)\n", (int)PAGE_SIZE,
>  		 (unsigned long long)index << PAGE_SHIFT);
>  
> -	bh = alloc_page_buffers(page, blocksize, false);
> +	bh = alloc_page_buffers(page, blocksize);
>  	if (!bh) {
>  		ret = -ENOMEM;
>  		goto out;
> diff --git a/fs/buffer.c b/fs/buffer.c
> index e55ad471c530..f1381686d325 100644
> --- a/fs/buffer.c
> +++ b/fs/buffer.c
> @@ -958,12 +958,9 @@ struct buffer_head *folio_alloc_buffers(struct folio *folio, unsigned long size,
>  }
>  EXPORT_SYMBOL_GPL(folio_alloc_buffers);
>  
> -struct buffer_head *alloc_page_buffers(struct page *page, unsigned long size,
> -				       bool retry)
> +struct buffer_head *alloc_page_buffers(struct page *page, unsigned long size)
>  {
>  	gfp_t gfp = GFP_NOFS | __GFP_ACCOUNT;
> -	if (retry)
> -		gfp |= __GFP_NOFAIL;
>  
>  	return folio_alloc_buffers(page_folio(page), size, gfp);
>  }
> diff --git a/include/linux/buffer_head.h b/include/linux/buffer_head.h
> index 14acf1bbe0ce..7e903457967a 100644
> --- a/include/linux/buffer_head.h
> +++ b/include/linux/buffer_head.h
> @@ -199,8 +199,7 @@ void folio_set_bh(struct buffer_head *bh, struct folio *folio,
>  		  unsigned long offset);
>  struct buffer_head *folio_alloc_buffers(struct folio *folio, unsigned long size,
>  					gfp_t gfp);
> -struct buffer_head *alloc_page_buffers(struct page *page, unsigned long size,
> -		bool retry);
> +struct buffer_head *alloc_page_buffers(struct page *page, unsigned long size);
>  struct buffer_head *create_empty_buffers(struct folio *folio,
>  		unsigned long blocksize, unsigned long b_state);
>  void end_buffer_read_sync(struct buffer_head *bh, int uptodate);
> -- 
> 2.46.0
> 
-- 
Jan Kara <jack@suse.com>
SUSE Labs, CR

  parent reply	other threads:[~2024-08-29 19:17 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-08-29 13:06 [PATCH] fs: drop GFP_NOFAIL mode from alloc_page_buffers Michal Hocko
2024-08-29 16:34 ` Song Liu
2024-08-29 19:17 ` Jan Kara [this message]
2024-08-30  6:11   ` Hannes Reinecke
2024-08-30  9:38     ` Michal Hocko
2024-08-30 11:01       ` Christian Brauner
2024-08-30 11:31         ` Michal Hocko
2024-08-30 12:54 ` Christian Brauner

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=20240829191746.tsrojxj3kntt4jhp@quack3 \
    --to=jack@suse.cz \
    --cc=brauner@kernel.org \
    --cc=linux-fsdevel@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-raid@vger.kernel.org \
    --cc=mhocko@kernel.org \
    --cc=mhocko@suse.com \
    --cc=song@kernel.org \
    --cc=viro@zeniv.linux.org.uk \
    --cc=yukuai3@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