Re: [PATCH -next] mm/hugetlb_cgroup: introduce peak and rsvd.peak to v2

Andrew Morton
2024-07-03T20:38:05Z

On Wed, 3 Jul 2024 10:45:56 +0800 xiujianfeng <xiujianfeng@huawei.com> wrote:

>
>
> On 2024/7/3 9:58, Andrew Morton wrote:
> > On Tue, 2 Jul 2024 12:57:28 +0000 Xiu Jianfeng <xiujianfeng@huawei.com> wrote:
> >
> >> Introduce peak and rsvd.peak to v2 to show the historical maximum
> >> usage of resources, as in some scenarios it is necessary to configure
> >> the value of max/rsvd.max based on the peak usage of resources.
> >
> > "in some scenarios it is necessary" is not a strong statement. It
> > would be helpful to fully describe these scenarios so that others can
> > better understand the value of this change.
> >
>
> Hi Andrew,
>
> Is the following description acceptable for you?
>
>
> Since HugeTLB doesn't support page reclaim, enforcing the limit at
> page fault time implies that, the application will get SIGBUS signal
> if it tries to fault in HugeTLB pages beyond its limit. Therefore the
> application needs to know exactly how many HugeTLB pages it uses before
> hand, and the sysadmin needs to make sure that there are enough
> available on the machine for all the users to avoid processes getting
> SIGBUS.
>
> When running some open-source software, it may not be possible to know
> the exact amount of hugetlb it consumes, so cannot correctly configure
> the max value. If there is a peak metric, we can run the open-source
> software first and then configure the max based on the peak value.
> In cgroup v1, the hugetlb controller provides the max_usage_in_bytes
> and rsvd.max_usage_in_bytes interface to display the historical maximum
> usage, so introduce peak and rsvd.peak to v2 to address this issue.

Super, thanks for doing this.

It's getting late in the cycle, but the patch is simple so I'll add it
to mm-unstable for additional exposure. Hopefully some others can
offer their thoughts on the desirability of this.