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.
--
Andrey Panin | Embedded systems software developer
[email protected] | PGP key: wwwkeys.pgp.net
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
On Tue, 11 Mar 2003, Andrey Panin wrote:
>
> attached patch (2.5.64) contains small cleanup of RCU code:
> - move smp_processor_id() outside of irq disabled region in call_rcu();
That looks wrong, and is likely to break with preemption, since the caller
could potentially be moved to another CPU between the smp_processor_id()
and the irq disable.
Linus