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

From: Michal Hocko
Date: Tue Jul 04 2017 - 04:10:21 EST

On Mon 03-07-17 18:57:14, Mikulas Patocka wrote:
> On Mon, 3 Jul 2017, Michal Hocko wrote:
> > We can add a warning (or move it from kvmalloc) and hope that the
> > respective maintainers will fix those places properly. The reason I
> > didn't add the warning to vmalloc and kept it in kvmalloc was to catch
> > only new users rather than suddenly splat on existing ones. Note that
> > there are users with panic_on_warn enabled.
> >
> > Considering how many NOFS users we have in tree I would rather work with
> > maintainers to fix them.
> So - do you want this patch?

no, see below

> I still believe that the previous patch that pushes
> memalloc_noio/nofs_save into __vmalloc is better than this.

It is, but both of them are actually wrong. Why? Because that would be
just a mindless application of the scope where the scope doesn't match
the actual reclaim recursion restricted scope. Really, the right way to
go is to simply talk to the respective maintainers. Find out whether
NOFS context is really needed and if so find the scope (e.g. a lock
which would be needed in the reclaim context) and document it. This is
not a trivial work to do but a) we do not seem to have any bug reports
complaining about these call sites so there is no need to hurry and b)
this will result in a cleaner and easier to maintain code.
Michal Hocko