Skip to contentSkip to conversation

sched/fair: enqueue_task_fair optimization

PATCH Superseded Vincent Guittot 2 participants 8 messages May 13, 2020 Scheduler

v2 of 3 Superseded Latest is v3 →

lore
Share & tools
lore

Vincent Guittot

author maintainer
#0 lore raw

PATCH v2 1/1 sched/fair: enqueue_task_fair optimization

enqueue_task_fair jumps to enqueue_throttle label when cfs_rq_of(se) is throttled which means that se can't be NULL and we can skip the test.

---

v2 changes:
- Remove useless if statement

 kernel/sched/fair.c | 39 ++++++++++++++++++++-------------------
 1 file changed, 20 insertions(+), 19 deletions(-)
kernel/sched/fair.c +20 -19
index a0c690d57430..b51b12d63c39 100644
@@ -5513,28 +5513,29 @@ enqueue_task_fair(struct rq *rq, struct task_struct *p, int flags)
                        list_add_leaf_cfs_rq(cfs_rq);
 	}
 
-enqueue_throttle:
-	if (!se) {
-		add_nr_running(rq, 1);
-		/*
-		 * Since new tasks are assigned an initial util_avg equal to
-		 * half of the spare capacity of their CPU, tiny tasks have the
-		 * ability to cross the overutilized threshold, which will
-		 * result in the load balancer ruining all the task placement
-		 * done by EAS. As a way to mitigate that effect, do not account
-		 * for the first enqueue operation of new tasks during the
-		 * overutilized flag detection.
-		 *
-		 * A better way of solving this problem would be to wait for
-		 * the PELT signals of tasks to converge before taking them
-		 * into account, but that is not straightforward to implement,
-		 * and the following generally works well enough in practice.
-		 */
-		if (flags & ENQUEUE_WAKEUP)
-			update_overutilized_status(rq);
+	/* At this point se is NULL and we are at root level*/
+	add_nr_running(rq, 1);
+
+	/*
+	 * Since new tasks are assigned an initial util_avg equal to
+	 * half of the spare capacity of their CPU, tiny tasks have the
+	 * ability to cross the overutilized threshold, which will
+	 * result in the load balancer ruining all the task placement
+	 * done by EAS. As a way to mitigate that effect, do not account
+	 * for the first enqueue operation of new tasks during the
+	 * overutilized flag detection.
+	 *
+	 * A better way of solving this problem would be to wait for
+	 * the PELT signals of tasks to converge before taking them
+	 * into account, but that is not straightforward to implement,
+	 * and the following generally works well enough in practice.
+	 */
+	if (flags & ENQUEUE_WAKEUP)
+		update_overutilized_status(rq);
 
 	}
 
