Commit dd9daa22 authored by Oleg Nesterov's avatar Oleg Nesterov Committed by Linus Torvalds

[PATCH] rcu_do_batch: make ->qlen decrement irq safe

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: default avatarOleg Nesterov <oleg@tv-sign.ru>
Cc: Dipankar Sarma <dipankar@in.ibm.com>
Cc: "Paul E. McKenney" <paulmck@us.ibm.com>
Signed-off-by: default avatarAndrew Morton <akpm@osdl.org>
Signed-off-by: default avatarLinus Torvalds <torvalds@osdl.org>
parent 7fbb3645
...@@ -241,12 +241,16 @@ static void rcu_do_batch(struct rcu_data *rdp) ...@@ -241,12 +241,16 @@ static void rcu_do_batch(struct rcu_data *rdp)
next = rdp->donelist = list->next; next = rdp->donelist = list->next;
list->func(list); list->func(list);
list = next; list = next;
rdp->qlen--;
if (++count >= rdp->blimit) if (++count >= rdp->blimit)
break; break;
} }
local_irq_disable();
rdp->qlen -= count;
local_irq_enable();
if (rdp->blimit == INT_MAX && rdp->qlen <= qlowmark) if (rdp->blimit == INT_MAX && rdp->qlen <= qlowmark)
rdp->blimit = blimit; rdp->blimit = blimit;
if (!rdp->donelist) if (!rdp->donelist)
rdp->donetail = &rdp->donelist; rdp->donetail = &rdp->donelist;
else else
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment