lkml.org 
[lkml]   [2003]   [Mar]   [11]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [PATCH] kernel/rcupdate.c microcleanup
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/

\
 
 \ /
  Last update: 2005-03-22 13:33    [W:0.032 / U:1.056 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site