Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 366057
b: refs/heads/master
c: 22cc4cc
h: refs/heads/master
i:
  366055: 4604eb6
v: v3
  • Loading branch information
Yan, Zheng authored and Ingo Molnar committed Apr 21, 2013
1 parent 3837078 commit 1fdffa1
Show file tree
Hide file tree
Showing 2 changed files with 26 additions and 4 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: 73e21ce28d8d2b75140b742b01373c3a085ecc52
refs/heads/master: 22cc4ccf63e10e361531bf61e6e6c96c53a2f665
28 changes: 25 additions & 3 deletions trunk/arch/x86/kernel/cpu/perf_event_intel_uncore.c
Original file line number Diff line number Diff line change
Expand Up @@ -2622,6 +2622,21 @@ static void __init uncore_pci_exit(void)
}
}

/* CPU hot plug/unplug are serialized by cpu_add_remove_lock mutex */
static LIST_HEAD(boxes_to_free);

static void __cpuinit uncore_kfree_boxes(void)
{
struct intel_uncore_box *box;

while (!list_empty(&boxes_to_free)) {
box = list_entry(boxes_to_free.next,
struct intel_uncore_box, list);
list_del(&box->list);
kfree(box);
}
}

static void __cpuinit uncore_cpu_dying(int cpu)
{
struct intel_uncore_type *type;
Expand All @@ -2636,7 +2651,7 @@ static void __cpuinit uncore_cpu_dying(int cpu)
box = *per_cpu_ptr(pmu->box, cpu);
*per_cpu_ptr(pmu->box, cpu) = NULL;
if (box && atomic_dec_and_test(&box->refcnt))
kfree(box);
list_add(&box->list, &boxes_to_free);
}
}
}
Expand Down Expand Up @@ -2666,8 +2681,11 @@ static int __cpuinit uncore_cpu_starting(int cpu)
if (exist && exist->phys_id == phys_id) {
atomic_inc(&exist->refcnt);
*per_cpu_ptr(pmu->box, cpu) = exist;
kfree(box);
box = NULL;
if (box) {
list_add(&box->list,
&boxes_to_free);
box = NULL;
}
break;
}
}
Expand Down Expand Up @@ -2806,6 +2824,10 @@ static int
case CPU_DYING:
uncore_cpu_dying(cpu);
break;
case CPU_ONLINE:
case CPU_DEAD:
uncore_kfree_boxes();
break;
default:
break;
}
Expand Down

0 comments on commit 1fdffa1

Please sign in to comment.