News: 0001604844

  ARM Give a man a fire and he's warm for a day, but set fire to him and he's warm for the rest of his life (Terry Pratchett, Jingo)

NVIDIA Optimizes Printing Of Linux Memory Stats For 11% System Time Savings

([Linux Kernel] 4 Hours Ago printf restructuring)


A NVIDIA engineer restructuring some of the printf-related code within the memory resource controller "memcg" statistics printing code to reduce the system time by 11% for dumping those stats.

NVIDIA continues investing more and more into lower-level Linux kernel engineering improvements given their grand successes in the data center, beyond just their traditional scope of GPU and networking subsystems. One of their latest improvements they are working to upstream is to the memory management code to optimize the statistics output printing for an 11% reduction in system time needed. This is for reading the likes of /sys/fs/cgroup/memory.stat and /sys/fs/cgroup/memory.numa_stat .

It's less than a one second difference in their memcg stat output testing -- and that's benchmarking it one million times -- albeit all the little optimizations add up over time. Leave no stone unturned especially with Intel having long been known for their relentless Linux kernel optimizations albeit over the past year have lost a number of their Linux kernel engineers and a reduction in resources, so it's nice seeing NVIDIA engineers working more in these areas.

"Replace seq_printf/seq_buf_printf with lightweight helpers to avoid printf parsing in memcg stats output.

Key changes:

- Add memcg_seq_put_name_val() for seq_file "name value\n" formatting

- Add memcg_seq_buf_put_name_val() for seq_buf "name value\n" formatting

- Update __memory_events_show(), swap_events_show(), memory_stat_format(), memory_numa_stat_show(), and related helpers"

Those frequently making use of the memcg stats output can find the proposed patch on the [1]Linux kernel mailing list .



[1] https://lore.kernel.org/lkml/20260108093610.212023-1-jianyuew@nvidia.com/



God is Dead.
-- Nietzsche
Nietzsche is Dead.
-- God
Nietzsche is God.
-- Dead