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.

taskstats: fix struct taskstats breaks backward compatibility since version 15

Problem
========
commit 658eb5ab916d ("delayacct: add delay max to record delay peak")
- adding more fields
commit f65c64f311ee ("delayacct: add delay min to record delay peak")
- adding more fields
commit b016d0873777 ("taskstats: modify taskstats version")
- version bump to 15

Since version 15 (TASKSTATS_VERSION=15) the new layout of the structure
adds fields in the middle of the structure, rendering all old software
incompatible with newer kernels and software compiled against the new
kernel headers incompatible with older kernels.

Solution
=========
move delay max and delay min to the end of taskstat, and bump
the version to 16 after the change

[wang.yaxin@zte.com.cn: adjust indentation]
Link: https://lkml.kernel.org/r/202505192131489882NSciXV4EGd8zzjLuwoOK@zte.com.cn
Link: https://lkml.kernel.org/r/20250510155413259V4JNRXxukdDgzsaL0Fo6a@zte.com.cn
Fixes: f65c64f311ee ("delayacct: add delay min to record delay peak")
Signed-off-by: Wang Yaxin <wang.yaxin@zte.com.cn>
Signed-off-by: xu xin <xu.xin16@zte.com.cn>
Signed-off-by: Kun Jiang <jiang.kun2@zte.com.cn>
Reviewed-by: Yang Yang <yang.yang29@zte.com.cn>
Cc: Balbir Singh <bsingharora@gmail.com>
Cc: <stable@vger.kernel.org>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>

authored by

Wang Yaxin and committed by
Andrew Morton
0bf2d838 66f28ffb

+29 -18
+29 -18
include/uapi/linux/taskstats.h
··· 34 34 */ 35 35 36 36 37 - #define TASKSTATS_VERSION 15 37 + #define TASKSTATS_VERSION 16 38 38 #define TS_COMM_LEN 32 /* should be >= TASK_COMM_LEN 39 39 * in linux/sched.h */ 40 40 ··· 72 72 */ 73 73 __u64 cpu_count __attribute__((aligned(8))); 74 74 __u64 cpu_delay_total; 75 - __u64 cpu_delay_max; 76 - __u64 cpu_delay_min; 77 75 78 76 /* Following four fields atomically updated using task->delays->lock */ 79 77 ··· 80 82 */ 81 83 __u64 blkio_count; 82 84 __u64 blkio_delay_total; 83 - __u64 blkio_delay_max; 84 - __u64 blkio_delay_min; 85 85 86 86 /* Delay waiting for page fault I/O (swap in only) */ 87 87 __u64 swapin_count; 88 88 __u64 swapin_delay_total; 89 - __u64 swapin_delay_max; 90 - __u64 swapin_delay_min; 91 89 92 90 /* cpu "wall-clock" running time 93 91 * On some architectures, value will adjust for cpu time stolen ··· 166 172 /* Delay waiting for memory reclaim */ 167 173 __u64 freepages_count; 168 174 __u64 freepages_delay_total; 169 - __u64 freepages_delay_max; 170 - __u64 freepages_delay_min; 175 + 171 176 172 177 /* Delay waiting for thrashing page */ 173 178 __u64 thrashing_count; 174 179 __u64 thrashing_delay_total; 175 - __u64 thrashing_delay_max; 176 - __u64 thrashing_delay_min; 177 180 178 181 /* v10: 64-bit btime to avoid overflow */ 179 182 __u64 ac_btime64; /* 64-bit begin time */ ··· 178 187 /* v11: Delay waiting for memory compact */ 179 188 __u64 compact_count; 180 189 __u64 compact_delay_total; 181 - __u64 compact_delay_max; 182 - __u64 compact_delay_min; 183 190 184 191 /* v12 begin */ 185 192 __u32 ac_tgid; /* thread group ID */ ··· 199 210 /* v13: Delay waiting for write-protect copy */ 200 211 __u64 wpcopy_count; 201 212 __u64 wpcopy_delay_total; 202 - __u64 wpcopy_delay_max; 203 - __u64 wpcopy_delay_min; 204 213 205 214 /* v14: Delay waiting for IRQ/SOFTIRQ */ 206 215 __u64 irq_count; 207 216 __u64 irq_delay_total; 208 - __u64 irq_delay_max; 209 - __u64 irq_delay_min; 210 - /* v15: add Delay max */ 217 + 218 + /* v15: add Delay max and Delay min */ 219 + 220 + /* v16: move Delay max and Delay min to the end of taskstat */ 221 + __u64 cpu_delay_max; 222 + __u64 cpu_delay_min; 223 + 224 + __u64 blkio_delay_max; 225 + __u64 blkio_delay_min; 226 + 227 + __u64 swapin_delay_max; 228 + __u64 swapin_delay_min; 229 + 230 + __u64 freepages_delay_max; 231 + __u64 freepages_delay_min; 232 + 233 + __u64 thrashing_delay_max; 234 + __u64 thrashing_delay_min; 235 + 236 + __u64 compact_delay_max; 237 + __u64 compact_delay_min; 238 + 239 + __u64 wpcopy_delay_max; 240 + __u64 wpcopy_delay_min; 241 + 242 + __u64 irq_delay_max; 243 + __u64 irq_delay_min; 211 244 }; 212 245 213 246