Skip to content

Commit

Permalink
cpumask: modifiy oprofile initialization
Browse files Browse the repository at this point in the history
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 <[email protected]>
Signed-off-by: Ingo Molnar <[email protected]>
  • Loading branch information
Robert Richter authored and Ingo Molnar committed Jan 22, 2009
1 parent 5766b84 commit 4c50d9e
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 26 deletions.
20 changes: 6 additions & 14 deletions drivers/oprofile/buffer_sync.c
Original file line number Diff line number Diff line change
Expand Up @@ -154,6 +154,10 @@ int sync_start(void)
{
int err;

if (!alloc_cpumask_var(&marked_cpus, GFP_KERNEL))
return -ENOMEM;
cpumask_clear(marked_cpus);

start_cpu_work();

err = task_handoff_register(&task_free_nb);
Expand All @@ -179,6 +183,7 @@ int sync_start(void)
task_handoff_unregister(&task_free_nb);
out1:
end_sync();
free_cpumask_var(marked_cpus);
goto out;
}

Expand All @@ -190,6 +195,7 @@ void sync_stop(void)
profile_event_unregister(PROFILE_TASK_EXIT, &task_exit_nb);
task_handoff_unregister(&task_free_nb);
end_sync();
free_cpumask_var(marked_cpus);
}


Expand Down Expand Up @@ -565,20 +571,6 @@ void sync_buffer(int cpu)
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 kernel buffer. The buffer is assumed to be a circular buffer.
* Take the entries from index start and end at index end, wrapping
Expand Down
4 changes: 0 additions & 4 deletions drivers/oprofile/buffer_sync.h
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,4 @@ void sync_stop(void);
/* sync the given CPU's buffer */
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 */
9 changes: 1 addition & 8 deletions drivers/oprofile/oprof.c
Original file line number Diff line number Diff line change
Expand Up @@ -183,10 +183,6 @@ static int __init oprofile_init(void)
{
int err;

err = buffer_sync_init();
if (err)
return err;

err = oprofile_arch_init(&oprofile_ops);

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

err = oprofilefs_register();
if (err) {
if (err)
oprofile_arch_exit();
buffer_sync_cleanup();
}

return err;
}
Expand All @@ -208,7 +202,6 @@ static void __exit oprofile_exit(void)
{
oprofilefs_unregister();
oprofile_arch_exit();
buffer_sync_cleanup();
}


Expand Down

0 comments on commit 4c50d9e

Please sign in to comment.