Subject: Re: [PATCH v2 7/7] sched: Change task_struct::state

On 6/11/21 10:28 AM, Peter Zijlstra wrote:
> --- a/kernel/sched/deadline.c
> +++ b/kernel/sched/deadline.c
> @@ -348,10 +348,10 @@ static void task_non_contending(struct t
> if ((zerolag_time < 0) || hrtimer_active(&dl_se->inactive_timer)) {
> if (dl_task(p))
> sub_running_bw(dl_se, dl_rq);
> - if (!dl_task(p) || p->state == TASK_DEAD) {
> + if (!dl_task(p) || READ_ONCE(p->__state) == TASK_DEAD) {
> struct dl_bw *dl_b = dl_bw_of(task_cpu(p));
>
> - if (p->state == TASK_DEAD)
> + if (READ_ONCE(p->__state) == TASK_DEAD)
> sub_rq_bw(&p->dl, &rq->dl);
> raw_spin_lock(&dl_b->lock);
> __dl_sub(dl_b, p->dl.dl_bw, dl_bw_cpus(task_cpu(p)));
> @@ -1355,10 +1355,10 @@ static enum hrtimer_restart inactive_tas
> sched_clock_tick();
> update_rq_clock(rq);
>
> - if (!dl_task(p) || p->state == TASK_DEAD) {
> + if (!dl_task(p) || READ_ONCE(p->__state) == TASK_DEAD) {
> struct dl_bw *dl_b = dl_bw_of(task_cpu(p));
>
> - if (p->state == TASK_DEAD && dl_se->dl_non_contending) {
> + if (READ_ONCE(p->__state) == TASK_DEAD && dl_se->dl_non_contending) {
> sub_running_bw(&p->dl, dl_rq_of_se(&p->dl));
> sub_rq_bw(&p->dl, dl_rq_of_se(&p->dl));
> dl_se->dl_non_contending = 0;
> @@ -1722,7 +1722,7 @@ static void migrate_task_rq_dl(struct ta
> {
> struct rq *rq;
>
> - if (p->state != TASK_WAKING)
> + if (READ_ONCE(p->__state) != TASK_WAKING)
> return;
>
> rq = task_rq(p);

Reviewed-by: Daniel Bristot de Oliveira <[email protected]>

Feel free to add it to the other patches as well.

Thanks!
-- Daniel