Commit 319cb26c authored by Anton Blanchard's avatar Anton Blanchard Committed by Linus Torvalds

[PATCH] use for_each_cpu in oprofile code

Replace open coded versions with for_each_cpu()/for_each_online_cpu().
Signed-off-by: default avatarAnton Blanchard <anton@samba.org>
Signed-off-by: default avatarAndrew Morton <akpm@osdl.org>
Signed-off-by: default avatarLinus Torvalds <torvalds@osdl.org>
parent 185764d1
......@@ -36,11 +36,8 @@ static void __free_cpu_buffers(int num)
{
int i;
for (i = 0; i < NR_CPUS; ++i) {
if (!cpu_online(i))
continue;
for_each_online_cpu(i)
vfree(cpu_buffer[i].buffer);
}
}
......@@ -50,12 +47,9 @@ int alloc_cpu_buffers(void)
unsigned long buffer_size = fs_cpu_buffer_size;
for (i = 0; i < NR_CPUS; ++i) {
for_each_online_cpu(i) {
struct oprofile_cpu_buffer * b = &cpu_buffer[i];
if (!cpu_online(i))
continue;
b->buffer = vmalloc(sizeof(struct op_sample) * buffer_size);
if (!b->buffer)
goto fail;
......@@ -94,12 +88,9 @@ void start_cpu_timers(void)
timers_enabled = 1;
for (i = 0; i < NR_CPUS; ++i) {
for_each_online_cpu(i) {
struct oprofile_cpu_buffer * b = &cpu_buffer[i];
if (!cpu_online(i))
continue;
add_timer_on(&b->timer, i);
}
}
......@@ -111,12 +102,9 @@ void end_cpu_timers(void)
timers_enabled = 0;
for (i = 0; i < NR_CPUS; ++i) {
for_each_online_cpu(i) {
struct oprofile_cpu_buffer * b = &cpu_buffer[i];
if (!cpu_online(i))
continue;
del_timer_sync(&b->timer);
}
......
......@@ -22,10 +22,7 @@ void oprofile_reset_stats(void)
struct oprofile_cpu_buffer * cpu_buf;
int i;
for (i = 0; i < NR_CPUS; ++i) {
if (!cpu_possible(i))
continue;
for_each_cpu(i) {
cpu_buf = &cpu_buffer[i];
cpu_buf->sample_received = 0;
cpu_buf->sample_lost_overflow = 0;
......@@ -49,10 +46,7 @@ void oprofile_create_stats_files(struct super_block * sb, struct dentry * root)
if (!dir)
return;
for (i = 0; i < NR_CPUS; ++i) {
if (!cpu_possible(i))
continue;
for_each_cpu(i) {
cpu_buf = &cpu_buffer[i];
snprintf(buf, 10, "cpu%d", i);
cpudir = oprofilefs_mkdir(sb, dir, buf);
......
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