Messages in this thread Patch in this message | | | Date | Tue, 25 Jan 2022 10:59:15 -0800 | From | Tadeusz Struk <> | Subject | Re: [PATCH v2] sched/fair: Fix fault in reweight_entity |
| |
On 1/25/22 10:30, Tadeusz Struk wrote: > On 1/25/22 01:14, Vincent Guittot wrote: >> Could we use : >> set_load_weight(p, !(p->__state & TASK_NEW)); >> instead of >> set_load_weight(p, true); >> in set_user_nice and __setscheduler_params. > > Wouldn't that require READ_ONCE() and rmb() after the read?
diff --git a/kernel/sched/core.c b/kernel/sched/core.c index 848eaa0efe0e..3d7ede06b971 100644 --- a/kernel/sched/core.c +++ b/kernel/sched/core.c @@ -6921,7 +6921,7 @@ void set_user_nice(struct task_struct *p, long nice) put_prev_task(rq, p);
p->static_prio = NICE_TO_PRIO(nice); - set_load_weight(p, true); + set_load_weight(p, !(READ_ONCE(p->__state) & TASK_NEW)); old_prio = p->prio; p->prio = effective_prio(p);
That works for me. I will send a new version soon. -- Thanks, Tadeusz
| |