[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <CAJy-Am=R=gRFqSdGjXaMqq7Yetpp-4=bLtnP-87GepN4zff5Tg@mail.gmail.com>
Date: Tue, 2 Jan 2024 21:00:22 +0800
From: Alex Shi <seakeel@...il.com>
To: Valentin Schneider <vschneid@...hat.com>
Cc: alexs@...nel.org, Ingo Molnar <mingo@...hat.com>,
Peter Zijlstra <peterz@...radead.org>, Juri Lelli <juri.lelli@...hat.com>,
Vincent Guittot <vincent.guittot@...aro.org>, Dietmar Eggemann <dietmar.eggemann@....com>,
Steven Rostedt <rostedt@...dmis.org>, Ben Segall <bsegall@...gle.com>, Mel Gorman <mgorman@...e.de>,
Daniel Bristot de Oliveira <bristot@...hat.com>, linux-kernel@...r.kernel.org, curuwang@...cent.com
Subject: Re: [PATCH] sched/tracing: correct the task blocking state
On Tue, Jan 2, 2024 at 6:19 PM Valentin Schneider <vschneid@...hat.com> wrote:
>
> On 02/01/24 15:33, alexs@...nel.org wrote:
> > From: Alex Shi <alexs@...nel.org>
> >
> > commit 80ed87c8a9ca ("sched/wait: Introduce TASK_NOLOAD and TASK_IDLE")
> > stopped the idle kthreads contribution to loadavg. Also task idle should
> > separated from blocked state too, otherwise we will get incorrect task
> > blocking state from event tracing sched:sched_stat_blocked.
> >
>
> Why is that incorrect? AFAICT we have mapped the (schedstat) 'blocked'
> meaning to TASK_UNINTERRUPTIBLE. TASK_IDLE tasks don't contribute to
> loadavg yes, but they are still in an UNINTERRUPTIBLE wait.
Hi Valentin,
Thanks a lot for the reply.
I agree with you the current usage, but if so, we account for the idle task into
blocked state. And it's better to distinguish between idle and block.
>
> > diff --git a/kernel/sched/deadline.c b/kernel/sched/deadline.c
> > index b28114478b82..b6afa596f071 100644
> > --- a/kernel/sched/deadline.c
> > +++ b/kernel/sched/deadline.c
> > @@ -1570,7 +1570,7 @@ update_stats_dequeue_dl(struct dl_rq *dl_rq, struct sched_dl_entity *dl_se,
> > __schedstat_set(p->stats.sleep_start,
> > rq_clock(rq_of_dl_rq(dl_rq)));
> >
> > - if (state & TASK_UNINTERRUPTIBLE)
> > + if (is_blocked_task_state(state))
> > __schedstat_set(p->stats.block_start,
> > rq_clock(rq_of_dl_rq(dl_rq)));
>
> This change makes it so tasks waiting in TASK_IDLE have their waiting
> ignored by schedstat (they are seen as neither INTERRUPTIBLE nor UNINTERRUPTIBLE).
>
Right, maybe it's time to add a new state for TASK_IDLE?
Many thanks!
Alex Shi
Powered by blists - more mailing lists