All of lore.kernel.org
 help / color / mirror / Atom feed
From: Michal Hocko <mhocko@kernel.org>
To: Goldwyn Rodrigues <rgoldwyn@suse.de>
Cc: linux-fsdevel@vger.kernel.org, Goldwyn Rodrigues <rgoldwyn@suse.com>
Subject: Re: [PATCH 01/10] fs: buffer - Use memalloc_nofs API to allocate pages
Date: Mon, 19 Feb 2018 15:24:57 +0100	[thread overview]
Message-ID: <20180219142457.GO21134@dhcp22.suse.cz> (raw)
In-Reply-To: <20180219140230.5077-2-rgoldwyn@suse.de>

On Mon 19-02-18 08:02:21, Goldwyn Rodrigues wrote:
> From: Goldwyn Rodrigues <rgoldwyn@suse.com>
> 

I am pretty sure we really need a changelog here.

> Signed-off-by: Goldwyn Rodrigues <rgoldwyn@suse.com>
> ---
>  fs/buffer.c | 7 ++++++-
>  1 file changed, 6 insertions(+), 1 deletion(-)
> 
> diff --git a/fs/buffer.c b/fs/buffer.c
> index 9a73924db22f..1787b29f3fb3 100644
> --- a/fs/buffer.c
> +++ b/fs/buffer.c
> @@ -45,6 +45,7 @@
>  #include <linux/mpage.h>
>  #include <linux/bit_spinlock.h>
>  #include <linux/pagevec.h>
> +#include <linux/sched/mm.h>
>  #include <trace/events/block.h>
>  
>  static int fsync_buffers_list(spinlock_t *lock, struct list_head *list);
> @@ -836,7 +837,8 @@ struct buffer_head *alloc_page_buffers(struct page *page, unsigned long size,
>  		bool retry)
>  {
>  	struct buffer_head *bh, *head;
> -	gfp_t gfp = GFP_NOFS;
> +	gfp_t gfp = GFP_KERNEL;
> +	unsigned int nofs_flags;
>  	long offset;
>  
>  	if (retry)
> @@ -844,6 +846,7 @@ struct buffer_head *alloc_page_buffers(struct page *page, unsigned long size,
>  
>  	head = NULL;
>  	offset = PAGE_SIZE;
> +	nofs_flags = memalloc_nofs_save();

OK, so what is the actual scope here. What kind of context is recursion
problematic? This is a helper function and as such it is the caller who
knows the fs context. So this is quite opposite to what how the scope
API should be used. It is not about pure GFP_NOFS replacement. We really
want to document those scopes.

>  	while ((offset -= size) >= 0) {
>  		bh = alloc_buffer_head(gfp);
>  		if (!bh)
> @@ -858,11 +861,13 @@ struct buffer_head *alloc_page_buffers(struct page *page, unsigned long size,
>  		/* Link the buffer to its page */
>  		set_bh_page(bh, page, offset);
>  	}
> +	memalloc_nofs_restore(nofs_flags);
>  	return head;
>  /*
>   * In case anything failed, we just free everything we got.
>   */
>  no_grow:
> +	memalloc_nofs_restore(nofs_flags);
>  	if (head) {
>  		do {
>  			bh = head;
> -- 
> 2.16.1

-- 
Michal Hocko
SUSE Labs

  reply	other threads:[~2018-02-19 14:24 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-02-19 14:02 [PATCH 00/10] Use the memalloc_nofs scope API Goldwyn Rodrigues
2018-02-19 14:02 ` [PATCH 01/10] fs: buffer - Use memalloc_nofs API to allocate pages Goldwyn Rodrigues
2018-02-19 14:24   ` Michal Hocko [this message]
2018-02-19 14:02 ` [PATCH 02/10] fs: mpage use memalloc_nofs_save/restore while allocating bios Goldwyn Rodrigues
2018-02-19 14:02 ` [PATCH 03/10] ext4: Use memalloc_nofs_* scope API Goldwyn Rodrigues
2018-02-19 14:02 ` [PATCH 04/10] f2fs: " Goldwyn Rodrigues
2018-02-19 14:02 ` [PATCH 05/10] gfs2: " Goldwyn Rodrigues
2018-02-19 14:02 ` [PATCH 06/10] fs: iomap use " Goldwyn Rodrigues
2018-02-19 22:30   ` Dave Chinner
2018-02-20  9:05     ` Michal Hocko
2018-02-20 12:16       ` Goldwyn Rodrigues
2018-02-19 14:02 ` [PATCH 07/10] fs: namei " Goldwyn Rodrigues
2018-02-19 14:02 ` [PATCH 08/10] fs: Eliminate AOP_FLAG_NOFS Goldwyn Rodrigues
2018-02-19 14:02 ` [PATCH 09/10] reiserfs: cont_expand() to eliminate AOP_FLAG_CONT_EXPAND Goldwyn Rodrigues
2018-02-19 14:55   ` Matthew Wilcox
2018-02-19 14:02 ` [PATCH 10/10] fs: Remove flags parameter from aops->write_begin() Goldwyn Rodrigues

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=20180219142457.GO21134@dhcp22.suse.cz \
    --to=mhocko@kernel.org \
    --cc=linux-fsdevel@vger.kernel.org \
    --cc=rgoldwyn@suse.com \
    --cc=rgoldwyn@suse.de \
    /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.