All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH v3 0/2] Add no-idle tasks check which in dyntick-idle state
@ 2022-05-24  0:34 Zqiang
  2022-05-24  0:34 ` [PATCH v3 1/2] rcu-tasks: Stop RCU Tasks scanning no-idle tasks which record on dyntick-idle entry Zqiang
                   ` (2 more replies)
  0 siblings, 3 replies; 5+ messages in thread
From: Zqiang @ 2022-05-24  0:34 UTC (permalink / raw)
  To: paulmck, frederic; +Cc: rcu, linux-kernel

These commit stop scanning no-idle tasks which in dyntick-idle state and
remove idle-tasks check from warnings.

v1->v2:
fix build error when CONFIG_TASKS_RCU=n
v2->v3:
remove idle-tasks check from task_is_on_dyntick_idle()

Zqiang (2):
  rcu-tasks: Stop RCU Tasks scanning no-idle tasks which record on
    dyntick-idle entry
  rcu-tasks: Remove is_idle_task() from warnings in check_holdout_task()

 kernel/rcu/tasks.h | 16 ++++++++++------
 1 file changed, 10 insertions(+), 6 deletions(-)

-- 
2.25.1


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

* [PATCH v3 1/2] rcu-tasks: Stop RCU Tasks scanning no-idle tasks which record on dyntick-idle entry
  2022-05-24  0:34 [PATCH v3 0/2] Add no-idle tasks check which in dyntick-idle state Zqiang
@ 2022-05-24  0:34 ` Zqiang
  2022-05-24  0:34 ` [PATCH v3 2/2] rcu-tasks: Remove is_idle_task() from warnings in check_holdout_task() Zqiang
  2022-05-24 17:28 ` [PATCH v3 0/2] Add no-idle tasks check which in dyntick-idle state Paul E. McKenney
  2 siblings, 0 replies; 5+ messages in thread
From: Zqiang @ 2022-05-24  0:34 UTC (permalink / raw)
  To: paulmck, frederic; +Cc: rcu, linux-kernel, kernel test robot

When the RCU Tasks scanning on-rq tasks, there is no need to scanning
no-idle tasks(have invoked rcu_user_enter()) 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 <lkp@intel.com>
Signed-off-by: Zqiang <qiang1.zhang@intel.com>
---
 kernel/rcu/tasks.h | 11 ++++++++---
 1 file changed, 8 insertions(+), 3 deletions(-)

diff --git a/kernel/rcu/tasks.h b/kernel/rcu/tasks.h
index 195c97e85bcb..a28337f280e4 100644
--- a/kernel/rcu/tasks.h
+++ b/kernel/rcu/tasks.h
@@ -809,10 +809,16 @@ 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) && 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 +848,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] 5+ messages in thread

* [PATCH v3 2/2] rcu-tasks: Remove is_idle_task() from warnings in check_holdout_task()
  2022-05-24  0:34 [PATCH v3 0/2] Add no-idle tasks check which in dyntick-idle state Zqiang
  2022-05-24  0:34 ` [PATCH v3 1/2] rcu-tasks: Stop RCU Tasks scanning no-idle tasks which record on dyntick-idle entry Zqiang
@ 2022-05-24  0:34 ` Zqiang
  2022-05-24 17:28 ` [PATCH v3 0/2] Add no-idle tasks check which in dyntick-idle state Paul E. McKenney
  2 siblings, 0 replies; 5+ messages in thread
From: Zqiang @ 2022-05-24  0:34 UTC (permalink / raw)
  To: paulmck, frederic; +Cc: rcu, linux-kernel

Due to the rcu_tasks_pertask() already exclude idle tasks, the idle tasks
not appear in holdout list. so It is not necessary to judge whether the
tasks in the holdout list are idle tasks.

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

diff --git a/kernel/rcu/tasks.h b/kernel/rcu/tasks.h
index a28337f280e4..6a2598efd0cc 100644
--- a/kernel/rcu/tasks.h
+++ b/kernel/rcu/tasks.h
@@ -862,9 +862,8 @@ static void check_holdout_task(struct task_struct *t,
 		*firstreport = false;
 	}
 	cpu = task_cpu(t);
