sched/fair: Sync se's load_avg with cfs_rq in reweight_task
A message that is not in the archive (sent off-list or not yet received): [email protected]
-------- 转发的消息 --------
主题: Re: [PATCH v2] sched/fair: Sync se's load_avg with cfs_rq in reweight_task
日期: Mon, 29 Jul 2024 11:06:33 +0800
From: Chuyi Zhou <[email protected]>
收件人: Qais Yousef <[email protected]>, K Prateek Nayak <[email protected]>
抄送: [email protected], [email protected], [email protected], [email protected], [email protected], [email protected], [email protected], [email protected], [email protected], [email protected]
Hello Qais,
Quoted 49 lines · Qais Yousef
Quoted 30 lines · K Prateek Nayak
(+ Qais)
Hello Chuyi,
Quoted 25 lines · Chuyi Zhou
In
reweight_task(), there are two situations:1. The task was
on_rq, then the task'sload_avgis accurate because we synchronized it withcfs_rqthroughupdate_load_avg()indequeue_task().2. The task is sleeping, its
load_avgmight not have been updated for some time, which can result in inaccuratedequeue_load_avg()inreweight_entity().This patch solves this by using
update_load_avg()to synchronize theload_avgof se withcfs_rq. For tasks wereon_rq, since we already updateload_avgto accurate values indequeue_task(), this change will not have other effects due to the short time interval between the two updates.Signed-off-by Chuyi Zhou <[email protected]>---
Changes in v2:
- change the description in commit log.
- useupdate_load_avg()inreweight_task()rather than inreweight_entitysuggested by chengming.
- Link to v1: https://lore.kernel.org/lkml/[email protected]/--- kernel/sched/fair.c | 3 +++ 1 file changed, 3 insertions(+)Quoted 15 lines
Quoted 5 lines
kernel/sched/fair.c +0
-0kernel/sched/fair.c static void reweight_entity(struct cfs_rq *cfs_rq, struct sched_entity *se, · line 3844
Quoted 10 lines
kernel/sched/fair.c +3
-0@@ -3835,12 +3835,15 @@ static void reweight_entity(struct cfs_rq *cfs_rq, struct sched_entity *se, } } +static inline void update_load_avg (struct cfs_rq *cfs_rq,struct sched_entity *se,int flags); +void reweight_task (struct task_struct *p,const struct load_weight *lw) {struct sched_entity *se = &p->se;struct cfs_rq *cfs_rq =cfs_rq_of (se);struct load_weight *load = &se->load; +update_load_avg (cfs_rq, se,0 );White space and a comment perhaps?
Quoted 1 line
LGTM anyway.
Thanks for taking a look, will send another patch later.