Skip to content

Commit

Permalink
[PATCH] rcu_do_batch: make ->qlen decrement irq safe
Browse files Browse the repository at this point in the history
rcu_do_batch() decrements rdp->qlen with irqs enabled.  This is not good,
it can also be modified by call_rcu() from interrupt.

Decrement ->qlen once with irqs disabled, after a main loop.

Signed-off-by: Oleg Nesterov <[email protected]>
Cc: Dipankar Sarma <[email protected]>
Cc: "Paul E. McKenney" <[email protected]>
Signed-off-by: Andrew Morton <[email protected]>
Signed-off-by: Linus Torvalds <[email protected]>
  • Loading branch information
Oleg Nesterov authored and Linus Torvalds committed Sep 13, 2006
1 parent 7fbb364 commit dd9daa2
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion kernel/rcupdate.c
Original file line number Diff line number Diff line change
Expand Up @@ -241,12 +241,16 @@ static void rcu_do_batch(struct rcu_data *rdp)
next = rdp->donelist = list->next;
list->func(list);
list = next;
rdp->qlen--;
if (++count >= rdp->blimit)
break;
}

local_irq_disable();
rdp->qlen -= count;
local_irq_enable();
if (rdp->blimit == INT_MAX && rdp->qlen <= qlowmark)
rdp->blimit = blimit;

if (!rdp->donelist)
rdp->donetail = &rdp->donelist;
else
Expand Down

0 comments on commit dd9daa2

Please sign in to comment.