* [PATCH RFC] mm: memcontrol: add cgroup v2 interface to read memory watermark
@ 2019-06-15 8:20 Xi Ruoyao
2019-06-15 16:20 ` Tejun Heo
0 siblings, 1 reply; 2+ messages in thread
From: Xi Ruoyao @ 2019-06-15 8:20 UTC (permalink / raw)
To: Johannes Weiner, Michal Hocko, Vladimir Davydov
Cc: cgroups, linux-mm, linux-kernel
Introduce a control file memory.watermark showing the watermark
consumption of the cgroup and its descendants, in bytes.
Signed-off-by: Xi Ruoyao <xry111@mengyan1223.wang>
---
mm/memcontrol.c | 12 ++++++++++++
1 file changed, 12 insertions(+)
diff --git a/mm/memcontrol.c b/mm/memcontrol.c
index ba9138a4a1de..b1d968f2adcd 100644
--- a/mm/memcontrol.c
+++ b/mm/memcontrol.c
@@ -5495,6 +5495,13 @@ static u64 memory_current_read(struct cgroup_subsys_state
*css,
return (u64)page_counter_read(&memcg->memory) * PAGE_SIZE;
}
+static u64 memory_watermark_read(struct cgroup_subsys_state *css,
+ struct cftype *cft)
+{
+ struct mem_cgroup *memcg = mem_cgroup_from_css(css);
+ return (u64)memcg->memory.watermark * PAGE_SIZE;
+}
+
static int memory_min_show(struct seq_file *m, void *v)
{
return seq_puts_memcg_tunable(m,
@@ -5771,6 +5778,11 @@ static struct cftype memory_files[] = {
.flags = CFTYPE_NOT_ON_ROOT,
.read_u64 = memory_current_read,
},
+ {
+ .name = "watermark",
+ .flags = CFTYPE_NOT_ON_ROOT,
+ .read_u64 = memory_watermark_read,
+ },
{
.name = "min",
.flags = CFTYPE_NOT_ON_ROOT,
--
Xi Ruoyao <xry111@mengyan1223.wang>
School of Aerospace Science and Technology, Xidian University
^ permalink raw reply [flat|nested] 2+ messages in thread
* Re: [PATCH RFC] mm: memcontrol: add cgroup v2 interface to read memory watermark
2019-06-15 8:20 [PATCH RFC] mm: memcontrol: add cgroup v2 interface to read memory watermark Xi Ruoyao
@ 2019-06-15 16:20 ` Tejun Heo
0 siblings, 0 replies; 2+ messages in thread
From: Tejun Heo @ 2019-06-15 16:20 UTC (permalink / raw)
To: Xi Ruoyao
Cc: Johannes Weiner, Michal Hocko, Vladimir Davydov, cgroups,
linux-mm, linux-kernel, dschatzberg
On Sat, Jun 15, 2019 at 04:20:04PM +0800, Xi Ruoyao wrote:
> Introduce a control file memory.watermark showing the watermark
> consumption of the cgroup and its descendants, in bytes.
>
> Signed-off-by: Xi Ruoyao <xry111@mengyan1223.wang>
Memory usage w/o pressure metric isn't all that useful and reporting
just the historical maximum of memory.current can be outright
misleading. The use case of determining maximum amount of required
memory is legit but it needs to maintain sustained positive pressure
while taking measurements. There are efforts on this front, so let's
not merge this one for now.
Nacked-by: Tejun Heo <tj@kernel.org>
Thanks.
--
tejun
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2019-06-15 16:20 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-06-15 8:20 [PATCH RFC] mm: memcontrol: add cgroup v2 interface to read memory watermark Xi Ruoyao
2019-06-15 16:20 ` Tejun Heo
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox