diff --git a/Documentation/admin-guide/cgroup-v2.rst b/Documentation/admin-guide/cgroup-v2.rst index 69af2173555fb6..759fc70e653702 100644 --- a/Documentation/admin-guide/cgroup-v2.rst +++ b/Documentation/admin-guide/cgroup-v2.rst @@ -2645,6 +2645,14 @@ HugeTLB Interface Files hugetlb pages of in this cgroup. Only active in use hugetlb pages are included. The per-node values are in bytes. + hugetlb..peak + Show historical maximum usage for "hugepagesize" hugetlb. It exists + for all the cgroup except root. + + hugetlb..rsvd.peak + Show historical maximum usage for "hugepagesize" hugetlb reservations. + It exists for all the cgroup except root. + Misc ---- diff --git a/mm/hugetlb_cgroup.c b/mm/hugetlb_cgroup.c index e716c4671a1595..d8d0e665caed90 100644 --- a/mm/hugetlb_cgroup.c +++ b/mm/hugetlb_cgroup.c @@ -583,6 +583,13 @@ static int hugetlb_cgroup_read_u64_max(struct seq_file *seq, void *v) else seq_printf(seq, "%llu\n", val * PAGE_SIZE); break; + case RES_RSVD_MAX_USAGE: + counter = &h_cg->rsvd_hugepage[idx]; + fallthrough; + case RES_MAX_USAGE: + val = (u64)counter->watermark; + seq_printf(seq, "%llu\n", val * PAGE_SIZE); + break; default: BUG(); } @@ -739,6 +746,18 @@ static struct cftype hugetlb_dfl_tmpl[] = { .seq_show = hugetlb_cgroup_read_u64_max, .flags = CFTYPE_NOT_ON_ROOT, }, + { + .name = "peak", + .private = RES_MAX_USAGE, + .seq_show = hugetlb_cgroup_read_u64_max, + .flags = CFTYPE_NOT_ON_ROOT, + }, + { + .name = "rsvd.peak", + .private = RES_RSVD_MAX_USAGE, + .seq_show = hugetlb_cgroup_read_u64_max, + .flags = CFTYPE_NOT_ON_ROOT, + }, { .name = "events", .seq_show = hugetlb_events_show,