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


Groups > linux.kernel > #1679224

Re: [PATCH] vmalloc: respect the GFP_NOIO and GFP_NOFS flags

From Mikulas Patocka <mpatocka@redhat.com>
Newsgroups linux.kernel
Subject Re: [PATCH] vmalloc: respect the GFP_NOIO and GFP_NOFS flags
Date 2017-07-01 02:40 +0200
Message-ID <tYeC7-42w-29@gated-at.bofh.it> (permalink)
References <tXTR0-7Ni-11@gated-at.bofh.it> <tXZjH-30A-15@gated-at.bofh.it> <tY8Gl-pQ-1@gated-at.bofh.it> <tYb1w-1KO-15@gated-at.bofh.it>
Organization linux.* mail to news gateway

Show all headers | View raw



On Fri, 30 Jun 2017, Michal Hocko wrote:

> On Fri 30-06-17 14:11:57, Mikulas Patocka wrote:
> > 
> > 
> > On Fri, 30 Jun 2017, Michal Hocko wrote:
> > 
> > > On Thu 29-06-17 22:25:09, Mikulas Patocka wrote:
> > > > The __vmalloc function has a parameter gfp_mask with the allocation flags,
> > > > however it doesn't fully respect the GFP_NOIO and GFP_NOFS flags. The
> > > > pages are allocated with the specified gfp flags, but the pagetables are
> > > > always allocated with GFP_KERNEL. This allocation can cause unexpected
> > > > recursion into the filesystem or I/O subsystem.
> > > > 
> > > > It is not practical to extend page table allocation routines with gfp
> > > > flags because it would require modification of architecture-specific code
> > > > in all architecturs. However, the process can temporarily request that all
> > > > allocations are done with GFP_NOFS or GFP_NOIO with with the functions
> > > > memalloc_nofs_save and memalloc_noio_save.
> > > > 
> > > > This patch makes the vmalloc code use memalloc_nofs_save or
> > > > memalloc_noio_save if the supplied gfp flags do not contain __GFP_FS or
> > > > __GFP_IO. It fixes some possible deadlocks in drivers/mtd/ubi/io.c,
> > > > fs/gfs2/, fs/btrfs/free-space-tree.c, fs/ubifs/,
> > > > fs/nfs/blocklayout/extent_tree.c where __vmalloc is used with the GFP_NOFS
> > > > flag.
> > > 
> > > I strongly believe this is a step in the _wrong_ direction. Why? Because
> > 
> > What do you think __vmalloc with GFP_NOIO should do? Print a warning? 
> > Silently ignore the GFP_NOIO flag?
> 
> I think noio users are not that much different from nofs users. Simply
> use the scope API at the place where the scope starts and document why
> it is needed. vmalloc calls do not have to be any special then and they
> do not even have to think about proper gfp flags and they can use
> whatever is the default.
> -- 
> Michal Hocko
> SUSE Labs

But you didn't answer the question - what should __vmalloc with GFP_NOIO 
(or GFP_NOFS) do? Silently drop the flag? Print a warning? Or respect the 
flag?

Currently, it silently drops the GFP_NOIO or GFP_NOFS flag, but some 
programmers don't know it and use these flags. You can't blame those 
programmers for not knowing it.

Mikulas

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


Thread

[PATCH] vmalloc: respect the GFP_NOIO and GFP_NOFS flags Mikulas Patocka <mpatocka@redhat.com> - 2017-06-30 04:30 +0200
  Re: [PATCH] vmalloc: respect the GFP_NOIO and GFP_NOFS flags John Hubbard <jhubbard@nvidia.com> - 2017-06-30 08:30 +0200
  Re: [PATCH] vmalloc: respect the GFP_NOIO and GFP_NOFS flags Michal Hocko <mhocko@kernel.org> - 2017-06-30 10:20 +0200
    Re: [PATCH] vmalloc: respect the GFP_NOIO and GFP_NOFS flags Mikulas Patocka <mpatocka@redhat.com> - 2017-06-30 20:20 +0200
      Re: [PATCH] vmalloc: respect the GFP_NOIO and GFP_NOFS flags Michal Hocko <mhocko@kernel.org> - 2017-06-30 22:50 +0200
        Re: [PATCH] vmalloc: respect the GFP_NOIO and GFP_NOFS flags Mikulas Patocka <mpatocka@redhat.com> - 2017-07-01 02:40 +0200
          Re: [PATCH] vmalloc: respect the GFP_NOIO and GFP_NOFS flags Michal Hocko <mhocko@kernel.org> - 2017-07-03 08:40 +0200
  Re: [PATCH] vmalloc: respect the GFP_NOIO and GFP_NOFS flags Andreas Dilger <adilger@dilger.ca> - 2017-07-01 05:30 +0200
    Re: [PATCH] vmalloc: respect the GFP_NOIO and GFP_NOFS flags Mikulas Patocka <mpatocka@redhat.com> - 2017-07-01 06:50 +0200

csiph-web