Re: [PATCH 1/3] delaytop: add delay max for delaytop

From: Andrew Morton

Date: Thu Jul 02 2026 - 18:58:39 EST


On Thu, 2 Jul 2026 20:58:15 +0800 (CST) <wang.yaxin@xxxxxxxxxx> wrote:

> From: Wang Yaxin <wang.yaxin@xxxxxxxxxx>
>
> Previously delaytop only showed average delays. Add delay_max fields to
> track the maximum delay value for each delay type (cpu, blkio, irq, swapin,
> freepages, thrashing, compact, wpcopy) per task.
>
> This provides a global view of all tasks' delay spikes, which is essential
> for identifying processes that experienced brief but significant latency
> events that would be hidden by average-only metrics.
>
> The -t/--type option displays only the specified delay type with avg/max
> values side by side, allowing focused analysis:
> delaytop -t cpu # Show only CPU delay with avg/max
> delaytop -t wpcopy # Show Copy-on-Write delay with avg/max
>
> ...
>
> total1 = *(unsigned long long *)((char *)t1 + cfg.sort_field->total_offset);

The code does this pointer operation in many places. Is there a better
way? Should all those `unsigned long long' fields in `struct
task_info' be in an array, something like that?