Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 517bbed9 authored by Sebastian Andrzej Siewior's avatar Sebastian Andrzej Siewior Committed by Thomas Gleixner
Browse files

mm/vmscan: Convert to hotplug state machine



Install the callbacks via the state machine.

Signed-off-by: default avatarSebastian Andrzej Siewior <bigeasy@linutronix.de>
Signed-off-by: default avatarThomas Gleixner <tglx@linutronix.de>
Cc: linux-mm@kvack.org
Cc: rt@linutronix.de
Link: http://lkml.kernel.org/r/20161103145021.28528-8-bigeasy@linutronix.de


Signed-off-by: default avatarThomas Gleixner <tglx@linutronix.de>
parent 005fd4bb
Loading
Loading
Loading
Loading
+14 −14
Original line number Diff line number Diff line
@@ -3556,12 +3556,10 @@ unsigned long shrink_all_memory(unsigned long nr_to_reclaim)
   not required for correctness.  So if the last cpu in a node goes
   away, we get changed to run anywhere: as the first one comes back,
   restore their cpu bindings. */
static int cpu_callback(struct notifier_block *nfb, unsigned long action,
			void *hcpu)
static int kswapd_cpu_online(unsigned int cpu)
{
	int nid;

	if (action == CPU_ONLINE || action == CPU_ONLINE_FROZEN) {
	for_each_node_state(nid, N_MEMORY) {
		pg_data_t *pgdat = NODE_DATA(nid);
		const struct cpumask *mask;
@@ -3572,8 +3570,7 @@ static int cpu_callback(struct notifier_block *nfb, unsigned long action,
			/* One of our CPUs online: restore mask */
			set_cpus_allowed_ptr(pgdat->kswapd, mask);
	}
	}
	return NOTIFY_OK;
	return 0;
}

/*
@@ -3615,12 +3612,15 @@ void kswapd_stop(int nid)

static int __init kswapd_init(void)
{
	int nid;
	int nid, ret;

	swap_setup();
	for_each_node_state(nid, N_MEMORY)
 		kswapd_run(nid);
	hotcpu_notifier(cpu_callback, 0);
	ret = cpuhp_setup_state_nocalls(CPUHP_AP_ONLINE_DYN,
					"mm/vmscan:online", kswapd_cpu_online,
					NULL);
	WARN_ON(ret < 0);
	return 0;
}