Messages in this thread Patch in this message |  | | From | Vincent Guittot <> | Subject | [PATCH 2/6] sched/core: Propagate parent task's latency requirements to the child task | Date | Fri, 11 Mar 2022 17:14:02 +0100 |
| |
From: Parth Shah <parth@linux.ibm.com>
Clone parent task's latency_nice attribute to the forked child task.
Reset the latency_nice value to default value when the child task is set to sched_reset_on_fork.
Also, initialize init_task.latency_nice value with DEFAULT_LATENCY_NICE value
Signed-off-by: Parth Shah <parth@linux.ibm.com> [rebase] Signed-off-by: Vincent Guittot <vincent.guittot@linaro.org> --- init/init_task.c | 1 + kernel/sched/core.c | 4 ++++ 2 files changed, 5 insertions(+)
diff --git a/init/init_task.c b/init/init_task.c index 73cc8f03511a..2afa249c253b 100644 --- a/init/init_task.c +++ b/init/init_task.c @@ -78,6 +78,7 @@ struct task_struct init_task .prio = MAX_PRIO - 20, .static_prio = MAX_PRIO - 20, .normal_prio = MAX_PRIO - 20, + .latency_nice = 0, .policy = SCHED_NORMAL, .cpus_ptr = &init_task.cpus_mask, .user_cpus_ptr = NULL, diff --git a/kernel/sched/core.c b/kernel/sched/core.c index 1d863d7f6ad7..157eef880d1d 100644 --- a/kernel/sched/core.c +++ b/kernel/sched/core.c @@ -4393,6 +4393,9 @@ int sched_fork(unsigned long clone_flags, struct task_struct *p) */ p->prio = current->normal_prio; + /* Propagate the parent's latency requirements to the child as well */ + p->latency_nice = current->latency_nice; + uclamp_fork(p); /* @@ -4409,6 +4412,7 @@ int sched_fork(unsigned long clone_flags, struct task_struct *p) p->prio = p->normal_prio = p->static_prio; set_load_weight(p, false); + p->latency_nice = DEFAULT_LATENCY_NICE; /* * We don't need the reset flag anymore after the fork. It has * fulfilled its duty: -- 2.17.1
|  |