Re: [PATCH 04/10] mm/hugetlb: count file_region to be added when regions_needed != NULL

From: Mike Kravetz
Date: Mon Aug 10 2020 - 17:46:33 EST


On 8/7/20 2:12 AM, Wei Yang wrote:
> There are only two cases of function add_reservation_in_range()
>
> * count file_region and return the number in regions_needed
> * do the real list operation without counting
>
> This means it is not necessary to have two parameters to classify these
> two cases.
>
> Just use regions_needed to separate them.
>
> Signed-off-by: Wei Yang <richard.weiyang@xxxxxxxxxxxxxxxxx>

Thanks!

I really like removal of the 'count_only' parameter. However, within the
routine 'count_only' made the code just a little easier to understand. I
might have:
- Removed the function parameter.
- Added local variable
bool count_only = regions_needed != NULL;
- Left remaining code as it.

I'm OK with the proposed change. Any change to readability is VERY minimal.

Reviewed-by: Mike Kravetz <mike.kravetz@xxxxxxxxxx>

--
Mike Kravetz