Skip to content

Commit

Permalink
oprofile: Remove deprecated use of flush_scheduled_work()
Browse files Browse the repository at this point in the history
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 <[email protected]>
Cc: [email protected]
Signed-off-by: Robert Richter <[email protected]>
  • Loading branch information
htejun authored and Robert Richter committed Oct 29, 2010
1 parent 4ac3dbe commit 3d7851b
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 4 deletions.
2 changes: 1 addition & 1 deletion drivers/oprofile/buffer_sync.c
Original file line number Diff line number Diff line change
Expand Up @@ -190,7 +190,7 @@ void sync_stop(void)
profile_event_unregister(PROFILE_TASK_EXIT, &task_exit_nb);
task_handoff_unregister(&task_free_nb);
mutex_unlock(&buffer_mutex);
flush_scheduled_work();
flush_cpu_work();

/* make sure we don't leak task structs */
process_task_mortuary();
Expand Down
10 changes: 7 additions & 3 deletions drivers/oprofile/cpu_buffer.c
Original file line number Diff line number Diff line change
Expand Up @@ -111,14 +111,18 @@ void start_cpu_work(void)

void end_cpu_work(void)
{
int i;

work_enabled = 0;
}

void flush_cpu_work(void)
{
int i;

for_each_online_cpu(i) {
struct oprofile_cpu_buffer *b = &per_cpu(op_cpu_buffer, i);

cancel_delayed_work(&b->work);
/* these works are per-cpu, no need for flush_sync */
flush_delayed_work(&b->work);
}
}

Expand Down
1 change: 1 addition & 0 deletions drivers/oprofile/cpu_buffer.h
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ void free_cpu_buffers(void);

void start_cpu_work(void);
void end_cpu_work(void);
void flush_cpu_work(void);

/* CPU buffer is composed of such entries (which are
* also used for context switch notes)
Expand Down

0 comments on commit 3d7851b

Please sign in to comment.