+enqueue_throttle:
 	if (cfs_bandwidth_used()) {
 		/*
 		 * When bandwidth control is enabled; the cfs_rq_throttled()
Signature · 1 line
2.17.1
#1 lore raw

Hi Vincent,

Quoted 3 lines · On Wed, May 13, 2020 at 02:33:35PM +0200 Vincent Guittot wrote:

enqueue_task_fair jumps to enqueue_throttle label when cfs_rq_of(se) is throttled which means that se can't be NULL and we can skip the test.

s/be NULL/be non-NULL/

I think.

It's more like if it doesn't jump to the label then se must be NULL for the loop to terminate. The final loop is a NOP if se is NULL. The check wasn't protecting that.

Otherwise still

Quoted 1 line

Cheers,
Phil

Quoted 65 lines

---

v2 changes:
- Remove useless if statement

 kernel/sched/fair.c | 39 ++++++++++++++++++++-------------------
 1 file changed, 20 insertions(+), 19 deletions(-)
kernel/sched/fair.c +20 -19
index a0c690d57430..b51b12d63c39 100644
@@ -5513,28 +5513,29 @@ enqueue_task_fair(struct rq *rq, struct task_struct *p, int flags)
                        list_add_leaf_cfs_rq(cfs_rq);
 	}
 
-enqueue_throttle:
-	if (!se) {
-		add_nr_running(rq, 1);
-		/*
-		 * Since new tasks are assigned an initial util_avg equal to
-		 * half of the spare capacity of their CPU, tiny tasks have the
-		 * ability to cross the overutilized threshold, which will
-		 * result in the load balancer ruining all the task placement
-		 * done by EAS. As a way to mitigate that effect, do not account
-		 * for the first enqueue operation of new tasks during the
-		 * overutilized flag detection.
-		 *
-		 * A better way of solving this problem would be to wait for
-		 * the PELT signals of tasks to converge before taking them
-		 * into account, but that is not straightforward to implement,
-		 * and the following generally works well enough in practice.
-		 */
-		if (flags & ENQUEUE_WAKEUP)
-			update_overutilized_status(rq);
+	/* At this point se is NULL and we are at root level*/
+	add_nr_running(rq, 1);
+
+	/*
+	 * Since new tasks are assigned an initial util_avg equal to
+	 * half of the spare capacity of their CPU, tiny tasks have the
+	 * ability to cross the overutilized threshold, which will
+	 * result in the load balancer ruining all the task placement
+	 * done by EAS. As a way to mitigate that effect, do not account
+	 * for the first enqueue operation of new tasks during the
+	 * overutilized flag detection.
+	 *
+	 * A better way of solving this problem would be to wait for
+	 * the PELT signals of tasks to converge before taking them
+	 * into account, but that is not straightforward to implement,
+	 * and the following generally works well enough in practice.
+	 */
+	if (flags & ENQUEUE_WAKEUP)
+		update_overutilized_status(rq);
 
 	}
 
+enqueue_throttle:
 	if (cfs_bandwidth_used()) {
 		/*
 		 * When bandwidth control is enabled; the cfs_rq_throttled()
Signature · 1 line
2.17.1
author maintainer
#2 lore raw
Quoted 11 lines · Phil Auld

Hi Vincent,

Quoted 3 lines · On Wed, May 13, 2020 at 02:33:35PM +0200 Vincent Guittot wrote:

enqueue_task_fair jumps to enqueue_throttle label when cfs_rq_of(se) is throttled which means that se can't be NULL and we can skip the test.

s/be NULL/be non-NULL/

I think.

This sentence refers to the move of enqueue_throttle and the fact that se can't be null when goto enqueue_throttle and we can jump directly after the if statement, which is now removed in v2 because se is always NULL if we don't use goto enqueue_throttle.

I haven't change the commit message for the remove of if statement

Quoted 81 lines

It's more like if it doesn't jump to the label then se must be NULL for the loop to terminate. The final loop is a NOP if se is NULL. The check wasn't protecting that.

Otherwise still

Quoted 1 line

Cheers,
Phil

Quoted 63 lines

---

v2 changes:
- Remove useless if statement

 kernel/sched/fair.c | 39 ++++++++++++++++++++-------------------
 1 file changed, 20 insertions(+), 19 deletions(-)
kernel/sched/fair.c +20 -20
index a0c690d57430..b51b12d63c39 100644
@@ -5513,28 +5513,29 @@ enqueue_task_fair(struct rq *rq, struct task_struct *p, int flags)
                        list_add_leaf_cfs_rq(cfs_rq);
      }
 
-enqueue_throttle:
-     if (!se) {
-             add_nr_running(rq, 1);
-             /*
-              * Since new tasks are assigned an initial util_avg equal to
-              * half of the spare capacity of their CPU, tiny tasks have the
-              * ability to cross the overutilized threshold, which will
-              * result in the load balancer ruining all the task placement
-              * done by EAS. As a way to mitigate that effect, do not account
-              * for the first enqueue operation of new tasks during the
-              * overutilized flag detection.
-              *
-              * A better way of solving this problem would be to wait for
-              * the PELT signals of tasks to converge before taking them
-              * into account, but that is not straightforward to implement,
-              * and the following generally works well enough in practice.
-              */
-             if (flags & ENQUEUE_WAKEUP)
-                     update_overutilized_status(rq);
+     /* At this point se is NULL and we are at root level*/
+     add_nr_running(rq, 1);
+
+     /*
+      * Since new tasks are assigned an initial util_avg equal to
+      * half of the spare capacity of their CPU, tiny tasks have the
+      * ability to cross the overutilized threshold, which will
+      * result in the load balancer ruining all the task placement
+      * done by EAS. As a way to mitigate that effect, do not account
+      * for the first enqueue operation of new tasks during the
+      * overutilized flag detection.
+      *
+      * A better way of solving this problem would be to wait for
+      * the PELT signals of tasks to converge before taking them
+      * into account, but that is not straightforward to implement,
+      * and the following generally works well enough in practice.
+      */
+     if (flags & ENQUEUE_WAKEUP)
+             update_overutilized_status(rq);
 
      }
 
