Re: [PATCH linux next] delayacct: add delay max to record delay peak

From: Andrew Morton
Date: Tue Dec 03 2024 - 20:08:23 EST


On Tue, 3 Dec 2024 16:48:48 +0800 (CST) <jiang.kun2@xxxxxxxxxx> wrote:

> From: Wang Yaxin <wang.yaxin@xxxxxxxxxx>
>
> Introduce the use cases of delay max, which can help quickly detect
> potential abnormal delays in the system and record the types and
> specific details of delay spikes.
>
> Problem
> ========
> Delay accounting can track the average delay of processes to show
> system workload. However, when a process experiences a significant
> delay, maybe a delay spike, which adversely affects performance,
> getdelays can only display the average system delay over a period
> of time. Yet, average delay is unhelpful for diagnosing delay peak.
> It is not even possible to determine which type of delay has spiked,
> as this information might be masked by the average delay.
>
> Solution
> =========
> the 'delay max' can display delay peak since the system's startup,
> which can record potential abnormal delays over time, including
> the type of delay and the maximum delay. This is helpful for
> quickly identifying crash caused by delay.

Seems sensible, and the implementation is straightforward. I'll queue
it for testing and review.

> include/linux/delayacct.h | 7 ++++
> include/linux/sched.h | 3 ++
> include/uapi/linux/taskstats.h | 9 ++++++
> kernel/delayacct.c | 35 ++++++++++++++------
> kernel/sched/stats.h | 5 ++-
> tools/accounting/getdelays.c | 59 ++++++++++++++++++++--------------

Please prepare a v2 which includes an update to
Documentation/accounting/delay-accounting.rst.

>
> ...
>
> --- a/kernel/delayacct.c
> +++ b/kernel/delayacct.c
> @@ -95,7 +95,7 @@ void __delayacct_tsk_init(struct task_struct *tsk)
> * Finish delay accounting for a statistic using its timestamps (@start),
> * accumalator (@total) and @count

And I wouldn't be offended if v2 fixed that spelling error! "accumulator".