History

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>

Wang Yaxin committed 1 year ago

Commit 0bf2d831 parent 66f28ff1 file · +29 −18Browse files

Showing the changes to include/uapi/linux (1 of 1 file). Show all

Unified · Split

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