linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] sched/fair: update comments in enqueue/dequeue_entity()
@ 2022-06-01  3:55 Chengming Zhou
  2022-06-03 12:08 ` Vincent Guittot
  0 siblings, 1 reply; 3+ messages in thread
From: Chengming Zhou @ 2022-06-01  3:55 UTC (permalink / raw)
  To: mingo, peterz, juri.lelli, vincent.guittot, dietmar.eggemann,
	rostedt, bsegall, mgorman, bristot, vschneid
  Cc: linux-kernel, Chengming Zhou

When reading the sched_avg related code, I found the comments in
enqueue/dequeue_entity() are not updated with the current code.

We don't add/subtract entity's runnable_avg from cfs_rq->runnable_avg
during enqueue/dequeue_entity(), those are done only for attach/detach.

This patch updates the comments to reflect the current code working.

Signed-off-by: Chengming Zhou <zhouchengming@bytedance.com>
---
 kernel/sched/fair.c | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/kernel/sched/fair.c b/kernel/sched/fair.c
index b3371fa40548..e0cd4052e32f 100644
--- a/kernel/sched/fair.c
+++ b/kernel/sched/fair.c
@@ -4348,7 +4348,8 @@ enqueue_entity(struct cfs_rq *cfs_rq, struct sched_entity *se, int flags)
 	/*
 	 * When enqueuing a sched_entity, we must:
 	 *   - Update loads to have both entity and cfs_rq synced with now.
-	 *   - Add its load to cfs_rq->runnable_avg
+	 *   - For group_entity, update its runnable_weight to reflect the new
+	 *     h_nr_running of its group cfs_rq.
 	 *   - For group_entity, update its weight to reflect the new share of
 	 *     its group cfs_rq
 	 *   - Add its new weight to cfs_rq->load.weight
@@ -4433,7 +4434,8 @@ dequeue_entity(struct cfs_rq *cfs_rq, struct sched_entity *se, int flags)
 	/*
 	 * When dequeuing a sched_entity, we must:
 	 *   - Update loads to have both entity and cfs_rq synced with now.
-	 *   - Subtract its load from the cfs_rq->runnable_avg.
+	 *   - For group_entity, update its runnable_weight to reflect the new
+	 *     h_nr_running of its group cfs_rq.
 	 *   - Subtract its previous weight from cfs_rq->load.weight.
 	 *   - For group entity, update its weight to reflect the new share
 	 *     of its group cfs_rq.
-- 
2.36.1


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

* Re: [PATCH] sched/fair: update comments in enqueue/dequeue_entity()
  2022-06-01  3:55 [PATCH] sched/fair: update comments in enqueue/dequeue_entity() Chengming Zhou
@ 2022-06-03 12:08 ` Vincent Guittot
  2022-06-15 14:41   ` [External] " Chengming Zhou
  0 siblings, 1 reply; 3+ messages in thread
From: Vincent Guittot @ 2022-06-03 12:08 UTC (permalink / raw)
  To: Chengming Zhou
  Cc: mingo, peterz, juri.lelli, dietmar.eggemann, rostedt, bsegall,
	mgorman, bristot, vschneid, linux-kernel

On Wed, 1 Jun 2022 at 05:55, Chengming Zhou <zhouchengming@bytedance.com> wrote:
>
> When reading the sched_avg related code, I found the comments in
> enqueue/dequeue_entity() are not updated with the current code.
>
> We don't add/subtract entity's runnable_avg from cfs_rq->runnable_avg
> during enqueue/dequeue_entity(), those are done only for attach/detach.
>
> This patch updates the comments to reflect the current code working.
>
> Signed-off-by: Chengming Zhou <zhouchengming@bytedance.com>

Acked-by: Vincent Guittot <vincent.guittot@linaro.org>

> ---
>  kernel/sched/fair.c | 6 ++++--
>  1 file changed, 4 insertions(+), 2 deletions(-)
>
> diff --git a/kernel/sched/fair.c b/kernel/sched/fair.c
> index b3371fa40548..e0cd4052e32f 100644
> --- a/kernel/sched/fair.c
> +++ b/kernel/sched/fair.c
> @@ -4348,7 +4348,8 @@ enqueue_entity(struct cfs_rq *cfs_rq, struct sched_entity *se, int flags)
>         /*
>          * When enqueuing a sched_entity, we must:
>          *   - Update loads to have both entity and cfs_rq synced with now.
> -        *   - Add its load to cfs_rq->runnable_avg
> +        *   - For group_entity, update its runnable_weight to reflect the new
> +        *     h_nr_running of its group cfs_rq.
>          *   - For group_entity, update its weight to reflect the new share of
>          *     its group cfs_rq
>          *   - Add its new weight to cfs_rq->load.weight
> @@ -4433,7 +4434,8 @@ dequeue_entity(struct cfs_rq *cfs_rq, struct sched_entity *se, int flags)
>         /*
>          * When dequeuing a sched_entity, we must:
>          *   - Update loads to have both entity and cfs_rq synced with now.
> -        *   - Subtract its load from the cfs_rq->runnable_avg.
> +        *   - For group_entity, update its runnable_weight to reflect the new
> +        *     h_nr_running of its group cfs_rq.
>          *   - Subtract its previous weight from cfs_rq->load.weight.
>          *   - For group entity, update its weight to reflect the new share
>          *     of its group cfs_rq.
> --
> 2.36.1
>

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

* Re: [External] Re: [PATCH] sched/fair: update comments in enqueue/dequeue_entity()
  2022-06-03 12:08 ` Vincent Guittot
