lkml.org 
[lkml]   [2021]   [Apr]   [5]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
From
Subject[RFC PATCH v1 04/11] mm: Report top tier memory usage in sysfs
Date
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@linux.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
\
 
 \ /
  Last update: 2021-04-05 20:11    [W:0.338 / U:0.196 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site