author: Dave Hansen <dave.hansen@linux.intel.com> 2021-10-18 15:15:29 -0700
committer: Linus Torvalds <torvalds@linux-foundation.org> 2021-10-18 20:22:02 -1000
commit: 295be91f7ef0027fca2f2e4788e99731aa931834
parent: cb185d5f1ebf900f4ae3bf84cee212e6dd035aca
Commit Summary:
Diffstat:
1 file changed, 10 insertions, 1 deletion
diff --git a/mm/migrate.c b/mm/migrate.c
index a6a7743ee98f..a6311e46f605 100644
--- a/mm/migrate.c
+++ b/mm/migrate.c
@@ -3239,8 +3239,18 @@ static int migration_offline_cpu(unsigned int cpu)
* set_migration_target_nodes().
*/
static int __meminit migrate_on_reclaim_callback(struct notifier_block *self,
- unsigned long action, void *arg)
+ unsigned long action, void *_arg)
{
+ struct memory_notify *arg = _arg;
+
+ /*
+ * Only update the node migration order when a node is
+ * changing status, like online->offline. This avoids
+ * the overhead of synchronize_rcu() in most cases.
+ */
+ if (arg->status_change_nid < 0)
+ return notifier_from_errno(0);
+
switch (action) {
case MEM_GOING_OFFLINE:
/*