lkml.org 
[lkml]   [2022]   [Jan]   [25]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
    Patch in this message
    /
    Date
    From
    SubjectRe: [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

    \
     
     \ /
      Last update: 2022-01-25 20:02    [W:3.931 / U:0.092 seconds]
    ©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site