Re: [PATCH 06/11] mm/hugetlb: do not modify user provided gfp_mask

From: Joonsoo Kim
Date: Fri May 22 2020 - 03:43:05 EST


2020ë 5ì 22ì (ê) ìì 7:19, Mike Kravetz <mike.kravetz@xxxxxxxxxx>ëì ìì:
>
> On 5/17/20 6:20 PM, js1304@xxxxxxxxx wrote:
> > From: Joonsoo Kim <iamjoonsoo.kim@xxxxxxx>
> >
> > It's not good practice to modify user input. Instead of using it to
> > build correct gfp_mask for APIs, this patch introduces another gfp_mask
> > field, __gfp_mask, for internal usage.
>
> Modifying the flags as is done in the existing code does not bother me
> too much, but that is just my opinion. Adding __gfp_mask for modifications
> is fine with me if others think it is a good thing.

With the following patches, in some cases, ac->gfp_mask is set up once and
used many times. If we modify ac->gfp_mask in place, there would be side-effect.

> Does dequeue_huge_page_vma() need to be modified so that it will set
> ac.__gfp_mask before calling dequeue_huge_page_nodemask()?

Good catch! Will change!

Thanks.