rcu-tasks: Stop RCU Tasks scanning tasks which record on dyntick-idle entry
PATCH v2 1/1 rcu-tasks: Stop RCU Tasks scanning tasks which record on dyntick-idle entry
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().
---
v1->v2:
fix build test ERROR due to CONFIG_TASKS_RCU=n
kernel/rcu/tasks.h | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-)
kernel/rcu/tasks.h +9 -3
@@ -809,10 +809,17 @@ static void rcu_tasks_pregp_step(struct list_head *hop)synchronize_rcu (); } +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 ; +} +/* 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);
Signature · 1 line
2.25.1
Paul E. McKenney
maintainerQuoted 9 lines · Zqiang
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().Reported-by kernel test robot <[email protected]>Signed-off-by Zqiang <[email protected]>
You lost me with this one. Doesn't the rcu_tasks_pertask() function already exclude the idle tasks that might possibly be running in dyntick-idle state in non-CONFIG_NO_HZ_FULL systems?
What am I missing here?
Thanx, Paul
Quoted 43 lines
---
v1->v2:
fix build test ERROR due toCONFIG_TASKS_RCU=nkernel/rcu/tasks.h | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-)kernel/rcu/tasks.h +9
-3@@ -809,10 +809,17 @@ static void rcu_tasks_pregp_step(struct list_head *hop)synchronize_rcu (); } +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 ; +} +/* 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);Signature · 1 line
2.25.1
Quoted 7 lines · Zqiang
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().
Quoted 6 lines
Reported-by kernel test robot <[email protected]>Signed-off-by Zqiang <[email protected]>You lost me with this one. Doesn't the
rcu_tasks_pertask()function already exclude the idle tasks that might possibly be running in dyntick-idle state in non-CONFIG_NO_HZ_FULL systems?What am I missing here?
Thanks for reply.
Yes, the is_idle_task() can remove from task_is_on_dyntick_idle().
And the is_idle_task() can also remove from warnings in check_holdout_task(), because the rcu _tasks_pertask() already exclude the idle tasks. Is my understanding correct?
Thanks
Zqiang
Quoted 44 lines
Thanx, Paul
---
v1->v2:
fix build test ERROR due toCONFIG_TASKS_RCU=nkernel/rcu/tasks.h | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-)kernel/rcu/tasks.h index renamed from kernel/rcu/tasks.h +0
-0
f6459343e4b6..7cb0f922478e100644kernel/rcu/tasks.h +7
-1@@ -809,10 +809,17 @@ static void rcu_tasks_pregp_step(struct list_head *hop)synchronize_rcu (); } +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 ; +} +/* 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 @@ staticvoid check_holdout_task(struct
task_struct*t,kernel/rcu/tasks.h +1
-3if (!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