Skip to content

Commit 0bf2d83

Browse files
Wang Yaxinakpm00
authored andcommitted
taskstats: fix struct taskstats breaks backward compatibility since version 15
Problem ======== commit 658eb5a ("delayacct: add delay max to record delay peak") - adding more fields commit f65c64f ("delayacct: add delay min to record delay peak") - adding more fields commit b016d08 ("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 [[email protected]: adjust indentation] Link: https://lkml.kernel.org/r/[email protected] Link: https://lkml.kernel.org/r/[email protected] Fixes: f65c64f ("delayacct: add delay min to record delay peak") Signed-off-by: Wang Yaxin <[email protected]> Signed-off-by: xu xin <[email protected]> Signed-off-by: Kun Jiang <[email protected]> Reviewed-by: Yang Yang <[email protected]> Cc: Balbir Singh <[email protected]> Cc: <[email protected]> Signed-off-by: Andrew Morton <[email protected]>
1 parent 66f28ff commit 0bf2d83

File tree

1 file changed

+29
-18
lines changed

1 file changed

+29
-18
lines changed

include/uapi/linux/taskstats.h

Lines changed: 29 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@
3434
*/
3535

3636

37-
#define TASKSTATS_VERSION 15
37+
#define TASKSTATS_VERSION 16
3838
#define TS_COMM_LEN 32 /* should be >= TASK_COMM_LEN
3939
* in linux/sched.h */
4040

@@ -72,8 +72,6 @@ struct taskstats {
7272
*/
7373
__u64 cpu_count __attribute__((aligned(8)));
7474
__u64 cpu_delay_total;
75-
__u64 cpu_delay_max;
76-
__u64 cpu_delay_min;
7775

7876
/* Following four fields atomically updated using task->delays->lock */
7977

@@ -82,14 +80,10 @@ struct taskstats {
8280
*/
8381
__u64 blkio_count;
8482
__u64 blkio_delay_total;
85-
__u64 blkio_delay_max;
86-
__u64 blkio_delay_min;
8783

8884
/* Delay waiting for page fault I/O (swap in only) */
8985
__u64 swapin_count;
9086
__u64 swapin_delay_total;
91-
__u64 swapin_delay_max;
92-
__u64 swapin_delay_min;
9387

9488
/* cpu "wall-clock" running time
9589
* On some architectures, value will adjust for cpu time stolen
@@ -172,23 +166,18 @@ struct taskstats {
172166
/* Delay waiting for memory reclaim */
173167
__u64 freepages_count;
174168
__u64 freepages_delay_total;
175-
__u64 freepages_delay_max;
176-
__u64 freepages_delay_min;
169+
177170

178171
/* Delay waiting for thrashing page */
179172
__u64 thrashing_count;
180173
__u64 thrashing_delay_total;
181-
__u64 thrashing_delay_max;
182-
__u64 thrashing_delay_min;
183174

184175
/* v10: 64-bit btime to avoid overflow */
185176
__u64 ac_btime64; /* 64-bit begin time */
186177

187178
/* v11: Delay waiting for memory compact */
188179
__u64 compact_count;
189180
__u64 compact_delay_total;
190-
__u64 compact_delay_max;
191-
__u64 compact_delay_min;
192181

193182
/* v12 begin */
194183
__u32 ac_tgid; /* thread group ID */
@@ -210,15 +199,37 @@ struct taskstats {
210199
/* v13: Delay waiting for write-protect copy */
211200
__u64 wpcopy_count;
212201
__u64 wpcopy_delay_total;
213-
__u64 wpcopy_delay_max;
214-
__u64 wpcopy_delay_min;
215202

216203
/* v14: Delay waiting for IRQ/SOFTIRQ */
217204
__u64 irq_count;
218205
__u64 irq_delay_total;
219-
__u64 irq_delay_max;
220-
__u64 irq_delay_min;
221-
/* v15: add Delay max */
206+
207+
/* v15: add Delay max and Delay min */
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;
222233
};
223234

224235

0 commit comments

Comments
 (0)