Skip to content

Commit c5bacd9

Browse files
committed
rcu: Motivate Tiny RCU forward progress
If a long-running CPU-bound in-kernel task invokes call_rcu(), the callback won't be invoked until the next context switch. If there are no other runnable tasks (which is not an uncommon situation on deep embedded systems), the callback might never be invoked. This commit therefore causes rcu_check_callbacks() to ask the scheduler for a context switch if there are callbacks posted that are still waiting for a grace period. Suggested-by: Peter Zijlstra <peterz@infradead.org> Signed-off-by: Paul E. McKenney <paulmck@linux.vnet.ibm.com>
1 parent c116dba commit c5bacd9

1 file changed

Lines changed: 5 additions & 1 deletion

File tree

‎kernel/rcu/tiny.c‎

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -78,8 +78,12 @@ void rcu_qs(void)
7878
*/
7979
void rcu_check_callbacks(int user)
8080
{
81-
if (user)
81+
if (user) {
8282
rcu_qs();
83+
} else if (rcu_ctrlblk.donetail != rcu_ctrlblk.curtail) {
84+
set_tsk_need_resched(current);
85+
set_preempt_need_resched();
86+
}
8387
}
8488

8589
/* Invoke the RCU callbacks whose grace period has elapsed. */

0 commit comments

Comments
 (0)