diff options
| author | Wilson Felipe Pereira <wfelipe@google.com> | 2026-11-06 18:55:06 +0000 |
|---|---|---|
| committer | Tejun Heo <tj@kernel.org> | 2026-11-09 05:59:40 -1000 |
| commit | 79922ba71c838f68e7b3128a1a24e4f1dfbc99c7 (patch) | |
| tree | f0ab88b27c20278031c5113d2c7e2ec244081896 /scripts/Makefile.thinlto | |
| parent | 0449f2682b6002d6db7a9a25b702fb770119a4d6 (diff) | |
| download | linux-next-79922ba71c838f68e7b3128a1a24e4f1dfbc99c7.tar.gz linux-next-79922ba71c838f68e7b3128a1a24e4f1dfbc99c7.zip | |
selftests/cgroup: convert cg_read_*long*() helpers to s64
Cgroup byte and time counters in control files (such as memory.current,
memory.peak, memory.stat, and cpu.stat) are exported by the kernel as
64-bit values, while cg_read_long(), cg_read_long_fd(), and
cg_read_key_long() parse them with atol() and return a signed long. On
32-bit platforms, atol() clamps values above 2 GiB to LONG_MAX.
Although current tests do not allocate enough memory to hit LONG_MAX,
converting these helpers to 64-bit keeps the selftest types consistent
with the kernel counters and avoids 32-bit truncation:
- Define s64 as int64_t in cgroup_util.h (matching
tools/include/linux/types.h) and use PRId64 from <inttypes.h>.
- Convert cg_read_long(), cg_read_long_fd(), cg_read_key_long(), and
cg_read_key_long_poll() to cg_read_s64(), cg_read_s64_fd(),
cg_read_key_s64(), and cg_read_key_s64_poll() using atoll().
- Update cg_write_numeric(), values_close(), and values_close_report()
to take s64 and use llabs().
- Update callers across the cgroup selftests to use s64 and PRId64.
Suggested-by: Michal Koutný <mkoutny@suse.com>
Signed-off-by: Wilson Felipe Pereira <wfelipe@google.com>
Signed-off-by: Tejun Heo <tj@kernel.org>
Diffstat (limited to 'scripts/Makefile.thinlto')
0 files changed, 0 insertions, 0 deletions
