On Tue, Jul 16, 2024 at 9:48 AM Michal Hocko mhocko@suse.com wrote:
On Mon 15-07-24 16:36:26, David Finkel wrote:
Other mechanisms for querying the peak memory usage of either a process or v1 memory cgroup allow for resetting the high watermark. Restore parity with those mechanisms.
For example:
- Any write to memory.max_usage_in_bytes in a cgroup v1 mount resets the high watermark.
- writing "5" to the clear_refs pseudo-file in a processes's proc directory resets the peak RSS.
This change copies the cgroup v1 behavior so any write to the memory.peak and memory.swap.peak pseudo-files reset the high watermark to the current usage.
This behavior is particularly useful for work scheduling systems that need to track memory usage of worker processes/cgroups per-work-item. Since memory can't be squeezed like CPU can (the OOM-killer has opinions), these systems need to track the peak memory usage to compute system/container fullness when binpacking workitems.
Signed-off-by: David Finkel davidf@vimeo.com
As mentioned down the email thread, I consider usefulness of peak value rather limited. It is misleading when memory is reclaimed. But fundamentally I do not oppose to unifying the write behavior to reset values.
The chnagelog could use some of the clarifications down the thread.
Sure, I can spend some time rewording the changelog this afternoon, and remail it. in a few hours.
Acked-by: Michal Hocko mhocko@suse.com
Thank you!
-- Michal Hocko SUSE Labs