Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

delayacct: fix uapi timespec64 definition

The custom definition of 'struct timespec64' is incompatible with both the
kernel's internal definition and the glibc type, at least on big-endian
targets that have the tv_nsec field in a different place, and the
definition clashes with any userspace that also defines a timespec64
structure.

Running the header check with -Wpadding enabled produces this output that
warns about the incorrect padding:

usr/include/linux/taskstats.h:25:1: error: padding struct size to alignment boundary with 4 bytes [-Werror=padded]

Remove the hack and instead use the regular __kernel_timespec type that is
meant to be used in uapi definitions.

Link: https://lkml.kernel.org/r/20260202095906.1344100-1-arnd@kernel.org
Fixes: 29b63f6eff0e ("delayacct: add timestamp of delay max")
Signed-off-by: Arnd Bergmann <arnd@arndb.de>
Cc: Fan Yu <fan.yu9@zte.com.cn>
Cc: Jonathan Corbet <corbet@lwn.net>
Cc: xu xin <xu.xin16@zte.com.cn>
Cc: Yang Yang <yang.yang29@zte.com.cn>
Cc: Balbir Singh <bsingharora@gmail.com>
Cc: Jiang Kun <jiang.kun2@zte.com.cn>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>

authored by

Arnd Bergmann and committed by
Andrew Morton
90079798 2e171ab2

+13 -20
+9 -18
include/uapi/linux/taskstats.h
··· 18 18 #define _LINUX_TASKSTATS_H 19 19 20 20 #include <linux/types.h> 21 - #ifdef __KERNEL__ 22 - #include <linux/time64.h> 23 - #else 24 - #ifndef _LINUX_TIME64_H 25 - struct timespec64 { 26 - __s64 tv_sec; /* seconds */ 27 - long tv_nsec; /* nanoseconds */ 28 - }; 29 - #endif 30 - #endif 21 + #include <linux/time_types.h> 31 22 32 23 /* Format for per-task data returned to userland when 33 24 * - a task exits ··· 233 242 __u64 irq_delay_min; 234 243 235 244 /*v17: delay max timestamp record*/ 236 - struct timespec64 cpu_delay_max_ts; 237 - struct timespec64 blkio_delay_max_ts; 238 - struct timespec64 swapin_delay_max_ts; 239 - struct timespec64 freepages_delay_max_ts; 240 - struct timespec64 thrashing_delay_max_ts; 241 - struct timespec64 compact_delay_max_ts; 242 - struct timespec64 wpcopy_delay_max_ts; 243 - struct timespec64 irq_delay_max_ts; 245 + struct __kernel_timespec cpu_delay_max_ts; 246 + struct __kernel_timespec blkio_delay_max_ts; 247 + struct __kernel_timespec swapin_delay_max_ts; 248 + struct __kernel_timespec freepages_delay_max_ts; 249 + struct __kernel_timespec thrashing_delay_max_ts; 250 + struct __kernel_timespec compact_delay_max_ts; 251 + struct __kernel_timespec wpcopy_delay_max_ts; 252 + struct __kernel_timespec irq_delay_max_ts; 244 253 }; 245 254 246 255
+4 -2
kernel/delayacct.c
··· 18 18 do { \ 19 19 d->type##_delay_max = tsk->delays->type##_delay_max; \ 20 20 d->type##_delay_min = tsk->delays->type##_delay_min; \ 21 - d->type##_delay_max_ts = tsk->delays->type##_delay_max_ts; \ 21 + d->type##_delay_max_ts.tv_sec = tsk->delays->type##_delay_max_ts.tv_sec; \ 22 + d->type##_delay_max_ts.tv_nsec = tsk->delays->type##_delay_max_ts.tv_nsec; \ 22 23 tmp = d->type##_delay_total + tsk->delays->type##_delay; \ 23 24 d->type##_delay_total = (tmp < d->type##_delay_total) ? 0 : tmp; \ 24 25 d->type##_count += tsk->delays->type##_count; \ ··· 176 175 177 176 d->cpu_delay_max = tsk->sched_info.max_run_delay; 178 177 d->cpu_delay_min = tsk->sched_info.min_run_delay; 179 - d->cpu_delay_max_ts = tsk->sched_info.max_run_delay_ts; 178 + d->cpu_delay_max_ts.tv_sec = tsk->sched_info.max_run_delay_ts.tv_sec; 179 + d->cpu_delay_max_ts.tv_nsec = tsk->sched_info.max_run_delay_ts.tv_nsec; 180 180 tmp = (s64)d->cpu_delay_total + t2; 181 181 d->cpu_delay_total = (tmp < (s64)d->cpu_delay_total) ? 0 : tmp; 182 182 tmp = (s64)d->cpu_run_virtual_total + t3;