+enqueue_throttle:
      if (cfs_bandwidth_used()) {
              /*
               * When bandwidth control is enabled; the cfs_rq_throttled()
--
Quoted 2 lines

2.17.1

--

#3 lore raw
Quoted 11 lines · On Wed, May 13, 2020 at 03:10:28PM +0200 Vincent Guittot wrote:
Quoted 10 lines · Phil Auld

Hi Vincent,

Quoted 3 lines · On Wed, May 13, 2020 at 02:33:35PM +0200 Vincent Guittot wrote:

enqueue_task_fair jumps to enqueue_throttle label when cfs_rq_of(se) is throttled which means that se can't be NULL and we can skip the test.

s/be NULL/be non-NULL/

Quoted 9 lines
Quoted 1 line

I think.

This sentence refers to the move of enqueue_throttle and the fact that se can't be null when goto enqueue_throttle and we can jump directly after the if statement, which is now removed in v2 because se is always NULL if we don't use goto enqueue_throttle.

I haven't change the commit message for the remove of if statement

Fair enough, it just seems backwards from the intent of the patch now.

There is also an extra } after the update_overutilized_status.

Cheers,
Phil

Quoted 82 lines
Quoted 81 lines

It's more like if it doesn't jump to the label then se must be NULL for the loop to terminate. The final loop is a NOP if se is NULL. The check wasn't protecting that.

Otherwise still

Quoted 1 line

Cheers,
Phil

Quoted 63 lines

---

v2 changes:
- Remove useless if statement

 kernel/sched/fair.c | 39 ++++++++++++++++++++-------------------
 1 file changed, 20 insertions(+), 19 deletions(-)
kernel/sched/fair.c +20 -20
index a0c690d57430..b51b12d63c39 100644
@@ -5513,28 +5513,29 @@ enqueue_task_fair(struct rq *rq, struct task_struct *p, int flags)
                        list_add_leaf_cfs_rq(cfs_rq);
      }
 
-enqueue_throttle:
-     if (!se) {
-             add_nr_running(rq, 1);
-             /*
-              * Since new tasks are assigned an initial util_avg equal to
-              * half of the spare capacity of their CPU, tiny tasks have the
-              * ability to cross the overutilized threshold, which will
-              * result in the load balancer ruining all the task placement
-              * done by EAS. As a way to mitigate that effect, do not account
-              * for the first enqueue operation of new tasks during the
-              * overutilized flag detection.
-              *
-              * A better way of solving this problem would be to wait for
-              * the PELT signals of tasks to converge before taking them
-              * into account, but that is not straightforward to implement,
-              * and the following generally works well enough in practice.
-              */
-             if (flags & ENQUEUE_WAKEUP)
-                     update_overutilized_status(rq);
+     /* At this point se is NULL and we are at root level*/
+     add_nr_running(rq, 1);
+
+     /*
+      * Since new tasks are assigned an initial util_avg equal to
+      * half of the spare capacity of their CPU, tiny tasks have the
+      * ability to cross the overutilized threshold, which will
+      * result in the load balancer ruining all the task placement
+      * done by EAS. As a way to mitigate that effect, do not account
+      * for the first enqueue operation of new tasks during the
+      * overutilized flag detection.
+      *
+      * A better way of solving this problem would be to wait for
+      * the PELT signals of tasks to converge before taking them
+      * into account, but that is not straightforward to implement,
+      * and the following generally works well enough in practice.
+      */
+     if (flags & ENQUEUE_WAKEUP)
+             update_overutilized_status(rq);
 
      }
 
