From: Miaohe Lin <linmiaohe@huawei.com>
To: <akpm@linux-foundation.org>, <mike.kravetz@oracle.com>
Cc: <linux-kernel@vger.kernel.org>, <linux-mm@kvack.org>,
<linmiaohe@huawei.com>
Subject: [PATCH 2/5] mm/hugetlb: optimize the surplus state transfer code in move_hugetlb_state()
Date: Mon, 8 Mar 2021 06:28:06 -0500 [thread overview]
Message-ID: <20210308112809.26107-3-linmiaohe@huawei.com> (raw)
In-Reply-To: <20210308112809.26107-1-linmiaohe@huawei.com>
We should not transfer the per-node surplus state when we do not cross the
node in order to save some cpu cycles
Reviewed-by: Mike Kravetz <mike.kravetz@oracle.com>
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 33a3edf79022..695603071f2c 100644
--- a/mm/hugetlb.c
+++ b/mm/hugetlb.c
@@ -5621,6 +5621,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
next prev parent reply other threads:[~2021-03-08 11:29 UTC|newest]
Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-03-08 11:28 [PATCH 0/5] Some cleanups for hugetlb Miaohe Lin
2021-03-08 11:28 ` [PATCH 1/5] mm/hugetlb: use some helper functions to cleanup code Miaohe Lin
2021-03-08 11:28 ` Miaohe Lin [this message]
2021-03-08 11:28 ` [PATCH 3/5] hugetlb_cgroup: remove unnecessary VM_BUG_ON_PAGE in hugetlb_cgroup_migrate() Miaohe Lin
2021-03-12 19:46 ` Mike Kravetz
2021-03-08 11:28 ` [PATCH 4/5] mm/hugetlb: simplify the code when alloc_huge_page() failed in hugetlb_no_page() Miaohe Lin
2021-03-12 19:58 ` Mike Kravetz
2021-03-13 2:54 ` Miaohe Lin
2021-03-08 11:28 ` [PATCH 5/5] mm/hugetlb: avoid calculating fault_mutex_hash in truncate_op case Miaohe Lin
2021-03-12 20:03 ` Mike Kravetz
2021-03-13 2:49 ` Miaohe Lin
2021-03-13 21:17 ` Mike Kravetz
2021-03-15 1:50 ` Miaohe Lin
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20210308112809.26107-3-linmiaohe@huawei.com \
--to=linmiaohe@huawei.com \
--cc=akpm@linux-foundation.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mm@kvack.org \
--cc=mike.kravetz@oracle.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).