[patch] Real-Time Preemption, -RT-2.6.10-rc2-mm3-V0.7.32-12

From: Ingo Molnar
Date: Thu Dec 09 2004 - 08:15:26 EST



* Ingo Molnar <mingo@xxxxxxx> wrote:

> SLAB draining was an oversight - it's mainly called when there is VM
> pressure (which is not a stricly necessary feature, so i disabled it),
> but i forgot about the module-unload case where it's a correctness
> feature. Your patch is a good starting point, i'll try to fix it on
> SMP too.

here's the full patch against a recent tree, or download the -32-12
patch from the usual place:

http://redhat.com/~mingo/realtime-preempt/

Rui, Gene, does this fix the module unload crash you are seeing?

Ingo

--- linux/mm/slab.c.orig
+++ linux/mm/slab.c
@@ -1509,22 +1509,26 @@ static void smp_call_function_all_cpus(v
static void drain_array_locked(kmem_cache_t* cachep,
struct array_cache *ac, int force);

-#ifndef CONFIG_PREEMPT_RT
-/*
- * Executes in an IRQ context:
- */
-static void do_drain(void *arg)
+static void do_drain_cpu(kmem_cache_t *cachep, int cpu)
{
- kmem_cache_t *cachep = (kmem_cache_t*)arg;
struct array_cache *ac;
- int cpu = smp_processor_id();

check_irq_off();
- ac = ac_data(cachep, cpu);
+
spin_lock(&cachep->spinlock);
+ ac = ac_data(cachep, cpu);
free_block(cachep, &ac_entry(ac)[0], ac->avail);
- spin_unlock(&cachep->spinlock);
ac->avail = 0;
+ spin_unlock(&cachep->spinlock);
+}
+
+#ifndef CONFIG_PREEMPT_RT
+/*
+ * Executes in an IRQ context:
+ */
+static void do_drain(void *arg)
+{
+ do_drain_cpu((kmem_cache_t*)arg, smp_processor_id());
}
#endif

@@ -1532,6 +1536,11 @@ static void drain_cpu_caches(kmem_cache_
{
#ifndef CONFIG_PREEMPT_RT
smp_call_function_all_cpus(do_drain, cachep);
+#else
+ int cpu;
+
+ for_each_online_cpu(cpu)
+ do_drain_cpu(cachep, cpu);
#endif
check_irq_on();
spin_lock_irq(&cachep->spinlock);
-
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/