+enqueue_throttle:
      if (cfs_bandwidth_used()) {
              /*
               * When bandwidth control is enabled; the cfs_rq_throttled()
--
Quoted 2 lines

2.17.1

--

author maintainer
#4 lore raw
Quoted 20 lines · Phil Auld
Quoted 18 lines · On Wed, May 13, 2020 at 03:10:28PM +0200 Vincent Guittot wrote:
Quoted 11 lines · Phil Auld

Hi Vincent,

Quoted 3 lines · On Wed, May 13, 2020 at 02:33:35PM +0200 Vincent Guittot wrote:

enqueue_task_fair jumps to enqueue_throttle label when cfs_rq_of(se) is throttled which means that se can't be NULL and we can skip the test.

s/be NULL/be non-NULL/

I think.

This sentence refers to the move of enqueue_throttle and the fact that se can't be null when goto enqueue_throttle and we can jump directly after the if statement, which is now removed in v2 because se is always NULL if we don't use goto enqueue_throttle.

Quoted 6 lines
Quoted 2 lines

I haven't change the commit message for the remove of if statement

Fair enough, it just seems backwards from the intent of the patch now.

There is also an extra } after the update_overutilized_status.

don't know what I did but it's crap. sorry about that

Let me prepare a v3

Quoted 92 lines

Cheers,
Phil

Quoted 71 lines
Quoted 71 lines

It's more like if it doesn't jump to the label then se must be NULL for the loop to terminate. The final loop is a NOP if se is NULL. The check wasn't protecting that.

Otherwise still

Quoted 1 line

Cheers,
Phil

Quoted 58 lines

---

v2 changes:
- Remove useless if statement

 kernel/sched/fair.c | 39 ++++++++++++++++++++-------------------
 1 file changed, 20 insertions(+), 19 deletions(-)
kernel/sched/fair.c +19 -19
index a0c690d57430..b51b12d63c39 100644
@@ -5513,28 +5513,29 @@ enqueue_task_fair(struct rq *rq, struct task_struct *p, int flags)
                        list_add_leaf_cfs_rq(cfs_rq);
      }
 
-enqueue_throttle:
-     if (!se) {
-             add_nr_running(rq, 1);
-             /*
-              * Since new tasks are assigned an initial util_avg equal to
-              * half of the spare capacity of their CPU, tiny tasks have the
-              * ability to cross the overutilized threshold, which will
-              * result in the load balancer ruining all the task placement
-              * done by EAS. As a way to mitigate that effect, do not account
-              * for the first enqueue operation of new tasks during the
-              * overutilized flag detection.
-              *
-              * A better way of solving this problem would be to wait for
-              * the PELT signals of tasks to converge before taking them
-              * into account, but that is not straightforward to implement,
-              * and the following generally works well enough in practice.
-              */
-             if (flags & ENQUEUE_WAKEUP)
-                     update_overutilized_status(rq);
+     /* At this point se is NULL and we are at root level*/
+     add_nr_running(rq, 1);
+
+     /*
+      * Since new tasks are assigned an initial util_avg equal to
+      * half of the spare capacity of their CPU, tiny tasks have the
+      * ability to cross the overutilized threshold, which will
+      * result in the load balancer ruining all the task placement
+      * done by EAS. As a way to mitigate that effect, do not account
+      * for the first enqueue operation of new tasks during the
+      * overutilized flag detection.
+      *
+      * A better way of solving this problem would be to wait for
+      * the PELT signals of tasks to converge before taking them
+      * into account, but that is not straightforward to implement,
+      * and the following generally works well enough in practice.
+      */
+     if (flags & ENQUEUE_WAKEUP)
+             update_overutilized_status(rq);
 
      }
 
