Skip to content

Commit 4c50d9e

Browse files
Robert RichterIngo Molnar
authored andcommitted
cpumask: modifiy oprofile initialization
Delta patch to f7df8ed for tip/cpus4096. Moved initialization to sync_start()/sync_stop(). No changes needed in buffer_sync.h and oprof.c anymore. Signed-off-by: Robert Richter <robert.richter@amd.com> Signed-off-by: Ingo Molnar <mingo@elte.hu>
1 parent 5766b84 commit 4c50d9e

3 files changed

Lines changed: 7 additions & 26 deletions

File tree

‎drivers/oprofile/buffer_sync.c‎

Lines changed: 6 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -154,6 +154,10 @@ int sync_start(void)
154154
{
155155
int err;
156156

157+
if (!alloc_cpumask_var(&marked_cpus, GFP_KERNEL))
158+
return -ENOMEM;
159+
cpumask_clear(marked_cpus);
160+
157161
start_cpu_work();
158162

159163
err = task_handoff_register(&task_free_nb);
@@ -179,6 +183,7 @@ int sync_start(void)
179183
task_handoff_unregister(&task_free_nb);
180184
out1:
181185
end_sync();
186+
free_cpumask_var(marked_cpus);
182187
goto out;
183188
}
184189

@@ -190,6 +195,7 @@ void sync_stop(void)
190195
profile_event_unregister(PROFILE_TASK_EXIT, &task_exit_nb);
191196
task_handoff_unregister(&task_free_nb);
192197
end_sync();
198+
free_cpumask_var(marked_cpus);
193199
}
194200

195201

@@ -565,20 +571,6 @@ void sync_buffer(int cpu)
565571
mutex_unlock(&buffer_mutex);
566572
}
567573

568-
int __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-
577-
void __exit buffer_sync_cleanup(void)
578-
{
579-
free_cpumask_var(marked_cpus);
580-
}
581-
582574
/* The function can be used to add a buffer worth of data directly to
583575
* the kernel buffer. The buffer is assumed to be a circular buffer.
584576
* Take the entries from index start and end at index end, wrapping

‎drivers/oprofile/buffer_sync.h‎

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -19,8 +19,4 @@ void sync_stop(void);
1919
/* sync the given CPU's buffer */
2020
void sync_buffer(int cpu);
2121

22-
/* initialize/destroy the buffer system. */
23-
int buffer_sync_init(void);
24-
void buffer_sync_cleanup(void);
25-
2622
#endif /* OPROFILE_BUFFER_SYNC_H */

‎drivers/oprofile/oprof.c‎

Lines changed: 1 addition & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -183,10 +183,6 @@ static int __init oprofile_init(void)
183183
{
184184
int err;
185185

186-
err = buffer_sync_init();
187-
if (err)
188-
return err;
189-
190186
err = oprofile_arch_init(&oprofile_ops);
191187

192188
if (err < 0 || timer) {
@@ -195,10 +191,8 @@ static int __init oprofile_init(void)
195191
}
196192

197193
err = oprofilefs_register();
198-
if (err) {
194+
if (err)
199195
oprofile_arch_exit();
200-
buffer_sync_cleanup();
201-
}
202196

203197
return err;
204198
}
@@ -208,7 +202,6 @@ static void __exit oprofile_exit(void)
208202
{
209203
oprofilefs_unregister();
210204
oprofile_arch_exit();
211-
buffer_sync_cleanup();
212205
}
213206

214207

0 commit comments

Comments
 (0)