sched/fair: Fix sched_entity::avg::decay_count initialization
PATCH 1/1 sched/fair: Fix sched_entity::avg::decay_count initialization
Child has the same decay_count as parent. If it's not zero, we add it to parent's cfs_rq->removed_load:
wake_up_new_task()->set_task_cpu()->migrate_task_rq_fair().
Child's load is a just garbade after copying of parent, it hasn't been on cfs_rq yet, and it must not be added to cfs_rq::removed_load in migrate_task_rq_fair().
The patch moves sched_entity::avg::decay_count intialization in sched_fork(). So, migrate_task_rq_fair() does not change removed_load.
--- kernel/sched/core.c | 1 + kernel/sched/fair.c | 1 - 2 files changed, 1 insertion(+), 1 deletion(-)
kernel/sched/core.c +1 -0
@@ -1832,6 +1832,7 @@ static void __sched_fork(unsigned long clone_flags, struct task_struct *p) p->se.prev_sum_exec_runtime =0 ; p->se.nr_migrations =0 ; p->se.vruntime =0 ; + p->se.avg.decay_count =0 ;INIT_LIST_HEAD (&p->se.group_node);#ifdef CONFIG_SCHEDSTATS
kernel/sched/fair.c +0 -1
@@ -676,7 +676,6 @@ void init_task_runnable_average(struct task_struct *p) {u32 slice; - p->se.avg.decay_count =0 ; slice =sched_slice (task_cfs_rq (p), &p->se) >>10 ; p->se.avg.runnable_avg_sum = slice; p->se.avg.runnable_avg_period = slice;
Quoted 9 lines · Kirill Tkhai
Child has the same
decay_countas parent. If it's not zero, we add it to parent'scfs_rq->removed_load:wake_up_new_task()->set_task_cpu()->migrate_task_rq_fair().
Child's load is a just garbade after copying of parent, it hasn't been on
cfs_rqyet, and it must not be added tocfs_rq::removed_loadinmigrate_task_rq_fair().
Quoted 5 lines
The patch moves
sched_entity::avg::decay_countintialization insched_fork(). So,migrate_task_rq_fair()does not changeremoved_load.Signed-off-by Kirill Tkhai <[email protected]>
Quoted 37 lines
--- kernel/sched/core.c | 1 + kernel/sched/fair.c | 1 - 2 files changed, 1 insertion(+), 1 deletion(-)kernel/sched/core.c +1
-0@@ -1832,6 +1832,7 @@ static void __sched_fork(unsigned long clone_flags, struct task_struct *p) p->se.prev_sum_exec_runtime =0 ; p->se.nr_migrations =0 ; p->se.vruntime =0 ; + p->se.avg.decay_count =0 ;INIT_LIST_HEAD (&p->se.group_node);#ifdef CONFIG_SCHEDSTATS kernel/sched/fair.c +0
-2@@ -676,7 +676,6 @@ void init_task_runnable_average(struct task_struct *p) {u32 slice; - p->se.avg.decay_count =0 ; slice =sched_slice (task_cfs_rq (p), &p->se) >>10 ; p->se.avg.runnable_avg_sum = slice; p->se.avg.runnable_avg_period = slice; --To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
tip-bot for Kirill Tkhai
merge bot[tip:sched/core] sched/fair: Fix sched_entity::avg:: decay_count initialization
In reply to Kirill Tkhaisched/fair: Fix sched_entity::avg::decay_count initialization
Commit-ID: bb04159df99fa353d0fb524574aca03ce2c6515b Gitweb: http://git.kernel.org/tip/bb04159df99fa353d0fb524574aca03ce2c6515b Author: Kirill Tkhai <[email protected]> AuthorDate: Mon, 15 Dec 2014 14:56:58 +0300 Committer: Ingo Molnar <[email protected]> CommitDate: Wed, 14 Jan 2015 13:34:16 +0100
sched/fair: Fix sched_entity::avg::decay_count initialization
Child has the same decay_count as parent. If it's not zero, we add it to parent's cfs_rq->removed_load:
wake_up_new_task()->set_task_cpu()->migrate_task_rq_fair().
Child's load is a just garbade after copying of parent, it hasn't been on cfs_rq yet, and it must not be added to cfs_rq::removed_load in migrate_task_rq_fair().
The patch moves sched_entity::avg::decay_count intialization in sched_fork(). So, migrate_task_rq_fair() does not change removed_load.
--- kernel/sched/core.c | 3 +++ kernel/sched/fair.c | 1 - 2 files changed, 3 insertions(+), 1 deletion(-)
kernel/sched/core.c +3 -0
@@ -1832,6 +1832,9 @@ static void __sched_fork(unsigned long clone_flags, struct task_struct *p) p->se.prev_sum_exec_runtime =0 ; p->se.nr_migrations =0 ; p->se.vruntime =0 ; +#ifdef CONFIG_SMP + p->se.avg.decay_count =0 ; +#endif INIT_LIST_HEAD (&p->se.group_node);#ifdef CONFIG_SCHEDSTATS
kernel/sched/fair.c +0 -1
@@ -676,7 +676,6 @@ void init_task_runnable_average(struct task_struct *p) {u32 slice; - p->se.avg.decay_count =0 ; slice =sched_slice (task_cfs_rq (p), &p->se) >>10 ; p->se.avg.runnable_avg_sum = slice; p->se.avg.runnable_avg_period = slice;