-	pr_alert("%p: %c%c nvcsw: %lu/%lu holdout: %d idle_cpu: %d/%d\n",
-		 t, ".I"[is_idle_task(t)],
-		 "N."[cpu < 0 || !tick_nohz_full_cpu(cpu)],
+	pr_alert("%p: %c nvcsw: %lu/%lu holdout: %d idle_cpu: %d/%d\n",
+		 t, "N."[cpu < 0 || !tick_nohz_full_cpu(cpu)],
 		 t->rcu_tasks_nvcsw, t->nvcsw, t->rcu_tasks_holdout,
 		 t->rcu_tasks_idle_cpu, cpu);
 	sched_show_task(t);
-- 
2.25.1


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

* Re: [PATCH v3 0/2] Add no-idle tasks check which in dyntick-idle state
  2022-05-24  0:34 [PATCH v3 0/2] Add no-idle tasks check which in dyntick-idle state Zqiang
  2022-05-24  0:34 ` [PATCH v3 1/2] rcu-tasks: Stop RCU Tasks scanning no-idle tasks which record on dyntick-idle entry Zqiang
  2022-05-24  0:34 ` [PATCH v3 2/2] rcu-tasks: Remove is_idle_task() from warnings in check_holdout_task() Zqiang
@ 2022-05-24 17:28 ` Paul E. McKenney
  2022-05-24 22:28   ` Zhang, Qiang1
  2 siblings, 1 reply; 5+ messages in thread
From: Paul E. McKenney @ 2022-05-24 17:28 UTC (permalink / raw)
  To: Zqiang; +Cc: frederic, rcu, linux-kernel

On Tue, May 24, 2022 at 08:34:52AM +0800, Zqiang wrote:
> These commit stop scanning no-idle tasks which in dyntick-idle state and
> remove idle-tasks check from warnings.

This patch might well be correct, but there are supposed to be upcoming
changes in the idle loop that would make it possible for RCU Tasks to
take idle tasks into account:

https://lore.kernel.org/all/20220515203653.4039075-1-jolsa@kernel.org/

There are currently issues in amd_e400_idle() and mwait_idle() preventing
this, and there might well also be similar issues in non-x86 idle loops:

https://lore.kernel.org/all/20220519135439.GX1790663@paulmck-ThinkPad-P17-Gen-1/

So I must hold off on this patch series for the time being.  Nevertheless,
thank you very much for your effort and interest in RCU.

							Thanx, Paul

> v1->v2:
> fix build error when CONFIG_TASKS_RCU=n
> v2->v3:
> remove idle-tasks check from task_is_on_dyntick_idle()
> 
> Zqiang (2):
>   rcu-tasks: Stop RCU Tasks scanning no-idle tasks which record on
>     dyntick-idle entry
>   rcu-tasks: Remove is_idle_task() from warnings in check_holdout_task()
> 
>  kernel/rcu/tasks.h | 16 ++++++++++------
>  1 file changed, 10 insertions(+), 6 deletions(-)
> 
> -- 
> 2.25.1
> 

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

* RE: [PATCH v3 0/2] Add no-idle tasks check which in dyntick-idle state
  2022-05-24 17:28 ` [PATCH v3 0/2] Add no-idle tasks check which in dyntick-idle state Paul E. McKenney
@ 2022-05-24 22:28   ` Zhang, Qiang1
  0 siblings, 0 replies; 5+ messages in thread
From: Zhang, Qiang1 @ 2022-05-24 22:28 UTC (permalink / raw)
  To: paulmck; +Cc: frederic, rcu, linux-kernel


On Tue, May 24, 2022 at 08:34:52AM +0800, Zqiang wrote:
> These commit stop scanning no-idle tasks which in dyntick-idle state 
> and remove idle-tasks check from warnings.

>This patch might well be correct, but there are supposed to be upcoming changes in the idle loop that would make it possible for RCU Tasks to take idle tasks into account:
>
>https://lore.kernel.org/all/20220515203653.4039075-1-jolsa@kernel.org/
>
>There are currently issues in amd_e400_idle() and mwait_idle() preventing this, and there might well also be similar issues in non-x86 idle loops:
>
>https://lore.kernel.org/all/20220519135439.GX1790663@paulmck-ThinkPad-P17-Gen-1/
>
>So I must hold off on this patch series for the time being.  Nevertheless, thank you very much for your effort and interest in RCU.

Thanks for explain, I will keep an eye.

>
>							Thanx, Paul

> v1->v2:
> fix build error when CONFIG_TASKS_RCU=n
> v2->v3:
> remove idle-tasks check from task_is_on_dyntick_idle()
> 
> Zqiang (2):
>   rcu-tasks: Stop RCU Tasks scanning no-idle tasks which record on
>     dyntick-idle entry
>   rcu-tasks: Remove is_idle_task() from warnings in 
> check_holdout_task()
> 
>  kernel/rcu/tasks.h | 16 ++++++++++------
>  1 file changed, 10 insertions(+), 6 deletions(-)
> 
> --
> 2.25.1
> 

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

end of thread, other threads:[~2022-05-24 22:28 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-05-24  0:34 [PATCH v3 0/2] Add no-idle tasks check which in dyntick-idle state Zqiang
2022-05-24  0:34 ` [PATCH v3 1/2] rcu-tasks: Stop RCU Tasks scanning no-idle tasks which record on dyntick-idle entry Zqiang
2022-05-24  0:34 ` [PATCH v3 2/2] rcu-tasks: Remove is_idle_task() from warnings in check_holdout_task() Zqiang
2022-05-24 17:28 ` [PATCH v3 0/2] Add no-idle tasks check which in dyntick-idle state Paul E. McKenney
2022-05-24 22:28   ` Zhang, Qiang1

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.