The patch titled Subject: mm/hugetlb: try preferred node first when alloc gigantic page from cma has been added to the -mm tree. Its filename is mm-hugetlb-try-preferred-node-first-when-alloc-gigantic-page-from-cma.patch This patch should soon appear at http://ozlabs.org/~akpm/mmots/broken-out/mm-hugetlb-try-preferred-node-first-when-alloc-gigantic-page-from-cma.patch and later at http://ozlabs.org/~akpm/mmotm/broken-out/mm-hugetlb-try-preferred-node-first-when-alloc-gigantic-page-from-cma.patch Before you just go and hit "reply", please: a) Consider who else should be cc'ed b) Prefer to cc a suitable mailing list as well c) Ideally: find the original patch on the mailing list and do a reply-to-all to that, adding suitable additional cc's *** Remember to use Documentation/process/submit-checklist.rst when testing your code *** The -mm tree is included into linux-next and is updated there every 3-4 working days ------------------------------------------------------ From: Li Xinhai <lixinhai.lxh@xxxxxxxxx> Subject: mm/hugetlb: try preferred node first when alloc gigantic page from cma 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(). After this patch, the preferred node is tried first before other allowed nodes. Link: http://lkml.kernel.org/r/20200830140418.605627-1-lixinhai.lxh@xxxxxxxxx Fixes: cf11e85fc08cc6a4 ("mm: hugetlb: optionally allocate gigantic hugepages using cma") Signed-off-by: Li Xinhai <lixinhai.lxh@xxxxxxxxx> Cc: Roman Gushchin <guro@xxxxxx> Cc: Mike Kravetz <mike.kravetz@xxxxxxxxxx> Cc: Michal Hocko <mhocko@xxxxxxxxxx> Signed-off-by: Andrew Morton <akpm@xxxxxxxxxxxxxxxxxxxx> --- mm/hugetlb.c | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) --- a/mm/hugetlb.c~mm-hugetlb-try-preferred-node-first-when-alloc-gigantic-page-from-cma +++ a/mm/hugetlb.c @@ -1256,8 +1256,15 @@ static struct page *alloc_gigantic_page( struct page *page; int node; + if (hugetlb_cma[nid]) { + page = cma_alloc(hugetlb_cma[nid], nr_pages, + huge_page_order(h), true); + if (page) + return page; + } + for_each_node_mask(node, *nodemask) { - if (!hugetlb_cma[node]) + if (node == nid || !hugetlb_cma[node]) continue; page = cma_alloc(hugetlb_cma[node], nr_pages, _ Patches currently in -mm which might be from lixinhai.lxh@xxxxxxxxx are mm-hugetlb-try-preferred-node-first-when-alloc-gigantic-page-from-cma.patch mm-isolation-avoid-checking-unmovable-pages-across-pageblock-boundary.patch