Messages in this thread Patch in this message | | | From | Miaohe Lin <> | Subject | [PATCH] mm/hugetlb: optimize the surplus state transfer code in move_hugetlb_state() | Date | Wed, 10 Feb 2021 02:12:51 -0500 |
| |
We should not transfer the per-node surplus state when we do not cross the node in order to save some cpu cycles
Signed-off-by: Miaohe Lin <linmiaohe@huawei.com> --- mm/hugetlb.c | 6 ++++++ 1 file changed, 6 insertions(+)
diff --git a/mm/hugetlb.c b/mm/hugetlb.c index da347047ea10..4f2c92ddbca4 100644 --- a/mm/hugetlb.c +++ b/mm/hugetlb.c @@ -5632,6 +5632,12 @@ void move_hugetlb_state(struct page *oldpage, struct page *newpage, int reason) 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]--; -- 2.19.1
| |