Skip to content

Commit

Permalink
rcupreempt: remove never-migrates assumption from rcu_process_callbac…
Browse files Browse the repository at this point in the history
…ks()

This patch fixes a potentially invalid access to a per-CPU variable in
rcu_process_callbacks().

This per-CPU access needs to be done in such a way as to guarantee that
the code using it cannot move to some other CPU before all uses of the
value accessed have completed.  Even though this code is currently only
invoked from softirq context, which currrently cannot migrate to some
other CPU, life would be better if this code did not silently make such
an assumption.

Signed-off-by: Paul E. McKenney <paulmck@linux.vnet.ibm.com>
Signed-off-by: Ingo Molnar <mingo@elte.hu>
  • Loading branch information
Paul E. McKenney authored and Ingo Molnar committed Feb 29, 2008
1 parent ae77886 commit c9e7100
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions kernel/rcupreempt.c
Original file line number Diff line number Diff line change
Expand Up @@ -952,9 +952,11 @@ static void rcu_process_callbacks(struct softirq_action *unused)
{
unsigned long flags;
struct rcu_head *next, *list;
struct rcu_data *rdp = RCU_DATA_ME();
struct rcu_data *rdp;

spin_lock_irqsave(&rdp->lock, flags);
local_irq_save(flags);
rdp = RCU_DATA_ME();
spin_lock(&rdp->lock);
list = rdp->donelist;
if (list == NULL) {
spin_unlock_irqrestore(&rdp->lock, flags);
Expand Down

0 comments on commit c9e7100

Please sign in to comment.