Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1654039

Re: [lkp-robot] [btrfs] beeeccca9b: WARNING:at_mm/util.c:#kvmalloc_node

From Michal Hocko <mhocko@kernel.org>
Newsgroups linux.kernel
Subject Re: [lkp-robot] [btrfs] beeeccca9b: WARNING:at_mm/util.c:#kvmalloc_node
Date 2017-05-31 11:20 +0200
Message-ID <tN7Xk-2RF-19@gated-at.bofh.it> (permalink)
References <tN5su-1db-25@gated-at.bofh.it> <tN5LQ-1k9-19@gated-at.bofh.it> <tN7Xk-2RF-21@gated-at.bofh.it>
Organization linux.* mail to news gateway

Show all headers | View raw


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

Back to linux.kernel | Previous | NextPrevious in thread | Next in thread | Find similar | Unroll thread


Thread

Re: [lkp-robot] [btrfs]  beeeccca9b:  WARNING:at_mm/util.c:#kvmalloc_node Michal Hocko <mhocko@kernel.org> - 2017-05-31 09:00 +0200
  Re: [lkp-robot] [btrfs]  beeeccca9b:  WARNING:at_mm/util.c:#kvmalloc_node Michal Hocko <mhocko@kernel.org> - 2017-05-31 11:20 +0200
    Re: [lkp-robot] [btrfs]  beeeccca9b:  WARNING:at_mm/util.c:#kvmalloc_node Omar Sandoval <osandov@osandov.com> - 2017-05-31 11:30 +0200
      Re: [lkp-robot] [btrfs]  beeeccca9b:  WARNING:at_mm/util.c:#kvmalloc_node Michal Hocko <mhocko@kernel.org> - 2017-05-31 12:40 +0200
      Re: [lkp-robot] [btrfs]  beeeccca9b:  WARNING:at_mm/util.c:#kvmalloc_node David Sterba <dsterba@suse.cz> - 2017-05-31 17:00 +0200
        Re: [lkp-robot] [btrfs]  beeeccca9b:  WARNING:at_mm/util.c:#kvmalloc_node Stephen Rothwell <sfr@canb.auug.org.au> - 2017-06-05 05:40 +0200
          Re: [lkp-robot] [btrfs]  beeeccca9b:  WARNING:at_mm/util.c:#kvmalloc_node David Sterba <dsterba@suse.cz> - 2017-06-05 13:50 +0200
            Re: [lkp-robot] [btrfs]  beeeccca9b:  WARNING:at_mm/util.c:#kvmalloc_node Stephen Rothwell <sfr@canb.auug.org.au> - 2017-06-05 14:20 +0200
  Re: [lkp-robot] [btrfs]  beeeccca9b:  WARNING:at_mm/util.c:#kvmalloc_node Omar Sandoval <osandov@osandov.com> - 2017-05-31 11:20 +0200

csiph-web