aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/oprofile/buffer_sync.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/oprofile/buffer_sync.c')
-rw-r--r--drivers/oprofile/buffer_sync.c20
1 files changed, 6 insertions, 14 deletions
diff --git a/drivers/oprofile/buffer_sync.c b/drivers/oprofile/buffer_sync.c
index c3ea5fa7d05a..8574622e36a5 100644
--- a/drivers/oprofile/buffer_sync.c
+++ b/drivers/oprofile/buffer_sync.c
@@ -154,6 +154,10 @@ int sync_start(void)
154{ 154{
155 int err; 155 int err;
156 156
157 if (!alloc_cpumask_var(&marked_cpus, GFP_KERNEL))
158 return -ENOMEM;
159 cpumask_clear(marked_cpus);
160
157 start_cpu_work(); 161 start_cpu_work();
158 162
159 err = task_handoff_register(&task_free_nb); 163 err = task_handoff_register(&task_free_nb);
@@ -179,6 +183,7 @@ out2:
179 task_handoff_unregister(&task_free_nb); 183 task_handoff_unregister(&task_free_nb);
180out1: 184out1:
181 end_sync(); 185 end_sync();
186 free_cpumask_var(marked_cpus);
182 goto out; 187 goto out;
183} 188}
184 189
@@ -190,6 +195,7 @@ void sync_stop(void)
190 profile_event_unregister(PROFILE_TASK_EXIT, &task_exit_nb); 195 profile_event_unregister(PROFILE_TASK_EXIT, &task_exit_nb);
191 task_handoff_unregister(&task_free_nb); 196 task_handoff_unregister(&task_free_nb);
192 end_sync(); 197 end_sync();
198 free_cpumask_var(marked_cpus);
193} 199}
194 200
195 201
@@ -565,20 +571,6 @@ void sync_buffer(int cpu)
565 mutex_unlock(&buffer_mutex); 571 mutex_unlock(&buffer_mutex);
566} 572}
567 573
568int __init buffer_sync_init(void)
569{
570 if (!alloc_cpumask_var(&marked_cpus, GFP_KERNEL))
571 return -ENOMEM;
572
573 cpumask_clear(marked_cpus);
574 return 0;
575}
576
577void __exit buffer_sync_cleanup(void)
578{
579 free_cpumask_var(marked_cpus);
580}
581
582/* The function can be used to add a buffer worth of data directly to 574/* The function can be used to add a buffer worth of data directly to
583 * the kernel buffer. The buffer is assumed to be a circular buffer. 575 * the kernel buffer. The buffer is assumed to be a circular buffer.
584 * Take the entries from index start and end at index end, wrapping 576 * Take the entries from index start and end at index end, wrapping