Quoted 11 lines
Quoted 10 lines
Quoted 7 lines
kernel/sched/fair.c +1 -1
+enqueue_throttle:
      if (cfs_bandwidth_used()) {
              /*
               * When bandwidth control is enabled; the cfs_rq_throttled()
--

2.17.1

--

--

#5 lore raw
Quoted 21 lines · On Wed, May 13, 2020 at 03:15:53PM +0200 Vincent Guittot wrote:
Quoted 20 lines · Phil Auld
Quoted 18 lines · On Wed, May 13, 2020 at 03:10:28PM +0200 Vincent Guittot wrote:
Quoted 11 lines · Phil Auld

Hi Vincent,

Quoted 3 lines · On Wed, May 13, 2020 at 02:33:35PM +0200 Vincent Guittot wrote:

enqueue_task_fair jumps to enqueue_throttle label when cfs_rq_of(se) is throttled which means that se can't be NULL and we can skip the test.

s/be NULL/be non-NULL/

I think.

This sentence refers to the move of enqueue_throttle and the fact that se can't be null when goto enqueue_throttle and we can jump directly after the if statement, which is now removed in v2 because se is always NULL if we don't use goto enqueue_throttle.

Quoted 9 lines
Quoted 6 lines
Quoted 2 lines

I haven't change the commit message for the remove of if statement

Fair enough, it just seems backwards from the intent of the patch now.

There is also an extra } after the update_overutilized_status.

don't know what I did but it's crap. sorry about that

No worries. I didn't see it when I read it either. The compiler told me :)

Quoted 95 lines

Let me prepare a v3

Quoted 92 lines

Cheers,
Phil

Quoted 71 lines
Quoted 71 lines

It's more like if it doesn't jump to the label then se must be NULL for the loop to terminate. The final loop is a NOP if se is NULL. The check wasn't protecting that.

Otherwise still

Quoted 1 line

Cheers,
Phil

Quoted 58 lines

---

v2 changes:
- Remove useless if statement

 kernel/sched/fair.c | 39 ++++++++++++++++++++-------------------
 1 file changed, 20 insertions(+), 19 deletions(-)
kernel/sched/fair.c +19 -19
index a0c690d57430..b51b12d63c39 100644
@@ -5513,28 +5513,29 @@ enqueue_task_fair(struct rq *rq, struct task_struct *p, int flags)
                        list_add_leaf_cfs_rq(cfs_rq);
      }
 
-enqueue_throttle:
-     if (!se) {
-             add_nr_running(rq, 1);
-             /*
-              * Since new tasks are assigned an initial util_avg equal to
-              * half of the spare capacity of their CPU, tiny tasks have the
-              * ability to cross the overutilized threshold, which will
-              * result in the load balancer ruining all the task placement
-              * done by EAS. As a way to mitigate that effect, do not account
-              * for the first enqueue operation of new tasks during the
-              * overutilized flag detection.
-              *
-              * A better way of solving this problem would be to wait for
-              * the PELT signals of tasks to converge before taking them
-              * into account, but that is not straightforward to implement,
-              * and the following generally works well enough in practice.
-              */
-             if (flags & ENQUEUE_WAKEUP)
-                     update_overutilized_status(rq);
+     /* At this point se is NULL and we are at root level*/
+     add_nr_running(rq, 1);
+
+     /*
+      * Since new tasks are assigned an initial util_avg equal to
+      * half of the spare capacity of their CPU, tiny tasks have the
+      * ability to cross the overutilized threshold, which will
+      * result in the load balancer ruining all the task placement
+      * done by EAS. As a way to mitigate that effect, do not account
+      * for the first enqueue operation of new tasks during the
+      * overutilized flag detection.
+      *
+      * A better way of solving this problem would be to wait for
+      * the PELT signals of tasks to converge before taking them
+      * into account, but that is not straightforward to implement,
+      * and the following generally works well enough in practice.
+      */
+     if (flags & ENQUEUE_WAKEUP)
+             update_overutilized_status(rq);
 
      }
 
