--- a/mm/hugetlb.c~mm-hugetlb-optimize-the-surplus-state-transfer-code-in-move_hugetlb_state +++ a/mm/hugetlb.c @@ -5682,6 +5682,12 @@ void move_hugetlb_state(struct page *old SetHPageTemporary(oldpage); ClearHPageTemporary(newpage); + /* + * There is no need to transfer the per-node surplus state + * when we do not cross the node. + */ + if (new_nid == old_nid) + return; spin_lock(&hugetlb_lock); if (h->surplus_huge_pages_node[old_nid]) { h->surplus_huge_pages_node[old_nid]--;