All of lore.kernel.org
 help / color / mirror / Atom feed
From: David Sterba <dsterba@suse.cz>
To: Omar Sandoval <osandov@osandov.com>
Cc: Michal Hocko <mhocko@kernel.org>,
	lkp@01.org, Stephen Rothwell <sfr@canb.auug.org.au>,
	Omar Sandoval <osandov@fb.com>, Vinnie Magro <vmagro@fb.com>,
	kernel test robot <xiaolong.ye@intel.com>,
	LKML <linux-kernel@vger.kernel.org>
Subject: Re: [lkp-robot] [btrfs]  beeeccca9b: WARNING:at_mm/util.c:#kvmalloc_node
Date: Wed, 31 May 2017 16:58:48 +0200	[thread overview]
Message-ID: <20170531145848.GB12135@suse.cz> (raw)
In-Reply-To: <20170531092920.GA1418@vader>

On Wed, May 31, 2017 at 02:29:20AM -0700, Omar Sandoval wrote:
> diff --git a/fs/btrfs/free-space-tree.c b/fs/btrfs/free-space-tree.c
> index fc0bd8406758..5abd3cd71144 100644
> --- a/fs/btrfs/free-space-tree.c
> +++ b/fs/btrfs/free-space-tree.c
> @@ -153,21 +153,18 @@ static inline u32 free_space_bitmap_size(u64 size, u32 sectorsize)
>  
>  static u8 *alloc_bitmap(u32 bitmap_size)
>  {
> -	void *mem;
> +	u8 *ret;
> +	unsigned int nofs_flag;
>  
>  	/*
> -	 * The allocation size varies, observed numbers were < 4K up to 16K.
> -	 * Using vmalloc unconditionally would be too heavy, we'll try
> -	 * contiguous allocations first.
> +	 * GFP_NOFS doesn't work with kvmalloc(), but we really can't recurse
> +	 * into the filesystem as the free space bitmap can be modified in the
> +	 * critical section of a transaction commit.
>  	 */
> -	if  (bitmap_size <= PAGE_SIZE)
> -		return kzalloc(bitmap_size, GFP_NOFS);
> -
> -	mem = kzalloc(bitmap_size, GFP_NOFS | __GFP_NOWARN);
> -	if (mem)
> -		return mem;
> -
> -	return __vmalloc(bitmap_size, GFP_NOFS | __GFP_ZERO, PAGE_KERNEL);
> +	nofs_flag = memalloc_nofs_save();
> +	ret = kvmalloc(bitmap_size, GFP_KERNEL);
> +	memalloc_nofs_restore(nofs_flag);
> +	return ret;
>  }
>  
>  int convert_free_space_to_bitmaps(struct btrfs_trans_handle *trans,
> 
> Dave, would you prefer to replace the patch we have now or do an
> incremental patch on top of it?

I'll drop the patch "btrfs: Use kvzalloc instead of kzalloc/vmalloc in
alloc_bitmap", please send an updated version.

  parent reply	other threads:[~2017-05-31 14:59 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-05-31  6:30 kernel test robot
2017-05-31  6:51 ` Michal Hocko
2017-05-31  9:12   ` Omar Sandoval
2017-05-31  9:19     ` Michal Hocko
2017-05-31  9:29       ` Omar Sandoval
2017-05-31 10:30         ` Michal Hocko
2017-05-31 14:58         ` David Sterba [this message]
2017-06-05  3:30           ` Stephen Rothwell
2017-06-05 11:43             ` David Sterba
2017-06-05 12:11               ` Stephen Rothwell

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=20170531145848.GB12135@suse.cz \
    --to=dsterba@suse.cz \
    --cc=linux-kernel@vger.kernel.org \
    --cc=lkp@01.org \
    --cc=mhocko@kernel.org \
    --cc=osandov@fb.com \
    --cc=osandov@osandov.com \
    --cc=sfr@canb.auug.org.au \
    --cc=vmagro@fb.com \
    --cc=xiaolong.ye@intel.com \
    --subject='Re: [lkp-robot] [btrfs]  beeeccca9b: WARNING:at_mm/util.c:#kvmalloc_node' \
    /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

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.