Quoted 11 lines
Quoted 10 lines
Quoted 7 lines
kernel/sched/fair.c +1 -1
+enqueue_throttle:
      if (cfs_bandwidth_used()) {
              /*
               * When bandwidth control is enabled; the cfs_rq_throttled()
--

2.17.1

--

--

author maintainer
#6 lore raw
Quoted 26 lines · Phil Auld
Quoted 24 lines · On Wed, May 13, 2020 at 03:15:53PM +0200 Vincent Guittot wrote:
Quoted 23 lines · Phil Auld
Quoted 20 lines · On Wed, May 13, 2020 at 03:10:28PM +0200 Vincent Guittot wrote:
Quoted 11 lines · Phil Auld

Hi Vincent,

Quoted 3 lines · On Wed, May 13, 2020 at 02:33:35PM +0200 Vincent Guittot wrote:

enqueue_task_fair jumps to enqueue_throttle label when cfs_rq_of(se) is throttled which means that se can't be NULL and we can skip the test.

s/be NULL/be non-NULL/

I think.

This sentence refers to the move of enqueue_throttle and the fact that se can't be null when goto enqueue_throttle and we can jump directly after the if statement, which is now removed in v2 because se is always NULL if we don't use goto enqueue_throttle.

I haven't change the commit message for the remove of if statement

Quoted 8 lines
Quoted 6 lines
Quoted 3 lines

Fair enough, it just seems backwards from the intent of the patch now.

There is also an extra } after the update_overutilized_status.

don't know what I did but it's crap. sorry about that

No worries. I didn't see it when I read it either. The compiler told me :)

Yeah, but i thought that i compiled it which is obviously not true

Quoted 100 lines
Quoted 97 lines

Let me prepare a v3

Quoted 92 lines

Cheers,
Phil

Quoted 71 lines
Quoted 71 lines

It's more like if it doesn't jump to the label then se must be NULL for the loop to terminate. The final loop is a NOP if se is NULL. The check wasn't protecting that.

Otherwise still

Quoted 1 line

Cheers,
Phil

Quoted 58 lines

---

v2 changes:
- Remove useless if statement

 kernel/sched/fair.c | 39 ++++++++++++++++++++-------------------
 1 file changed, 20 insertions(+), 19 deletions(-)
kernel/sched/fair.c +19 -19
index a0c690d57430..b51b12d63c39 100644
@@ -5513,28 +5513,29 @@ enqueue_task_fair(struct rq *rq, struct task_struct *p, int flags)
                        list_add_leaf_cfs_rq(cfs_rq);
      }
 
-enqueue_throttle:
-     if (!se) {
-             add_nr_running(rq, 1);
-             /*
-              * Since new tasks are assigned an initial util_avg equal to
-              * half of the spare capacity of their CPU, tiny tasks have the
-              * ability to cross the overutilized threshold, which will
-              * result in the load balancer ruining all the task placement
-              * done by EAS. As a way to mitigate that effect, do not account
-              * for the first enqueue operation of new tasks during the
-              * overutilized flag detection.
-              *
-              * A better way of solving this problem would be to wait for
-              * the PELT signals of tasks to converge before taking them
-              * into account, but that is not straightforward to implement,
-              * and the following generally works well enough in practice.
-              */
-             if (flags & ENQUEUE_WAKEUP)
-                     update_overutilized_status(rq);
+     /* At this point se is NULL and we are at root level*/
+     add_nr_running(rq, 1);
+
+     /*
+      * Since new tasks are assigned an initial util_avg equal to
+      * half of the spare capacity of their CPU, tiny tasks have the
+      * ability to cross the overutilized threshold, which will
+      * result in the load balancer ruining all the task placement
+      * done by EAS. As a way to mitigate that effect, do not account
+      * for the first enqueue operation of new tasks during the
+      * overutilized flag detection.
+      *
+      * A better way of solving this problem would be to wait for
+      * the PELT signals of tasks to converge before taking them
+      * into account, but that is not straightforward to implement,
+      * and the following generally works well enough in practice.
+      */
+     if (flags & ENQUEUE_WAKEUP)
+             update_overutilized_status(rq);
 
      }
 
