2006-01-28 17:44:59

by Oleg Nesterov

[permalink] [raw]
Subject: [PATCH] rcu_process_callbacks: don't cli() while testing ->nxtlist

__rcu_process_callbacks() disables interrupts to protect itself
from call_rcu() which adds new entries to ->nxtlist.

However we can check "->nxtlist != NULL" with interrupts enabled,
we can't get "false positives" because call_rcu() can only change
this condition from 0 to 1.

Tested with rcutorture.ko.

Signed-off-by: Oleg Nesterov <[email protected]>

--- RC-1/kernel/rcupdate.c~ 2006-01-19 18:13:07.000000000 +0300
+++ RC-1/kernel/rcupdate.c 2006-01-29 00:13:24.000000000 +0300
@@ -381,8 +381,8 @@ static void __rcu_process_callbacks(stru
rdp->curtail = &rdp->curlist;
}

- local_irq_disable();
if (rdp->nxtlist && !rdp->curlist) {
+ local_irq_disable();
rdp->curlist = rdp->nxtlist;
rdp->curtail = rdp->nxttail;
rdp->nxtlist = NULL;
@@ -407,9 +407,8 @@ static void __rcu_process_callbacks(stru
rcu_start_batch(rcp);
spin_unlock(&rcp->lock);
}
- } else {
- local_irq_enable();
}
+
rcu_check_quiescent_state(rcp, rdp);
if (rdp->donelist)
rcu_do_batch(rdp);


2006-01-28 18:49:37

by Dipankar Sarma

[permalink] [raw]
Subject: Re: [PATCH] rcu_process_callbacks: don't cli() while testing ->nxtlist

On Sat, Jan 28, 2006 at 10:02:01PM +0300, Oleg Nesterov wrote:
> __rcu_process_callbacks() disables interrupts to protect itself
> from call_rcu() which adds new entries to ->nxtlist.
>
> However we can check "->nxtlist != NULL" with interrupts enabled,
> we can't get "false positives" because call_rcu() can only change
> this condition from 0 to 1.
>
> Tested with rcutorture.ko.
>
> Signed-off-by: Oleg Nesterov <[email protected]>

Looks good to me.

Thanks
Dipankar