@ 2022-06-15 14:41   ` Chengming Zhou
  0 siblings, 0 replies; 3+ messages in thread
From: Chengming Zhou @ 2022-06-15 14:41 UTC (permalink / raw)
  To: peterz
  Cc: Vincent Guittot, mingo, dietmar.eggemann, rostedt, bsegall,
	mgorman, linux-kernel

On 2022/6/3 20:08, Vincent Guittot wrote:
> On Wed, 1 Jun 2022 at 05:55, Chengming Zhou <zhouchengming@bytedance.com> wrote:
>>
>> When reading the sched_avg related code, I found the comments in
>> enqueue/dequeue_entity() are not updated with the current code.
>>
>> We don't add/subtract entity's runnable_avg from cfs_rq->runnable_avg
>> during enqueue/dequeue_entity(), those are done only for attach/detach.
>>
>> This patch updates the comments to reflect the current code working.
>>
>> Signed-off-by: Chengming Zhou <zhouchengming@bytedance.com>
> 
> Acked-by: Vincent Guittot <vincent.guittot@linaro.org>

Hello Peter, would you mind picking up this little patch too?

Thanks.

> 
>> ---
>>  kernel/sched/fair.c | 6 ++++--
>>  1 file changed, 4 insertions(+), 2 deletions(-)
>>
>> diff --git a/kernel/sched/fair.c b/kernel/sched/fair.c
>> index b3371fa40548..e0cd4052e32f 100644
>> --- a/kernel/sched/fair.c
>> +++ b/kernel/sched/fair.c
>> @@ -4348,7 +4348,8 @@ enqueue_entity(struct cfs_rq *cfs_rq, struct sched_entity *se, int flags)
>>         /*
>>          * When enqueuing a sched_entity, we must:
>>          *   - Update loads to have both entity and cfs_rq synced with now.
>> -        *   - Add its load to cfs_rq->runnable_avg
>> +        *   - For group_entity, update its runnable_weight to reflect the new
>> +        *     h_nr_running of its group cfs_rq.
>>          *   - For group_entity, update its weight to reflect the new share of
>>          *     its group cfs_rq
>>          *   - Add its new weight to cfs_rq->load.weight
>> @@ -4433,7 +4434,8 @@ dequeue_entity(struct cfs_rq *cfs_rq, struct sched_entity *se, int flags)
>>         /*
>>          * When dequeuing a sched_entity, we must:
>>          *   - Update loads to have both entity and cfs_rq synced with now.
>> -        *   - Subtract its load from the cfs_rq->runnable_avg.
>> +        *   - For group_entity, update its runnable_weight to reflect the new
>> +        *     h_nr_running of its group cfs_rq.
>>          *   - Subtract its previous weight from cfs_rq->load.weight.
>>          *   - For group entity, update its weight to reflect the new share
>>          *     of its group cfs_rq.
>> --
>> 2.36.1
>>

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

end of thread, other threads:[~2022-06-15 14:42 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-06-01  3:55 [PATCH] sched/fair: update comments in enqueue/dequeue_entity() Chengming Zhou
2022-06-03 12:08 ` Vincent Guittot
2022-06-15 14:41   ` [External] " Chengming Zhou

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).