Quoted 11 lines
Quoted 10 lines
Quoted 7 lines
kernel/sched/fair.c +1 -1
+enqueue_throttle:
      if (cfs_bandwidth_used()) {
              /*
               * When bandwidth control is enabled; the cfs_rq_throttled()
--

2.17.1

--

--

--

#7 lore raw
Quoted 29 lines · On Wed, May 13, 2020 at 03:25:29PM +0200 Vincent Guittot wrote:
Quoted 28 lines · Phil Auld
Quoted 26 lines · On Wed, May 13, 2020 at 03:15:53PM +0200 Vincent Guittot wrote:
Quoted 25 lines · Phil Auld
Quoted 11 lines · On Wed, May 13, 2020 at 03:10:28PM +0200 Vincent Guittot wrote:
Quoted 10 lines · Phil Auld

Hi Vincent,

Quoted 3 lines · On Wed, May 13, 2020 at 02:33:35PM +0200 Vincent Guittot wrote:

enqueue_task_fair jumps to enqueue_throttle label when cfs_rq_of(se) is throttled which means that se can't be NULL and we can skip the test.

s/be NULL/be non-NULL/

Quoted 9 lines
Quoted 1 line

I think.

This sentence refers to the move of enqueue_throttle and the fact that se can't be null when goto enqueue_throttle and we can jump directly after the if statement, which is now removed in v2 because se is always NULL if we don't use goto enqueue_throttle.

I haven't change the commit message for the remove of if statement

Fair enough, it just seems backwards from the intent of the patch now.

Quoted 9 lines
Quoted 6 lines
Quoted 4 lines
Quoted 1 line

There is also an extra } after the update_overutilized_status.

don't know what I did but it's crap. sorry about that

No worries. I didn't see it when I read it either. The compiler told me :)

Yeah, but i thought that i compiled it which is obviously not true

It's that "obviously" correct stuff that bites you every time ;)

Quoted 101 lines
Quoted 100 lines
Quoted 97 lines

Let me prepare a v3

Quoted 92 lines

Cheers,
Phil

Quoted 71 lines
Quoted 71 lines

It's more like if it doesn't jump to the label then se must be NULL for the loop to terminate. The final loop is a NOP if se is NULL. The check wasn't protecting that.

Otherwise still

Quoted 1 line

Cheers,
Phil

Quoted 58 lines

---

v2 changes:
- Remove useless if statement

 kernel/sched/fair.c | 39 ++++++++++++++++++++-------------------
 1 file changed, 20 insertions(+), 19 deletions(-)
kernel/sched/fair.c +19 -19
index a0c690d57430..b51b12d63c39 100644
@@ -5513,28 +5513,29 @@ enqueue_task_fair(struct rq *rq, struct task_struct *p, int flags)
                        list_add_leaf_cfs_rq(cfs_rq);
      }
 
-enqueue_throttle:
-     if (!se) {
-             add_nr_running(rq, 1);
-             /*
-              * Since new tasks are assigned an initial util_avg equal to
-              * half of the spare capacity of their CPU, tiny tasks have the
-              * ability to cross the overutilized threshold, which will
-              * result in the load balancer ruining all the task placement
-              * done by EAS. As a way to mitigate that effect, do not account
-              * for the first enqueue operation of new tasks during the
-              * overutilized flag detection.
-              *
-              * A better way of solving this problem would be to wait for
-              * the PELT signals of tasks to converge before taking them
-              * into account, but that is not straightforward to implement,
-              * and the following generally works well enough in practice.
-              */
-             if (flags & ENQUEUE_WAKEUP)
-                     update_overutilized_status(rq);
+     /* At this point se is NULL and we are at root level*/
+     add_nr_running(rq, 1);
+
+     /*
+      * Since new tasks are assigned an initial util_avg equal to
+      * half of the spare capacity of their CPU, tiny tasks have the
+      * ability to cross the overutilized threshold, which will
+      * result in the load balancer ruining all the task placement
+      * done by EAS. As a way to mitigate that effect, do not account
+      * for the first enqueue operation of new tasks during the
+      * overutilized flag detection.
+      *
+      * A better way of solving this problem would be to wait for
+      * the PELT signals of tasks to converge before taking them
+      * into account, but that is not straightforward to implement,
+      * and the following generally works well enough in practice.
+      */
+     if (flags & ENQUEUE_WAKEUP)
+             update_overutilized_status(rq);
 
      }
 
Quoted 11 lines
Quoted 10 lines
Quoted 7 lines
kernel/sched/fair.c +1 -1
+enqueue_throttle:
      if (cfs_bandwidth_used()) {
              /*
               * When bandwidth control is enabled; the cfs_rq_throttled()
--

2.17.1

--

--

--