[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <20200119030636.11899-2-richardw.yang@linux.intel.com>
Date: Sun, 19 Jan 2020 11:06:29 +0800
From: Wei Yang <richardw.yang@...ux.intel.com>
To: akpm@...ux-foundation.org
Cc: linux-mm@...ck.org, linux-kernel@...r.kernel.org, mhocko@...e.com,
yang.shi@...ux.alibaba.com,
Wei Yang <richardw.yang@...ux.intel.com>
Subject: [PATCH 1/8] mm/migrate.c: skip node check if done in last round
Before move page to target node, we would check if the node id is valid.
In case we would try to move pages to the same target node, it is not
necessary to do the check each time.
This patch tries to skip the check if the node has been checked.
Signed-off-by: Wei Yang <richardw.yang@...ux.intel.com>
---
mm/migrate.c | 19 +++++++++++--------
1 file changed, 11 insertions(+), 8 deletions(-)
diff --git a/mm/migrate.c b/mm/migrate.c
index 430fdccc733e..ba7cf4fa43a0 100644
--- a/mm/migrate.c
+++ b/mm/migrate.c
@@ -1612,15 +1612,18 @@ static int do_pages_move(struct mm_struct *mm, nodemask_t task_nodes,
goto out_flush;
addr = (unsigned long)untagged_addr(p);
- err = -ENODEV;
- if (node < 0 || node >= MAX_NUMNODES)
- goto out_flush;
- if (!node_state(node, N_MEMORY))
- goto out_flush;
+ /* Check node if it is not checked. */
+ if (current_node == NUMA_NO_NODE || node != current_node) {
+ err = -ENODEV;
+ if (node < 0 || node >= MAX_NUMNODES)
+ goto out_flush;
+ if (!node_state(node, N_MEMORY))
+ goto out_flush;
- err = -EACCES;
- if (!node_isset(node, task_nodes))
- goto out_flush;
+ err = -EACCES;
+ if (!node_isset(node, task_nodes))
+ goto out_flush;
+ }
if (current_node == NUMA_NO_NODE) {
current_node = node;
--
2.17.1
Powered by blists - more mailing lists