aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--drivers/oprofile/buffer_sync.c8
1 files changed, 2 insertions, 6 deletions
diff --git a/drivers/oprofile/buffer_sync.c b/drivers/oprofile/buffer_sync.c
index 04250aa16f51..f34b5b29fb95 100644
--- a/drivers/oprofile/buffer_sync.c
+++ b/drivers/oprofile/buffer_sync.c
@@ -155,8 +155,6 @@ int sync_start(void)
155 if (!zalloc_cpumask_var(&marked_cpus, GFP_KERNEL)) 155 if (!zalloc_cpumask_var(&marked_cpus, GFP_KERNEL))
156 return -ENOMEM; 156 return -ENOMEM;
157 157
158 mutex_lock(&buffer_mutex);
159
160 err = task_handoff_register(&task_free_nb); 158 err = task_handoff_register(&task_free_nb);
161 if (err) 159 if (err)
162 goto out1; 160 goto out1;
@@ -173,7 +171,6 @@ int sync_start(void)
173 start_cpu_work(); 171 start_cpu_work();
174 172
175out: 173out:
176 mutex_unlock(&buffer_mutex);
177 return err; 174 return err;
178out4: 175out4:
179 profile_event_unregister(PROFILE_MUNMAP, &munmap_nb); 176 profile_event_unregister(PROFILE_MUNMAP, &munmap_nb);
@@ -190,14 +187,13 @@ out1:
190 187
191void sync_stop(void) 188void sync_stop(void)
192{ 189{
193 /* flush buffers */
194 mutex_lock(&buffer_mutex);
195 end_cpu_work(); 190 end_cpu_work();
196 unregister_module_notifier(&module_load_nb); 191 unregister_module_notifier(&module_load_nb);
197 profile_event_unregister(PROFILE_MUNMAP, &munmap_nb); 192 profile_event_unregister(PROFILE_MUNMAP, &munmap_nb);
198 profile_event_unregister(PROFILE_TASK_EXIT, &task_exit_nb); 193 profile_event_unregister(PROFILE_TASK_EXIT, &task_exit_nb);
199 task_handoff_unregister(&task_free_nb); 194 task_handoff_unregister(&task_free_nb);
200 mutex_unlock(&buffer_mutex); 195 barrier(); /* do all of the above first */
196
201 flush_cpu_work(); 197 flush_cpu_work();
202 198
203 free_all_tasks(); 199 free_all_tasks();