Commit 4c50d9ea authored by Robert Richter's avatar Robert Richter Committed by Ingo Molnar

cpumask: modifiy oprofile initialization

Delta patch to f7df8ed1 for
tip/cpus4096.

Moved initialization to sync_start()/sync_stop(). No changes needed in
buffer_sync.h and oprof.c anymore.
Signed-off-by: default avatarRobert Richter <robert.richter@amd.com>
Signed-off-by: default avatarIngo Molnar <mingo@elte.hu>
parent 5766b842
...@@ -154,6 +154,10 @@ int sync_start(void) ...@@ -154,6 +154,10 @@ int sync_start(void)
{ {
int err; int err;
if (!alloc_cpumask_var(&marked_cpus, GFP_KERNEL))
return -ENOMEM;
cpumask_clear(marked_cpus);
start_cpu_work(); start_cpu_work();
err = task_handoff_register(&task_free_nb); err = task_handoff_register(&task_free_nb);
...@@ -179,6 +183,7 @@ int sync_start(void) ...@@ -179,6 +183,7 @@ int sync_start(void)
task_handoff_unregister(&task_free_nb); task_handoff_unregister(&task_free_nb);
out1: out1:
end_sync(); end_sync();
free_cpumask_var(marked_cpus);
goto out; goto out;
} }
...@@ -190,6 +195,7 @@ void sync_stop(void) ...@@ -190,6 +195,7 @@ void sync_stop(void)
profile_event_unregister(PROFILE_TASK_EXIT, &task_exit_nb); profile_event_unregister(PROFILE_TASK_EXIT, &task_exit_nb);
task_handoff_unregister(&task_free_nb); task_handoff_unregister(&task_free_nb);
end_sync(); end_sync();
free_cpumask_var(marked_cpus);
} }
...@@ -565,20 +571,6 @@ void sync_buffer(int cpu) ...@@ -565,20 +571,6 @@ void sync_buffer(int cpu)
mutex_unlock(&buffer_mutex); mutex_unlock(&buffer_mutex);
} }
int __init buffer_sync_init(void)
{
if (!alloc_cpumask_var(&marked_cpus, GFP_KERNEL))
return -ENOMEM;
cpumask_clear(marked_cpus);
return 0;
}
void __exit buffer_sync_cleanup(void)
{
free_cpumask_var(marked_cpus);
}
/* The function can be used to add a buffer worth of data directly to /* The function can be used to add a buffer worth of data directly to
* the kernel buffer. The buffer is assumed to be a circular buffer. * the kernel buffer. The buffer is assumed to be a circular buffer.
* Take the entries from index start and end at index end, wrapping * Take the entries from index start and end at index end, wrapping
......
...@@ -19,8 +19,4 @@ void sync_stop(void); ...@@ -19,8 +19,4 @@ void sync_stop(void);
/* sync the given CPU's buffer */ /* sync the given CPU's buffer */
void sync_buffer(int cpu); void sync_buffer(int cpu);
/* initialize/destroy the buffer system. */
int buffer_sync_init(void);
void buffer_sync_cleanup(void);
#endif /* OPROFILE_BUFFER_SYNC_H */ #endif /* OPROFILE_BUFFER_SYNC_H */
...@@ -183,10 +183,6 @@ static int __init oprofile_init(void) ...@@ -183,10 +183,6 @@ static int __init oprofile_init(void)
{ {
int err; int err;
err = buffer_sync_init();
if (err)
return err;
err = oprofile_arch_init(&oprofile_ops); err = oprofile_arch_init(&oprofile_ops);
if (err < 0 || timer) { if (err < 0 || timer) {
...@@ -195,10 +191,8 @@ static int __init oprofile_init(void) ...@@ -195,10 +191,8 @@ static int __init oprofile_init(void)
} }
err = oprofilefs_register(); err = oprofilefs_register();
if (err) { if (err)
oprofile_arch_exit(); oprofile_arch_exit();
buffer_sync_cleanup();
}
return err; return err;
} }
...@@ -208,7 +202,6 @@ static void __exit oprofile_exit(void) ...@@ -208,7 +202,6 @@ static void __exit oprofile_exit(void)
{ {
oprofilefs_unregister(); oprofilefs_unregister();
oprofile_arch_exit(); oprofile_arch_exit();
buffer_sync_cleanup();
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment