Skip to content

Commit cf7066b

Browse files
joelagnelpaulmckrcu
authored andcommitted
rcu: Disable laziness if lazy-tracking says so
During suspend, we see failures to suspend 1 in 300-500 suspends. Looking closer, it appears that asynchronous RCU callbacks are being queued as lazy even though synchronous callbacks are expedited. These delays appear to not be very welcome by the suspend/resume code as evidenced by these occasional suspend failures. This commit modifies call_rcu() to check if rcu_async_should_hurry(), which will return true if we are in suspend or in-kernel boot. [ paulmck: Alphabetize local variables. ] Ignoring the lazy hint makes the 3000 suspend/resume cycles pass reliably on a 12th gen 12-core Intel CPU, and there is some evidence that it also slightly speeds up boot performance. Fixes: 3cb278e ("rcu: Make call_rcu() lazy to save power") Signed-off-by: Joel Fernandes (Google) <[email protected]> Signed-off-by: Paul E. McKenney <[email protected]>
1 parent 6efdda8 commit cf7066b

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

kernel/rcu/tree.c

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2575,10 +2575,11 @@ static void check_cb_ovld(struct rcu_data *rdp)
25752575
}
25762576

25772577
static void
2578-
__call_rcu_common(struct rcu_head *head, rcu_callback_t func, bool lazy)
2578+
__call_rcu_common(struct rcu_head *head, rcu_callback_t func, bool lazy_in)
25792579
{
25802580
static atomic_t doublefrees;
25812581
unsigned long flags;
2582+
bool lazy;
25822583
struct rcu_data *rdp;
25832584
bool was_alldone;
25842585

@@ -2603,6 +2604,7 @@ __call_rcu_common(struct rcu_head *head, rcu_callback_t func, bool lazy)
26032604
kasan_record_aux_stack_noalloc(head);
26042605
local_irq_save(flags);
26052606
rdp = this_cpu_ptr(&rcu_data);
2607+
lazy = lazy_in && !rcu_async_should_hurry();
26062608

26072609
/* Add the callback to our list. */
26082610
if (unlikely(!rcu_segcblist_is_enabled(&rdp->cblist))) {

0 commit comments

Comments
 (0)