[PATCH v2 0/2] tsacct: keep task begin times stable across suspend

From: Hungyu Lin

Date: Fri Oct 30 2026 - 01:42:55 EST


Keep taskstats begin times stable across suspend without changing the
MONOTONIC elapsed-time fields.

Patch 1 makes getboottime64() sample its offsets under tk_core.seq.
Patch 2 uses that helper and the task's BOOTTIME start timestamp, and
clamps negative begin times to zero. Keep the helper prerequisite when
backporting the taskstats change.

Changes in v2, addressing Andrew Morton's review:
- Add the getboottime64() sampling prerequisite as patch 1/2.
- Lower-clamp ac_btime64 without imposing a 32-bit upper limit.
- Add Cc: stable to both patches.
- Rebase onto mainline d89e1d186ec9.

Validation used GCC 13.3.0 with W=1. ARM64 and native 32-bit SMP x86 QEMU
guests pass all 36 checks, including the original 24. The 32-bit helper
stress reproduced inconsistent timestamps before the fix and none after.
Suspend time was injected through the real timekeeping hook.

v1: https://lore.kernel.org/r/20261026005506.2253-1-dennylin0707@xxxxxxxxx

Hungyu Lin (2):
timekeeping: Read getboottime64() offsets under the sequence counter
tsacct: keep task begin times stable across suspend

kernel/time/timekeeping.c | 8 +++++++-
kernel/tsacct.c | 10 ++++++----
2 files changed, 13 insertions(+), 5 deletions(-)


base-commit: d89e1d186ec9271bf78e62771779e9fc03bf0fc3
--
2.43.0