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

On Wed 31-05-17 02:12:02, Omar Sandoval wrote:
> On Wed, May 31, 2017 at 08:51:28AM +0200, Michal Hocko wrote:
> > On Wed 31-05-17 14:30:33, kernel test robot wrote:
> > > 
> > > FYI, we noticed the following commit:
> > > 
> > > commit: beeeccca9bebcec386cc31c250cff8a06cf27034 ("btrfs: Use kvzalloc instead of kzalloc/vmalloc in alloc_bitmap")
> > > https://git.kernel.org/cgit/linux/kernel/git/next/linux-next.git master
> > 
> > I have intentionally skipped alloc_bitmap because it relies on GFP_NOFS.
> > This doesn't work properly when falling back to vmalloc and that is what
> > the warning reported here says. I believe the right approach is to check
> > whether the GFP_NOFS is _really_ needed and document why if yes.
> > Otherwise drop the NOFS part in one patch with the explanation and
> > convert it to kvmalloc in a separate patch.
> 
> Unfortunately we really do need GFP_NOFS here, the free space tree is
> modified while we are committing a fs transaction, sometimes in the
> critical section when we block new operations from joining the
> transaction.

OK, please document this.

> Looking at the comment in kvmalloc_node():
> 
> 	/*
> 	 * vmalloc uses GFP_KERNEL for some internal allocations (e.g page tables)
> 	 * so the given set of flags has to be compatible.
> 	 */
> 	WARN_ON_ONCE((flags & GFP_KERNEL) != GFP_KERNEL);
> 
> has alloc_bitmap() always been broken by virtue of calling vmalloc()
> with GFP_NOFS?

yes. vmalloc is simply not GFP_NOFS safe as it performs GFP_KERNEL
hardcoded allocations. The way out of this is to use
memalloc_nofs_{save,restore} around kvmalloc call.

-- 
Michal Hocko
SUSE Labs

WARNING: multiple messages have this Message-ID (diff)
From: Michal Hocko <mhocko@kernel.org>
To: lkp@lists.01.org
Subject: Re: [lkp-robot] [btrfs] beeeccca9b: WARNING:at_mm/util.c:#kvmalloc_node
Date: Wed, 31 May 2017 11:19:05 +0200	[thread overview]
Message-ID: <20170531091904.GD27783@dhcp22.suse.cz> (raw)
In-Reply-To: <20170531091202.GA769@vader>

[-- Attachment #1: Type: text/plain, Size: 1679 bytes --]

On Wed 31-05-17 02:12:02, Omar Sandoval wrote:
> On Wed, May 31, 2017 at 08:51:28AM +0200, Michal Hocko wrote:
> > On Wed 31-05-17 14:30:33, kernel test robot wrote:
> > > 
> > > FYI, we noticed the following commit:
> > > 
> > > commit: beeeccca9bebcec386cc31c250cff8a06cf27034 ("btrfs: Use kvzalloc instead of kzalloc/vmalloc in alloc_bitmap")
> > > https://git.kernel.org/cgit/linux/kernel/git/next/linux-next.git master
> > 
> > I have intentionally skipped alloc_bitmap because it relies on GFP_NOFS.
> > This doesn't work properly when falling back to vmalloc and that is what
> > the warning reported here says. I believe the right approach is to check
> > whether the GFP_NOFS is _really_ needed and document why if yes.
> > Otherwise drop the NOFS part in one patch with the explanation and
> > convert it to kvmalloc in a separate patch.
> 
> Unfortunately we really do need GFP_NOFS here, the free space tree is
> modified while we are committing a fs transaction, sometimes in the
> critical section when we block new operations from joining the
> transaction.

OK, please document this.

> Looking at the comment in kvmalloc_node():
> 
> 	/*
> 	 * vmalloc uses GFP_KERNEL for some internal allocations (e.g page tables)
> 	 * so the given set of flags has to be compatible.
> 	 */
> 	WARN_ON_ONCE((flags & GFP_KERNEL) != GFP_KERNEL);
> 
> has alloc_bitmap() always been broken by virtue of calling vmalloc()
> with GFP_NOFS?

yes. vmalloc is simply not GFP_NOFS safe as it performs GFP_KERNEL
hardcoded allocations. The way out of this is to use
memalloc_nofs_{save,restore} around kvmalloc call.

-- 
Michal Hocko
SUSE Labs

  reply	other threads:[~2017-05-31  9:19 UTC|newest]

Thread overview: 20+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-05-31  6:30 [lkp-robot] [btrfs] beeeccca9b: WARNING:at_mm/util.c:#kvmalloc_node kernel test robot
2017-05-31  6:30 ` kernel test robot
2017-05-31  6:51 ` Michal Hocko
2017-05-31  6:51   ` Michal Hocko
2017-05-31  9:12   ` Omar Sandoval
2017-05-31  9:12     ` Omar Sandoval
2017-05-31  9:19     ` Michal Hocko [this message]
2017-05-31  9:19       ` Michal Hocko
2017-05-31  9:29       ` Omar Sandoval
2017-05-31  9:29         ` Omar Sandoval
2017-05-31 10:30         ` Michal Hocko
2017-05-31 10:30           ` Michal Hocko
2017-05-31 14:58         ` David Sterba
2017-05-31 14:58           ` David Sterba
2017-06-05  3:30           ` Stephen Rothwell
2017-06-05  3:30             ` Stephen Rothwell
2017-06-05 11:43             ` David Sterba
2017-06-05 11:43               ` David Sterba
2017-06-05 12:11               ` Stephen Rothwell
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=20170531091904.GD27783@dhcp22.suse.cz \
    --to=mhocko@kernel.org \
    --cc=dsterba@suse.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=lkp@01.org \
    --cc=osandov@fb.com \
    --cc=osandov@osandov.com \
    --cc=sfr@canb.auug.org.au \
    --cc=vmagro@fb.com \
    --cc=xiaolong.ye@intel.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 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.