Re: [PATCH V3] mm/hugetlb: try preferred node first when alloc gigantic page from cma

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On 9/1/20 11:14 PM, Michal Hocko wrote:
> On Wed 02-09-20 10:50:16, Li Xinhai wrote:
>> Since commit cf11e85fc08cc6a4 ("mm: hugetlb: optionally allocate gigantic
>> hugepages using cma"), the gigantic page would be allocated from node
>> which is not the preferred node, although there are pages available from
>> that node. The reason is that the nid parameter has been ignored in
>> alloc_gigantic_page().
>>
>> Besides, the __GFP_THISNODE also need be checked if user required to
>> alloc only from the preferred node.
>>
>> After this patch, the preferred node is tried first before other allowed
>> nodes, and don't try to allocate from other nodes if __GFP_THISNODE is
>> specified. If user don't specify the preferred node, the current node
>> will be used as preferred node, which makes sure consistent behavior of
>> allocating gigantic and non-gigantic hugetlb page.
> 
> Technically speaking this is still not in full sync with the allocator
> semantic. E.g. cma allocator should try nodes in the node distance
> order. Possible but not sure how much we really do care for those who
> preallocate cma pools. Also __GFP_NOWAIT should skip CMA as that
> requires mutex - or even better make alloc_cma gfp aware. Likely few
> more things.
> 
> If we care then something for a patch or two on its own and also make
> the cma part a function on its own to remove the ugly ifdef.

Agreed.  There is plenty of room for improvement which can be done with
subsequent changes.

>> Fixes: cf11e85fc08cc6a4 ("mm: hugetlb: optionally allocate gigantic hugepages using cma")
>> Cc: Roman Gushchin <guro@xxxxxx>
>> Cc: Mike Kravetz <mike.kravetz@xxxxxxxxxx>
>> Cc: Michal Hocko <mhocko@xxxxxxxxxx>
>> Signed-off-by: Li Xinhai <lixinhai.lxh@xxxxxxxxx>
> 
> Acked-by: Michal Hocko <mhocko@xxxxxxxx>

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

-- 
Mike Kravetz




[Index of Archives]     [Linux ARM Kernel]     [Linux ARM]     [Linux Omap]     [Fedora ARM]     [IETF Annouce]     [Bugtraq]     [Linux OMAP]     [Linux MIPS]     [eCos]     [Asterisk Internet PBX]     [Linux API]

  Powered by Linux