[lkml]   [2020]   [Jul]   [9]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
Messages in this thread
SubjectRe: [PATCH v3] mm/hugetlb: avoid hardcoding while checking if cma is enable
On 7/9/20 4:45 PM, Song Bao Hua (Barry Song) wrote:
>> -----Original Message-----
>> From: Mike Kravetz []
>> Sent: Friday, July 10, 2020 6:58 AM
>> To: Song Bao Hua (Barry Song) <>; Roman
>> Gushchin <>
>> Cc: Andrew Morton <>;;
>>; Linuxarm <>; Jonathan
>> Cameron <>
>> Subject: Re: [PATCH v3] mm/hugetlb: avoid hardcoding while checking if cma
>> is enable
>> Looks like this produced a warning in linux-next. I suspect it is due to the
>> Instead of adding the routine hugetlb_cma_enabled() to scan the hugetlb_cma
>> array, could we just use a boolean as follows? It can simply be set in
>> hugetlb_cma_reserve when we reserve CMA.
> Maybe just use hugetlb_cma_size? If hugetlb_cma_size is not 0, someone is trying to use
> cma, then bootmem for gigantic pages will be totally ignored according to discussion here:
> if somebody sets a wrong hugetlb_cma_size which causes that cma is not reserved.
> It is the fault of users? We just need to document hugetlb_cma will overwrite bootmem
> reservations?

Yes, I think using hugetlb_cma_size would be sufficient. If someone
specifies hugetlb_cma=<N> and hugepagesz=<gigantic_page_size> hugepages=<X>
that is wrong. I don't think we need to worry about 'falling back' to
preallocating X gigantic pages if N is a bad value. Or, even if the arch
does not support cma allocation.

I am working on a patch to check this earlier in command processing. That
will make this check unnecessary. However, that patch is based on new
command line processing code only in 5.8. So, I think we still need to do
this so that it can be backported to stable.
Mike Kravetz

 \ /
  Last update: 2020-07-10 02:25    [W:0.069 / U:7.412 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site