Re: [patch] rt: fix ipi kfree(), introduce IPI_SOFTIRQ

From: Peter Zijlstra
Date: Thu Feb 12 2009 - 04:21:15 EST


On Thu, 2009-02-12 at 09:19 +0100, Ingo Molnar wrote:
> * Ingo Molnar <mingo@xxxxxxx> wrote:
>
> > hm, that's a complex one - we do kfree() from IPI context, [...]
>
> The patch below might do the trick - it offloads this to a softirq.
> Not tested yet.

The simple fix is something like:

---
kernel/smp.c | 8 ++++++++
1 files changed, 8 insertions(+), 0 deletions(-)

diff --git a/kernel/smp.c b/kernel/smp.c
index bbedbb7..9b974c1 100644
--- a/kernel/smp.c
+++ b/kernel/smp.c
@@ -252,7 +252,11 @@ int smp_call_function_single(int cpu, void (*func) (void *info), void *info,
* will make sure the callee is done with the
* data before a new caller will use it.
*/
+#ifndef CONFIG_PREEMPT_RT
data = kmalloc(sizeof(*data), GFP_ATOMIC);
+#else
+ data = NULL;
+#endif
if (data)
data->flags = CSD_FLAG_ALLOC;
else {
@@ -347,7 +351,11 @@ void smp_call_function_many(const struct cpumask *mask,
return;
}

+#ifndef CONFIG_PREEMPT_RT
data = kmalloc(sizeof(*data) + cpumask_size(), GFP_ATOMIC);
+#else
+ data = NULL;
+#endif
if (unlikely(!data)) {
/* Slow path. */
for_each_online_cpu(cpu) {

--
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/