memory_hotplug: drop spurious calls to flush_scheduled_work()
Subsystems (3)
Tejun Heo
maintainerPATCH 1/1 memory_hotplug: drop spurious calls to flush_scheduled_work()
lru_add_drain_all() uses schedule_on_each_cpu() which is synchronous. There is no reason to call flush_scheduled_work() after lru_add_drain_all(). Drop the spurious calls.
This is to prepare for the deprecation and removal of flush_scheduled_work().
--- mm/memory_hotplug.c | 2 -- 1 file changed, 2 deletions(-)
mm/memory_hotplug.c +0 -2
@@ -840,7 +840,6 @@ repeat: ret =0 ;if (drain) {lru_add_drain_all (); -flush_scheduled_work ();cond_resched ();drain_all_pages (); }
@@ -862,7 +861,6 @@ repeat: }/* drain all zone's lru pagevec, this is asyncronous... */ lru_add_drain_all (); -flush_scheduled_work ();yield ();/* drain pcp pages , this is synchrouns. */ drain_all_pages ();
Quoted 8 lines · On Fri, 15 Oct 2010 17:25:15 +0200 Tejun Heo <[email protected]> wrote:
lru_add_drain_all()usesschedule_on_each_cpu()which is synchronous. There is no reason to callflush_scheduled_work()afterlru_add_drain_all(). Drop the spurious calls.This is to prepare for the deprecation and removal of
flush_scheduled_work().Signed-off-by Tejun Heo <[email protected]>
Tejun Heo
maintainerHello,
Quoted 7 lines · KAMEZAWA Hiroyuki
Quoted 4 lines · On Fri, 15 Oct 2010 17:25:15 +0200 Tejun Heo <[email protected]> wrote:
lru_add_drain_all()usesschedule_on_each_cpu()which is synchronous. There is no reason to callflush_scheduled_work()afterlru_add_drain_all(). Drop the spurious calls.
Quoted 5 lines
Quoted 4 lines
This is to prepare for the deprecation and removal of
flush_scheduled_work().Signed-off-by Tejun Heo <[email protected]>
Through which tree should this be routed? Shall I route this via the wq tree?
Thank you.
Signature · 1 line
tejun
Quoted 8 lines · Tejun Heo
lru_add_drain_all()usesschedule_on_each_cpu()which is synchronous. There is no reason to callflush_scheduled_work()afterlru_add_drain_all(). Drop the spurious calls.This is to prepare for the deprecation and removal of
flush_scheduled_work().Signed-off-by Tejun Heo <[email protected]>
Signature · 2 lines
Kind regards, Minchan Kim
Quoted 4 lines · Tejun Heo
lru_add_drain_all()usesschedule_on_each_cpu()which is synchronous. There is no reason to callflush_scheduled_work()afterlru_add_drain_all(). Drop the spurious calls.
This looks correct.
I suspect this call to flush_scheduled_work() existed because it is easy to interpret the documentation of schedule_on_each_cpu to mean it is an asynchronous call. Maybe something like the following?
==== CUT HERE ====
workqueue: Clarify that schedule_on_each_cpu is synchronous
The documentation for schedule_on_each_cpu() states that it calls a function on each online CPU from keventd. This can easily be interpreted as an asyncronous call because the description does not mention that flush_work is called. Clarify that it is synchronous.
--- kernel/workqueue.c | 8 +++++--- 1 files changed, 5 insertions(+), 3 deletions(-)
kernel/workqueue.c +5 -3
@@ -2592,13 +2592,15 @@ int schedule_delayed_work_on(int cpu,EXPORT_SYMBOL (schedule_delayed_work_on);/** -* schedule_on_each_cpu - call a function on each online CPU from keventd +* schedule_on_each_cpu - Call a function on each online CPU via keventd and wait for completion * @func: the function to call * +* schedule_on_each_cpu executes a given callback function on each CPU via keventd +* and blocks until each callback has completed. schedule_on_each_cpu() is very +* slow. +* * Returns zero on success. * Returns -ve errno on failure. -* -* schedule_on_each_cpu() is very slow. */ int schedule_on_each_cpu (work_func_t func) {
Quoted 10 lines · On Mon, 18 Oct 2010 07:03:37 +0200 Tejun Heo <[email protected]> wrote:
Hello,
Quoted 7 lines · KAMEZAWA Hiroyuki
Quoted 4 lines · On Fri, 15 Oct 2010 17:25:15 +0200 Tejun Heo <[email protected]> wrote:
lru_add_drain_all()usesschedule_on_each_cpu()which is synchronous. There is no reason to callflush_scheduled_work()afterlru_add_drain_all(). Drop the spurious calls.
Quoted 9 lines
Quoted 5 lines
Quoted 4 lines
This is to prepare for the deprecation and removal of
flush_scheduled_work().Signed-off-by Tejun Heo <[email protected]>Through which tree should this be routed? Shall I route this via the wq tree?
please.
Thank,
-Kame
KOSAKI Motohiro
Reviewed-byQuoted 37 lines · Tejun Heo
Quoted 4 lines
lru_add_drain_all()usesschedule_on_each_cpu()which is synchronous. There is no reason to callflush_scheduled_work()afterlru_add_drain_all(). Drop the spurious calls.This looks correct.
Acked-by Mel Gorman <[email protected]>I suspect this call to
flush_scheduled_work()existed because it is easy to interpret the documentation ofschedule_on_each_cputo mean it is an asynchronous call. Maybe something like the following?==== CUT HERE ====
workqueue: Clarify thatschedule_on_each_cpuis synchronousThe documentation for
schedule_on_each_cpu()states that it calls a function on each online CPU from keventd. This can easily be interpreted as an asyncronous call because the description does not mention thatflush_workis called. Clarify that it is synchronous.Signed-off-by Mel Gorman <[email protected]>--- kernel/workqueue.c | 8 +++++--- 1 files changed, 5 insertions(+), 3 deletions(-)kernel/workqueue.c +1
-1@@ -2592,13 +2592,15 @@ int schedule_delayed_work_on(int cpu,EXPORT_SYMBOL (schedule_delayed_work_on);/** -* schedule_on_each_cpu - call a function on each online CPU from keventd +* schedule_on_each_cpu - Call a function on each online CPU via keventd and wait for completion
kernel/workqueue.c int schedule_delayed_work_on(int cpu, · line 2601
Quoted 10 lines
kernel/workqueue.c +4
-2* @func: the function to call * +* schedule_on_each_cpu executes a given callback function on each CPU via keventd +* and blocks until each callback has completed. schedule_on_each_cpu() is very +* slow. +* * Returns zero on success. * Returns -ve errno on failure. -* -* schedule_on_each_cpu() is very slow.
Nice!
Tejun Heo
maintainerPATCH 1/1 workqueue: Clarify that schedule_on_each_cpu is synchronous
The documentation for schedule_on_each_cpu() states that it calls a function on each online CPU from keventd. This can easily be interpreted as an asyncronous call because the description does not mention that flush_work is called. Clarify that it is synchronous.
tj: rephrased a bit
---
Commited somewhat rephrased version. Thank you.
kernel/workqueue.c | 10 ++++++---- 1 files changed, 6 insertions(+), 4 deletions(-)
kernel/workqueue.c +6 -4
@@ -2676,13 +2676,15 @@ int schedule_delayed_work_on(int cpu,EXPORT_SYMBOL (schedule_delayed_work_on);/** -* schedule_on_each_cpu - call a function on each online CPU from keventd +* schedule_on_each_cpu - execute a function synchronously on each online CPU * @func: the function to call * -* Returns zero on success. -* Returns -ve errno on failure. -* +* schedule_on_each_cpu() executes @func on each online CPU using the +* system workqueue and blocks until all CPUs have completed. * schedule_on_each_cpu() is very slow. +* +* RETURNS: +* 0 on success, -errno on failure. */ int schedule_on_each_cpu (work_func_t func) {
Signature · 1 line
1.7.1
Quoted 4 lines · KAMEZAWA Hiroyuki
Quoted 3 lines
Through which tree should this be routed? Shall I route this via the wq tree?
please.
Applied to wq#for-next. Thank you.
Signature · 1 line
tejun
Re: [PATCH wq#for-next] workqueue: Clarify that schedule_on_each_cpu is synchronous
In reply to Tejun HeoQuoted 10 lines · On Tue, 19 Oct 2010 11:18:46 +0200 Tejun Heo <[email protected]> wrote:
The documentation for
schedule_on_each_cpu()states that it calls a function on each online CPU from keventd. This can easily be interpreted as an asyncronous call because the description does not mention thatflush_workis called. Clarify that it is synchronous.tj: rephrased a bit
Signed-off-by Mel Gorman <[email protected]>Reviewed-by KOSAKI Motohiro <[email protected]>Signed-off-by Tejun Heo <[email protected]>
Re: [PATCH wq#for-next] workqueue: Clarify that schedule_on_each_cpu is synchronous
In reply to Tejun HeoQuoted 10 lines · Tejun Heo
The documentation for
schedule_on_each_cpu()states that it calls a function on each online CPU from keventd. This can easily be interpreted as an asyncronous call because the description does not mention thatflush_workis called. Clarify that it is synchronous.tj: rephrased a bit
Signed-off-by Mel Gorman <[email protected]>Reviewed-by KOSAKI Motohiro <[email protected]>Signed-off-by Tejun Heo <[email protected]>
Nice comment!