lkml.org 
[lkml]   [2021]   [Oct]   [19]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [RFC 1/3] mm/vmalloc: alloc GFP_NO{FS,IO} for vmalloc
On Tue 19-10-21 11:44:01, Neil Brown wrote:
> On Mon, 18 Oct 2021, Michal Hocko wrote:
[...]
> > @@ -2930,8 +2932,24 @@ static void *__vmalloc_area_node(struct vm_struct *area, gfp_t gfp_mask,
> > goto fail;
> > }
> >
> > - if (vmap_pages_range(addr, addr + size, prot, area->pages,
> > - page_shift) < 0) {
> > + /*
> > + * page tables allocations ignore external gfp mask, enforce it
> > + * by the scope API
> > + */
> > + if ((gfp_mask & (__GFP_FS | __GFP_IO)) == __GFP_IO)
> > + flags = memalloc_nofs_save();
> > + else if (!(gfp_mask & (__GFP_FS | __GFP_IO)))
>
> I would *much* rather this were written
>
> else if ((gfp_mask & (__GFP_FS | __GFP_IO)) == 0)

Sure, this looks better indeed.

> so that the comparison with the previous test is more obvious. Ditto
> for similar code below.
> It could even be
>
> switch (gfp_mask & (__GFP_FS | __GFP_IO)) {
> case __GFP__IO: flags = memalloc_nofs_save(); break;
> case 0: flags = memalloc_noio_save(); break;
> }
>
> But I'm not completely convinced that is an improvement.

I am not a great fan of this though.

> In terms of functionality this looks good.

Thanks for the review!

--
Michal Hocko
SUSE Labs

\
 
 \ /
  Last update: 2021-10-19 08:59    [W:0.063 / U:1.564 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site