Re: [PATCH] mm, vmalloc: use __GFP_HIGHMEM implicitly

From: Michal Hocko
Date: Wed Mar 08 2017 - 05:46:09 EST


On Wed 08-03-17 08:33:58, Vlastimil Babka wrote:
> On 03/07/2017 03:10 PM, Michal Hocko wrote:
[...]
> > index dece26f119d4..a804a4107fbc 100644
> > --- a/drivers/block/drbd/drbd_bitmap.c
> > +++ b/drivers/block/drbd/drbd_bitmap.c
> > @@ -409,7 +409,7 @@ static struct page **bm_realloc_pages(struct drbd_bitmap *b, unsigned long want)
> > new_pages = kzalloc(bytes, GFP_NOIO | __GFP_NOWARN);
> > if (!new_pages) {
> > new_pages = __vmalloc(bytes,
> > - GFP_NOIO | __GFP_HIGHMEM | __GFP_ZERO,
> > + GFP_NOIO | __GFP_ZERO,
>
> This should be converted to memalloc_noio_save(), right? And then
> kvmalloc? Unless that happens in your other series :)

yeah, that would be for a separate patch(es).

[...]
> > diff --git a/fs/btrfs/free-space-tree.c b/fs/btrfs/free-space-tree.c
> > index dd7fb22a955a..fc0bd8406758 100644
> > --- a/fs/btrfs/free-space-tree.c
> > +++ b/fs/btrfs/free-space-tree.c
> > @@ -167,8 +167,7 @@ static u8 *alloc_bitmap(u32 bitmap_size)
> > if (mem)
> > return mem;
> >
> > - return __vmalloc(bitmap_size, GFP_NOFS | __GFP_HIGHMEM | __GFP_ZERO,
> > - PAGE_KERNEL);
> > + return __vmalloc(bitmap_size, GFP_NOFS | __GFP_ZERO, PAGE_KERNEL);
>
> memalloc_nofs_save() and plain vzalloc()?

I would really prefer to check whether GFP_NOFS is really needed here
and if yes then place memalloc_nofs_save where the locking really
requires it so this would become plan vmalloc as a side effect

> > diff --git a/mm/nommu.c b/mm/nommu.c
> > index a80411d258fc..fc184f597d59 100644
> > --- a/mm/nommu.c
> > +++ b/mm/nommu.c
> > @@ -246,8 +246,7 @@ void *vmalloc_user(unsigned long size)
> > {
> > void *ret;
> >
> > - ret = __vmalloc(size, GFP_KERNEL | __GFP_HIGHMEM | __GFP_ZERO,
> > - PAGE_KERNEL);
> > + ret = __vmalloc(size, GFP_KERNEL | __GFP_ZERO, PAGE_KERNEL);
>
> vzalloc()?

after some code moving in mm/nommu.c yes. But I am not sure this is a
huge win

--
Michal Hocko
SUSE Labs