Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 218631
b: refs/heads/master
c: 65af94b
h: refs/heads/master
i:
  218629: b79c89b
  218627: 82310d5
  218623: b377a33
v: v3
  • Loading branch information
Peter Zijlstra authored and Ingo Molnar committed Oct 22, 2010
1 parent d4862b9 commit 7148736
Show file tree
Hide file tree
Showing 2 changed files with 27 additions and 15 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: 5ee25c87318fa3722026fd77089fa7ba0db8d447
refs/heads/master: 65af94baca56beb3514d6cfce782634db9cf676d
40 changes: 26 additions & 14 deletions trunk/arch/x86/kernel/cpu/perf_event_intel_ds.c
Original file line number Diff line number Diff line change
Expand Up @@ -148,6 +148,30 @@ static void release_bts_buffer(int cpu)
ds->bts_buffer_base = 0;
}

static int alloc_ds_buffer(int cpu)
{
struct debug_store *ds;

ds = kzalloc(sizeof(*ds), GFP_KERNEL);
if (unlikely(!ds))
return -ENOMEM;

per_cpu(cpu_hw_events, cpu).ds = ds;

return 0;
}

static void release_ds_buffer(int cpu)
{
struct debug_store *ds = per_cpu(cpu_hw_events, cpu).ds;

if (!ds)
return;

per_cpu(cpu_hw_events, cpu).ds = NULL;
kfree(ds);
}

static void release_ds_buffers(void)
{
int cpu;
Expand All @@ -160,16 +184,9 @@ static void release_ds_buffers(void)
fini_debug_store_on_cpu(cpu);

for_each_possible_cpu(cpu) {
struct debug_store *ds = per_cpu(cpu_hw_events, cpu).ds;

if (!ds)
continue;

release_pebs_buffer(cpu);
release_bts_buffer(cpu);

per_cpu(cpu_hw_events, cpu).ds = NULL;
kfree(ds);
release_ds_buffer(cpu);
}
put_online_cpus();
}
Expand All @@ -184,13 +201,8 @@ static int reserve_ds_buffers(void)
get_online_cpus();

for_each_possible_cpu(cpu) {
struct debug_store *ds;

err = -ENOMEM;
ds = kzalloc(sizeof(*ds), GFP_KERNEL);
if (unlikely(!ds))
if (alloc_ds_buffer(cpu))
break;
per_cpu(cpu_hw_events, cpu).ds = ds;

if (alloc_bts_buffer(cpu))
break;
Expand Down

0 comments on commit 7148736

Please sign in to comment.