linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] sched/fair: Fix enqueue_task_fair warning some more
@ 2020-05-06 14:18 Phil Auld
  2020-05-06 16:36 ` Vincent Guittot
                   ` (2 more replies)
  0 siblings, 3 replies; 29+ messages in thread
From: Phil Auld @ 2020-05-06 14:18 UTC (permalink / raw)
  To: peterz; +Cc: linux-kernel, mingo, vincent.guittot, juri.lelli

sched/fair: Fix enqueue_task_fair warning some more

The recent patch, fe61468b2cb (sched/fair: Fix enqueue_task_fair warning)
did not fully resolve the issues with the (rq->tmp_alone_branch !=
&rq->leaf_cfs_rq_list) warning in enqueue_task_fair. There is a case where
the first for_each_sched_entity loop exits due to on_rq, having incompletely
updated the list.  In this case the second for_each_sched_entity loop can
further modify se. The later code to fix up the list management fails to do
what is needed because se does not point to the sched_entity which broke out
of the first loop.

Address this issue by saving the se pointer when the first loop exits and
resetting it before doing the fix up, if needed.

Signed-off-by: Phil Auld <pauld@redhat.com>
Cc: Peter Zijlstra (Intel) <peterz@infradead.org>
Cc: Vincent Guittot <vincent.guittot@linaro.org>
Cc: Ingo Molnar <mingo@kernel.org>
Cc: Juri Lelli <juri.lelli@redhat.com>
---
 kernel/sched/fair.c | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/kernel/sched/fair.c b/kernel/sched/fair.c
index 02f323b85b6d..719c996317e3 100644
--- a/kernel/sched/fair.c
+++ b/kernel/sched/fair.c
@@ -5432,6 +5432,7 @@ enqueue_task_fair(struct rq *rq, struct task_struct *p, int flags)
 {
 	struct cfs_rq *cfs_rq;
 	struct sched_entity *se = &p->se;
+	struct sched_entity *saved_se = NULL;
 	int idle_h_nr_running = task_has_idle_policy(p);
 
 	/*
@@ -5466,6 +5467,7 @@ enqueue_task_fair(struct rq *rq, struct task_struct *p, int flags)
 		flags = ENQUEUE_WAKEUP;
 	}
 
+	saved_se = se;
 	for_each_sched_entity(se) {
 		cfs_rq = cfs_rq_of(se);
 
@@ -5510,6 +5512,8 @@ enqueue_task_fair(struct rq *rq, struct task_struct *p, int flags)
 		 * leaf list maintenance, resulting in triggering the assertion
 		 * below.
 		 */
+		if (saved_se)
+			se = saved_se;
 		for_each_sched_entity(se) {
 			cfs_rq = cfs_rq_of(se);
 
-- 
2.18.0


Cheers,
Phil


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

end of thread, other threads:[~2020-05-19 18:44 UTC | newest]

Thread overview: 29+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-05-06 14:18 [PATCH] sched/fair: Fix enqueue_task_fair warning some more Phil Auld
2020-05-06 16:36 ` Vincent Guittot
2020-05-06 18:05   ` Phil Auld
2020-05-07 15:06     ` Vincent Guittot
2020-05-07 15:17       ` Phil Auld
2020-05-07 18:04       ` Phil Auld
2020-05-07 18:21         ` Vincent Guittot
2020-05-07 20:36 ` [PATCH v2] " Phil Auld
2020-05-08 15:15   ` Tao Zhou
2020-05-08 15:27     ` Vincent Guittot
2020-05-08 17:02       ` Tao Zhou
2020-05-11  8:36         ` Vincent Guittot
     [not found]           ` <BL0PR14MB37792D0FD629FFF1C9FEDE369AA10@BL0PR14MB3779.namprd14.prod.outlook.com>
2020-05-11 19:22             ` Vincent Guittot
2020-05-11  8:40         ` Dietmar Eggemann
2020-05-11  9:36           ` Vincent Guittot
2020-05-11 10:39             ` Dietmar Eggemann
2020-05-11 12:12               ` Vincent Guittot
2020-05-11 17:02                 ` Dietmar Eggemann
2020-05-11 17:14                   ` Vincent Guittot
     [not found]               ` <BL0PR14MB3779ED5E2E5AD157B58D002C9AA10@BL0PR14MB3779.namprd14.prod.outlook.com>
2020-05-11 17:03                 ` Dietmar Eggemann
2020-05-11 19:25   ` Vincent Guittot
2020-05-11 20:44     ` Phil Auld
2020-05-12  9:00       ` Dietmar Eggemann
2020-05-12 13:37         ` Phil Auld
2020-05-12 14:06       ` Peter Zijlstra
2020-05-12 13:52 ` [PATCH v3] " Phil Auld
2020-05-12 14:10   ` Peter Zijlstra
2020-05-12 14:24     ` Phil Auld
2020-05-19 18:44   ` [tip: sched/urgent] sched/fair: Fix enqueue_task_fair() " tip-bot2 for Phil Auld

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).