[PATCH] oprofile: hotplug cpu fixThis patch addresses problems when hotplugging cpus while profiling.Instead of allocating only online cpus, all possible cpu buffers areallocated, which allows cpus to be onlined during operation. If a cpu isofflined before profiling is shutdown wq_sync_buffer checks for thiscondition then cancels this work and does not sync this buffer.
From: Chris J Arges
Date: Wed Oct 15 2008 - 12:03:39 EST
---
drivers/oprofile/cpu_buffer.c | 9 +++++++--
1 files changed, 7 insertions(+), 2 deletions(-)
diff --git a/drivers/oprofile/cpu_buffer.c b/drivers/oprofile/cpu_buffer.c
index e1bd5a9..8bb030b 100644
--- a/drivers/oprofile/cpu_buffer.c
+++ b/drivers/oprofile/cpu_buffer.c
@@ -39,7 +39,7 @@ void free_cpu_buffers(void)
{
int i;
- for_each_online_cpu(i) {
+ for_each_possible_cpu(i) {
vfree(per_cpu(cpu_buffer, i).buffer);
per_cpu(cpu_buffer, i).buffer = NULL;
}
@@ -51,7 +51,7 @@ int alloc_cpu_buffers(void)
unsigned long buffer_size = fs_cpu_buffer_size;
- for_each_online_cpu(i) {
+ for_each_possible_cpu(i) {
struct oprofile_cpu_buffer *b = &per_cpu(cpu_buffer, i);
b->buffer = vmalloc_node(sizeof(struct op_sample) * buffer_size,
@@ -368,6 +368,11 @@ static void wq_sync_buffer(struct work_struct *work)
if (b->cpu != smp_processor_id()) {
printk(KERN_DEBUG "WQ on CPU%d, prefer CPU%d\n",
smp_processor_id(), b->cpu);
+
+ if (!cpu_online(b->cpu)) {
+ cancel_delayed_work(&b->work);
+ return;
+ }
}
sync_buffer(b->cpu);
--
1.5.4.5
Signed-off-by: Chris J Arges <arges@xxxxxxxxxxxxxxxxxx>
--------------040003040704030604010502--
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/