All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] rcu-tasks: Stop RCU Tasks scanning tasks which record on dyntick-idle entry
@ 2022-05-20  4:56 Zqiang
  2022-05-20  7:33 ` kernel test robot
  0 siblings, 1 reply; 2+ messages in thread
From: Zqiang @ 2022-05-20  4:56 UTC (permalink / raw)
  To: paulmck, frederic; +Cc: rcu, linux-kernel

When the RCU Tasks scanning on-rq tasks, there is no need to scanning
tasks which record on dyntick-idle entry, at this time, these tasks are
not remain within an RCU Tasks read-side critical section.

This commit skip scanning tasks which record on dyntick-idle entry in
rcu_tasks_pertask().

Signed-off-by: Zqiang <qiang1.zhang@intel.com>
---
 kernel/rcu/tasks.h | 12 +++++++++---
 1 file changed, 9 insertions(+), 3 deletions(-)

diff --git a/kernel/rcu/tasks.h b/kernel/rcu/tasks.h
index f6459343e4b6..7898da987581 100644
--- a/kernel/rcu/tasks.h
+++ b/kernel/rcu/tasks.h
@@ -206,6 +206,12 @@ static void set_tasks_gp_state(struct rcu_tasks *rtp, int newstate)
 	rtp->gp_jiffies = jiffies;
 }
 
+static bool task_is_on_dyntick_idle(struct task_struct *t)
+{
+	return IS_ENABLED(CONFIG_NO_HZ_FULL) && !is_idle_task(t) &&
+				t->rcu_tasks_idle_cpu >= 0;
+}
+
 #ifndef CONFIG_TINY_RCU
 /* Return state name. */
 static const char *tasks_gp_state_getname(struct rcu_tasks *rtp)
@@ -812,7 +818,8 @@ static void rcu_tasks_pregp_step(struct list_head *hop)
 /* Per-task initial processing. */
 static void rcu_tasks_pertask(struct task_struct *t, struct list_head *hop)
 {
-	if (t != current && READ_ONCE(t->on_rq) && !is_idle_task(t)) {
+	if (t != current && READ_ONCE(t->on_rq) && !is_idle_task(t) &&
+				!task_is_on_dyntick_idle(t)) {
 		get_task_struct(t);
 		t->rcu_tasks_nvcsw = READ_ONCE(t->nvcsw);
 		WRITE_ONCE(t->rcu_tasks_holdout, true);
@@ -842,8 +849,7 @@ static void check_holdout_task(struct task_struct *t,
 	if (!READ_ONCE(t->rcu_tasks_holdout) ||
 	    t->rcu_tasks_nvcsw != READ_ONCE(t->nvcsw) ||
 	    !READ_ONCE(t->on_rq) ||
-	    (IS_ENABLED(CONFIG_NO_HZ_FULL) &&
-	     !is_idle_task(t) && t->rcu_tasks_idle_cpu >= 0)) {
+	    task_is_on_dyntick_idle(t)) {
 		WRITE_ONCE(t->rcu_tasks_holdout, false);
 		list_del_init(&t->rcu_tasks_holdout_list);
 		put_task_struct(t);
-- 
2.25.1


^ permalink raw reply related	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2022-05-20  7:38 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-05-20  4:56 [PATCH] rcu-tasks: Stop RCU Tasks scanning tasks which record on dyntick-idle entry Zqiang
2022-05-20  7:33 ` kernel test robot

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.