Re: [PATCH] kernel/rcupdate.c microcleanup

From: Brian Gerst (bgerst@didntduck.org)
Date: Tue Mar 11 2003 - 10:23:01 EST


Andrey Panin wrote:
> Hi all,
>
> attached patch (2.5.64) contains small cleanup of RCU code:
> - move smp_processor_id() outside of irq disabled region in call_rcu();
> - consolidate multiple spin_unlock() in the rcu_check_quiescent_state(),
> remove some unneeded {} and make this function inline.
>
> Tested and works (at least doesn't crash). Please consider applying.
>
> Best regards.
>
>
>
> ------------------------------------------------------------------------
>
> diff -urN -X /usr/share/dontdiff linux-2.5.64.vanilla/kernel/rcupdate.c linux-2.5.64/kernel/rcupdate.c
> --- linux-2.5.64.vanilla/kernel/rcupdate.c Thu Nov 28 01:35:46 2002
> +++ linux-2.5.64/kernel/rcupdate.c Mon Mar 10 20:18:48 2003
> @@ -67,13 +67,12 @@
> */
> void call_rcu(struct rcu_head *head, void (*func)(void *arg), void *arg)
> {
> - int cpu;
> + int cpu = smp_processor_id();
> unsigned long flags;
>
> head->func = func;
> head->arg = arg;
> local_irq_save(flags);
> - cpu = smp_processor_id();
> list_add_tail(&head->list, &RCU_nxtlist(cpu));
> local_irq_restore(flags);
> }

This is not preempt-safe. smp_processor_id() can only be used in a
preempt-disabled region (which local_irq_save() provides).

--
				Brian Gerst

- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/



This archive was generated by hypermail 2b29 : Sat Mar 15 2003 - 22:00:26 EST