Skip to content

Commit 6ae4c30

Browse files
paulmckrcuurezki
authored andcommitted
rcu: Replace open-coded rcu_exp_need_qs() from rcu_exp_handler() with call
Currently, the preemptible implementation of rcu_exp_handler() almost open-codes rcu_exp_need_qs(). A call to that function would be shorter and would improve expediting in cases where rcu_exp_handler() interrupted a preemption-disabled or bh-disabled region of code. This commit therefore moves rcu_exp_need_qs() out of the non-preemptible leg of the enclosing #ifdef and replaces the open coding in preemptible rcu_exp_handler() with a call to rcu_exp_need_qs(). Signed-off-by: Paul E. McKenney <[email protected]> Cc: Frederic Weisbecker <[email protected]> Signed-off-by: Uladzislau Rezki (Sony) <[email protected]>
1 parent e2bd168 commit 6ae4c30

File tree

1 file changed

+13
-16
lines changed

1 file changed

+13
-16
lines changed

kernel/rcu/tree_exp.h

Lines changed: 13 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -718,6 +718,16 @@ static void rcu_exp_sel_wait_wake(unsigned long s)
718718
rcu_exp_wait_wake(s);
719719
}
720720

721+
/* Request an expedited quiescent state. */
722+
static void rcu_exp_need_qs(void)
723+
{
724+
__this_cpu_write(rcu_data.cpu_no_qs.b.exp, true);
725+
/* Store .exp before .rcu_urgent_qs. */
726+
smp_store_release(this_cpu_ptr(&rcu_data.rcu_urgent_qs), true);
727+
set_tsk_need_resched(current);
728+
set_preempt_need_resched();
729+
}
730+
721731
#ifdef CONFIG_PREEMPT_RCU
722732

723733
/*
@@ -742,13 +752,10 @@ static void rcu_exp_handler(void *unused)
742752
*/
743753
if (!depth) {
744754
if (!(preempt_count() & (PREEMPT_MASK | SOFTIRQ_MASK)) ||
745-
rcu_is_cpu_rrupt_from_idle()) {
755+
rcu_is_cpu_rrupt_from_idle())
746756
rcu_report_exp_rdp(rdp);
747-
} else {
748-
WRITE_ONCE(rdp->cpu_no_qs.b.exp, true);
749-
set_tsk_need_resched(t);
750-
set_preempt_need_resched();
751-
}
757+
else
758+
rcu_exp_need_qs();
752759
return;
753760
}
754761

@@ -841,16 +848,6 @@ static void rcu_exp_print_detail_task_stall_rnp(struct rcu_node *rnp)
841848

842849
#else /* #ifdef CONFIG_PREEMPT_RCU */
843850

844-
/* Request an expedited quiescent state. */
845-
static void rcu_exp_need_qs(void)
846-
{
847-
__this_cpu_write(rcu_data.cpu_no_qs.b.exp, true);
848-
/* Store .exp before .rcu_urgent_qs. */
849-
smp_store_release(this_cpu_ptr(&rcu_data.rcu_urgent_qs), true);
850-
set_tsk_need_resched(current);
851-
set_preempt_need_resched();
852-
}
853-
854851
/* Invoked on each online non-idle CPU for expedited quiescent state. */
855852
static void rcu_exp_handler(void *unused)
856853
{

0 commit comments

Comments
 (0)