Commit 3d7851b3cdd43a734e5cc4c643fd886ab28ad4d5

Authored by Tejun Heo
Committed by Robert Richter
1 parent 4ac3dbec80

oprofile: Remove deprecated use of flush_scheduled_work()

flush_scheduled_work() is deprecated and scheduled to be removed.
sync_stop() currently cancels cpu_buffer works inside buffer_mutex and
flushes the system workqueue outside.  Instead, split end_cpu_work()
into two parts - stopping further work enqueues and flushing works -
and do the former inside buffer_mutex and latter outside.

For stable kernels v2.6.35.y and v2.6.36.y.

Signed-off-by: Tejun Heo <tj@kernel.org>
Cc: stable@kernel.org
Signed-off-by: Robert Richter <robert.richter@amd.com>

Showing 3 changed files with 9 additions and 4 deletions Side-by-side Diff

drivers/oprofile/buffer_sync.c
... ... @@ -190,7 +190,7 @@
190 190 profile_event_unregister(PROFILE_TASK_EXIT, &task_exit_nb);
191 191 task_handoff_unregister(&task_free_nb);
192 192 mutex_unlock(&buffer_mutex);
193   - flush_scheduled_work();
  193 + flush_cpu_work();
194 194  
195 195 /* make sure we don't leak task structs */
196 196 process_task_mortuary();
drivers/oprofile/cpu_buffer.c
... ... @@ -111,14 +111,18 @@
111 111  
112 112 void end_cpu_work(void)
113 113 {
114   - int i;
115   -
116 114 work_enabled = 0;
  115 +}
117 116  
  117 +void flush_cpu_work(void)
  118 +{
  119 + int i;
  120 +
118 121 for_each_online_cpu(i) {
119 122 struct oprofile_cpu_buffer *b = &per_cpu(op_cpu_buffer, i);
120 123  
121   - cancel_delayed_work(&b->work);
  124 + /* these works are per-cpu, no need for flush_sync */
  125 + flush_delayed_work(&b->work);
122 126 }
123 127 }
124 128  
drivers/oprofile/cpu_buffer.h
... ... @@ -25,6 +25,7 @@
25 25  
26 26 void start_cpu_work(void);
27 27 void end_cpu_work(void);
  28 +void flush_cpu_work(void);
28 29  
29 30 /* CPU buffer is composed of such entries (which are
30 31 * also used for context switch notes)