Skip to content

Commit

Permalink
mm/writeback: Convert to hotplug state machine
Browse files Browse the repository at this point in the history
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 <[email protected]>
Cc: Peter Zijlstra <[email protected]>
Cc: Jens Axboe <[email protected]>
Cc: [email protected]
Cc: [email protected]
Cc: Tejun Heo <[email protected]>
Link: http://lkml.kernel.org/r/[email protected]
Signed-off-by: Thomas Gleixner <[email protected]>
  • Loading branch information
Sebastian Andrzej Siewior authored and KAGA-KOKO committed Sep 6, 2016
1 parent a96a87b commit 1d7ac6a
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 19 deletions.
1 change: 1 addition & 0 deletions include/linux/cpuhotplug.h
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
26 changes: 7 additions & 19 deletions mm/page-writeback.c
Original file line number Diff line number Diff line change
Expand Up @@ -2080,26 +2080,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.
*
Expand All @@ -2122,8 +2108,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);
}

/**
Expand Down

0 comments on commit 1d7ac6a

Please sign in to comment.