Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1465247

[PATCH 05/16] mm: writeback: Convert to hotplug state machine

From Sebastian Andrzej Siewior <bigeasy@linutronix.de>
Newsgroups linux.kernel
Subject [PATCH 05/16] mm: writeback: Convert to hotplug state machine
Date 2016-08-18 15:10 +0200
Message-ID <s7vf3-dJ-1@gated-at.bofh.it> (permalink)
References <s7v5o-8lC-7@gated-at.bofh.it>
Organization linux.* mail to news gateway

Show all headers | View raw


Install the callbacks via the state machine and let the core invoke
the callbacks on the already online CPUs.

Cc: Tejun Heo <tj@kernel.org>
Cc: Jens Axboe <axboe@fb.com>
Cc: linux-mm@kvack.org
Signed-off-by: Sebastian Andrzej Siewior <bigeasy@linutronix.de>
---
 include/linux/cpuhotplug.h |  1 +
 mm/page-writeback.c        | 26 +++++++-------------------
 2 files changed, 8 insertions(+), 19 deletions(-)

diff --git a/include/linux/cpuhotplug.h b/include/linux/cpuhotplug.h
index 82ee32107dff..854e59a426d4 100644
--- a/include/linux/cpuhotplug.h
+++ b/include/linux/cpuhotplug.h
@@ -16,6 +16,7 @@ enum cpuhp_state {
 	CPUHP_X86_APB_DEAD,
 	CPUHP_VIRT_NET_DEAD,
 	CPUHP_SLUB_DEAD,
+	CPUHP_MM_WRITEBACK_DEAD,
 	CPUHP_WORKQUEUE_PREP,
 	CPUHP_POWER_NUMA_PREPARE,
 	CPUHP_HRTIMERS_PREPARE,
diff --git a/mm/page-writeback.c b/mm/page-writeback.c
index 82e72524db55..6d3d0e87f309 100644
--- a/mm/page-writeback.c
+++ b/mm/page-writeback.c
@@ -2050,26 +2050,12 @@ void writeback_set_ratelimit(void)
 		ratelimit_pages = 16;
 }
 
-static int
-ratelimit_handler(struct notifier_block *self, unsigned long action,
-		  void *hcpu)
+static int page_writeback_cpu_online(unsigned int cpu)
 {
-
-	switch (action & ~CPU_TASKS_FROZEN) {
-	case CPU_ONLINE:
-	case CPU_DEAD:
-		writeback_set_ratelimit();
-		return NOTIFY_OK;
-	default:
-		return NOTIFY_DONE;
-	}
+	writeback_set_ratelimit();
+	return 0;
 }
 
-static struct notifier_block ratelimit_nb = {
-	.notifier_call	= ratelimit_handler,
-	.next		= NULL,
-};
-
 /*
  * Called early on to tune the page writeback dirty limits.
  *
@@ -2092,8 +2078,10 @@ void __init page_writeback_init(void)
 {
 	BUG_ON(wb_domain_init(&global_wb_domain, GFP_KERNEL));
 
-	writeback_set_ratelimit();
-	register_cpu_notifier(&ratelimit_nb);
+	cpuhp_setup_state(CPUHP_AP_ONLINE_DYN, "MM_WRITEBACK_ONLINE",
+			  page_writeback_cpu_online, NULL);
+	cpuhp_setup_state(CPUHP_MM_WRITEBACK_DEAD, "MM_WRITEBACK_DEAD", NULL,
+			  page_writeback_cpu_online);
 }
 
 /**
-- 
2.9.3

Back to linux.kernel | Previous | NextPrevious in thread | Next in thread | Find similar | Unroll thread


Thread

cpu hotplug: convert more drivers Sebastian Andrzej Siewior <bigeasy@linutronix.de> - 2016-08-18 15:00 +0200
  [PATCH 15/16] powerpc: powermac: Convert to hotplug state machine Sebastian Andrzej Siewior <bigeasy@linutronix.de> - 2016-08-18 15:00 +0200
  [PATCH 02/16] relayfs: Convert to hotplug state machine Sebastian Andrzej Siewior <bigeasy@linutronix.de> - 2016-08-18 15:00 +0200
  [PATCH 09/16] md: raid5: Convert to hotplug state machine Sebastian Andrzej Siewior <bigeasy@linutronix.de> - 2016-08-18 15:00 +0200
  [PATCH 11/16] cpuidle: powernv: Convert to hotplug state machine Sebastian Andrzej Siewior <bigeasy@linutronix.de> - 2016-08-18 15:00 +0200
    [PATCH 11/16] cpuidle: powernv: Convert to hotplug state machine Sebastian Andrzej Siewior <bigeasy@linutronix.de> - 2016-08-24 11:20 +0200
  [PATCH 16/16] powerpc: mmu nohash: Convert to hotplug state machine Sebastian Andrzej Siewior <bigeasy@linutronix.de> - 2016-08-18 15:00 +0200
  [PATCH 12/16] cpuidle: coupled: Convert to hotplug state machine Sebastian Andrzej Siewior <bigeasy@linutronix.de> - 2016-08-18 15:00 +0200
    Re: [PATCH 12/16] cpuidle: coupled: Convert to hotplug state machine Daniel Lezcano <daniel.lezcano@linaro.org> - 2016-08-23 16:30 +0200
      [PATCH 12/16 v2] cpuidle: coupled: Convert to hotplug state machine Sebastian Andrzej Siewior <bigeasy@linutronix.de> - 2016-08-24 11:20 +0200
  [PATCH 05/16] mm: writeback: Convert to hotplug state machine Sebastian Andrzej Siewior <bigeasy@linutronix.de> - 2016-08-18 15:10 +0200
  [PATCH 07/16] rcu: rcutorture: Convert to hotplug state machine Sebastian Andrzej Siewior <bigeasy@linutronix.de> - 2016-08-18 15:10 +0200
    Re: [PATCH 07/16] rcu: rcutorture: Convert to hotplug state machine "Paul E. McKenney" <paulmck@linux.vnet.ibm.com> - 2016-08-19 04:20 +0200
  [PATCH 06/16] kernel: softirq: Convert to hotplug state machine Sebastian Andrzej Siewior <bigeasy@linutronix.de> - 2016-08-18 15:10 +0200
  [PATCH 03/16] slab: Convert to hotplug state machine Sebastian Andrzej Siewior <bigeasy@linutronix.de> - 2016-08-18 15:10 +0200
    Re: [PATCH 03/16] slab: Convert to hotplug state machine Sebastian Andrzej Siewior <bigeasy@linutronix.de> - 2016-08-19 03:40 +0200
      [PATCH 03/16 v2] slab: Convert to hotplug state machine Sebastian Andrzej Siewior <bigeasy@linutronix.de> - 2016-08-23 15:00 +0200
  [PATCH 04/16] slub: Convert to hotplug state machine Sebastian Andrzej Siewior <bigeasy@linutronix.de> - 2016-08-18 15:10 +0200
  [PATCH 13/16] MIPS: BUS: CDMM: Convert to hotplug state machine Sebastian Andrzej Siewior <bigeasy@linutronix.de> - 2016-08-18 15:10 +0200
  [PATCH 01/16] cpuhotplug: Remove CPU_STARTING and CPU_DYING notifier Sebastian Andrzej Siewior <bigeasy@linutronix.de> - 2016-08-18 15:10 +0200
  Re: cpu hotplug: convert more drivers Ingo Molnar <mingo@kernel.org> - 2016-08-18 15:50 +0200

csiph-web