Show toptier memory usage for a cgroup via sysfs: /sys/fs/cgroup/<group>/memory.toptier --- mm/memcontrol.c | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/mm/memcontrol.c b/mm/memcontrol.c index 2f20ec2712b8..5fd1e3b686cd 100644 --- a/mm/memcontrol.c +++ b/mm/memcontrol.c @@ -6205,6 +6205,14 @@ static u64 memory_current_read(struct cgroup_subsys_state *css, return (u64)page_counter_read(&memcg->memory) * PAGE_SIZE; } +static u64 memory_toptier_read(struct cgroup_subsys_state *css, + struct cftype *cft) +{ + struct mem_cgroup *memcg = mem_cgroup_from_css(css); + + return (u64)mem_cgroup_toptier_usage(memcg) * PAGE_SIZE; +} + static u64 memory_peak_read(struct cgroup_subsys_state *css, struct cftype *cft) { @@ -6516,6 +6524,11 @@ static struct cftype memory_files[] = { .flags = CFTYPE_NOT_ON_ROOT, .read_u64 = memory_current_read, }, + { + .name = "toptier", + .flags = CFTYPE_NOT_ON_ROOT, + .read_u64 = memory_toptier_read, + }, { .name = "peak", .flags = CFTYPE_NOT_ON_ROOT, -- 2.35.1