[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <1196182bf902e36c8ecbf2afb7dd570e96c99ff4.1617642417.git.tim.c.chen@linux.intel.com>
Date: Mon, 5 Apr 2021 10:08:28 -0700
From: Tim Chen <tim.c.chen@...ux.intel.com>
To: Michal Hocko <mhocko@...e.cz>
Cc: Tim Chen <tim.c.chen@...ux.intel.com>,
Johannes Weiner <hannes@...xchg.org>,
Andrew Morton <akpm@...ux-foundation.org>,
Dave Hansen <dave.hansen@...el.com>,
Ying Huang <ying.huang@...el.com>,
Dan Williams <dan.j.williams@...el.com>,
David Rientjes <rientjes@...gle.com>,
Shakeel Butt <shakeelb@...gle.com>, linux-mm@...ck.org,
cgroups@...r.kernel.org, linux-kernel@...r.kernel.org
Subject: [RFC PATCH v1 04/11] mm: Report top tier memory usage in sysfs
In memory cgroup's sysfs, report the memory cgroup's usage
of top tier memory in a new field: "toptier_usage_in_bytes".
Signed-off-by: Tim Chen <tim.c.chen@...ux.intel.com>
---
mm/memcontrol.c | 8 ++++++++
1 file changed, 8 insertions(+)
diff --git a/mm/memcontrol.c b/mm/memcontrol.c
index fe7bb8613f5a..68590f46fa76 100644
--- a/mm/memcontrol.c
+++ b/mm/memcontrol.c
@@ -3631,6 +3631,7 @@ enum {
RES_FAILCNT,
RES_SOFT_LIMIT,
RES_TOPTIER_SOFT_LIMIT,
+ RES_TOPTIER_USAGE,
};
static u64 mem_cgroup_read_u64(struct cgroup_subsys_state *css,
@@ -3673,6 +3674,8 @@ static u64 mem_cgroup_read_u64(struct cgroup_subsys_state *css,
return (u64)memcg->soft_limit * PAGE_SIZE;
case RES_TOPTIER_SOFT_LIMIT:
return (u64)memcg->toptier_soft_limit * PAGE_SIZE;
+ case RES_TOPTIER_USAGE:
+ return (u64)page_counter_read(&memcg->toptier) * PAGE_SIZE;
default:
BUG();
}
@@ -5073,6 +5076,11 @@ static struct cftype mem_cgroup_legacy_files[] = {
.write = mem_cgroup_write,
.read_u64 = mem_cgroup_read_u64,
},
+ {
+ .name = "toptier_usage_in_bytes",
+ .private = MEMFILE_PRIVATE(_MEM, RES_TOPTIER_USAGE),
+ .read_u64 = mem_cgroup_read_u64,
+ },
{
.name = "failcnt",
.private = MEMFILE_PRIVATE(_MEM, RES_FAILCNT),
--
2.20.1
Powered by blists - more mailing lists