Skip to contentSkip to conversation

rcu_process_callbacks: don't cli() while testing ->nxtlist

PATCH In review Oleg Nesterov 2 participants 2 messages Jan 28, 2006

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 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.

kernel/rcupdate.c renamed from kernel/rcupdate.c~ +2 -3
@@ -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);
#1 lore raw
Quoted 10 lines · Oleg Nesterov

__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.

Looks good to me.

Thanks
Dipankar