aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSebastian Andrzej Siewior <bigeasy@linutronix.de>2016-08-18 08:57:20 -0400
committerThomas Gleixner <tglx@linutronix.de>2016-09-06 12:30:20 -0400
commit1d7ac6aec947d222042b6d22b3cec109db4fd19e (patch)
treeb89b1745cde730a020147b6e54d0c93c4c405a87
parenta96a87bf949d249039cdf532bb5f5d06622cc5e2 (diff)
mm/writeback: Convert to hotplug state machine
Install the callbacks via the state machine and let the core invoke the callbacks on the already online CPUs. Signed-off-by: Sebastian Andrzej Siewior <bigeasy@linutronix.de> Cc: Peter Zijlstra <peterz@infradead.org> Cc: Jens Axboe <axboe@fb.com> Cc: linux-mm@kvack.org Cc: rt@linutronix.de Cc: Tejun Heo <tj@kernel.org> Link: http://lkml.kernel.org/r/20160818125731.27256-6-bigeasy@linutronix.de Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
-rw-r--r--include/linux/cpuhotplug.h1
-rw-r--r--mm/page-writeback.c26
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 {
16 CPUHP_X86_APB_DEAD, 16 CPUHP_X86_APB_DEAD,
17 CPUHP_VIRT_NET_DEAD, 17 CPUHP_VIRT_NET_DEAD,
18 CPUHP_SLUB_DEAD, 18 CPUHP_SLUB_DEAD,
19 CPUHP_MM_WRITEBACK_DEAD,
19 CPUHP_WORKQUEUE_PREP, 20 CPUHP_WORKQUEUE_PREP,
20 CPUHP_POWER_NUMA_PREPARE, 21 CPUHP_POWER_NUMA_PREPARE,
21 CPUHP_HRTIMERS_PREPARE, 22 CPUHP_HRTIMERS_PREPARE,
diff --git a/mm/page-writeback.c b/mm/page-writeback.c
index f4cd7d8005c9..28d6f36a2d79 100644
--- a/mm/page-writeback.c
+++ b/mm/page-writeback.c
@@ -2080,26 +2080,12 @@ void writeback_set_ratelimit(void)
2080 ratelimit_pages = 16; 2080 ratelimit_pages = 16;
2081} 2081}
2082 2082
2083static int 2083static int page_writeback_cpu_online(unsigned int cpu)
2084ratelimit_handler(struct notifier_block *self, unsigned long action,
2085 void *hcpu)
2086{ 2084{
2087 2085 writeback_set_ratelimit();
2088 switch (action & ~CPU_TASKS_FROZEN) { 2086 return 0;
2089 case CPU_ONLINE:
2090 case CPU_DEAD:
2091 writeback_set_ratelimit();
2092 return NOTIFY_OK;
2093 default:
2094 return NOTIFY_DONE;
2095 }
2096} 2087}
2097 2088
2098static struct notifier_block ratelimit_nb = {
2099 .notifier_call = ratelimit_handler,
2100 .next = NULL,
2101};
2102
2103/* 2089/*
2104 * Called early on to tune the page writeback dirty limits. 2090 * Called early on to tune the page writeback dirty limits.
2105 * 2091 *
@@ -2122,8 +2108,10 @@ void __init page_writeback_init(void)
2122{ 2108{
2123 BUG_ON(wb_domain_init(&global_wb_domain, GFP_KERNEL)); 2109 BUG_ON(wb_domain_init(&global_wb_domain, GFP_KERNEL));
2124 2110
2125 writeback_set_ratelimit(); 2111 cpuhp_setup_state(CPUHP_AP_ONLINE_DYN, "mm/writeback:online",
2126 register_cpu_notifier(&ratelimit_nb); 2112 page_writeback_cpu_online, NULL);
2113 cpuhp_setup_state(CPUHP_MM_WRITEBACK_DEAD, "mm/writeback:dead", NULL,
2114 page_writeback_cpu_online);
2127} 2115}
2128 2116
2129/** 2117/**