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

tsacct: add 64-bit btime field

As there is only a 32-bit ac_btime field in taskstat and
we should handle dates after the overflow, add a new field
with the same information but 64-bit width that can hold
a full time64_t.

Signed-off-by: Arnd Bergmann <arnd@arndb.de>

+5 -1
+4 -1
include/uapi/linux/taskstats.h
··· 34 34 */ 35 35 36 36 37 - #define TASKSTATS_VERSION 9 37 + #define TASKSTATS_VERSION 10 38 38 #define TS_COMM_LEN 32 /* should be >= TASK_COMM_LEN 39 39 * in linux/sched.h */ 40 40 ··· 169 169 /* Delay waiting for thrashing page */ 170 170 __u64 thrashing_count; 171 171 __u64 thrashing_delay_total; 172 + 173 + /* v10: 64-bit btime to avoid overflow */ 174 + __u64 ac_btime64; /* 64-bit begin time */ 172 175 }; 173 176 174 177
+1
kernel/tsacct.c
··· 36 36 /* Convert to seconds for btime (note y2106 limit) */ 37 37 btime = ktime_get_real_seconds() - div_u64(delta, USEC_PER_SEC); 38 38 stats->ac_btime = clamp_t(time64_t, btime, 0, U32_MAX); 39 + stats->ac_btime64 = btime; 39 40 40 41 if (thread_group_leader(tsk)) { 41 42 stats->ac_exitcode = tsk->exit_code;