Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1205336

[PATCH 8/8] memcg: generate file modified notifications on "memory.events"

From Tejun Heo <tj@kernel.org>
Newsgroups linux.kernel
Subject [PATCH 8/8] memcg: generate file modified notifications on "memory.events"
Date 2015-08-11 20:00 +0200
Message-ID <pWm0a-42O-5@gated-at.bofh.it> (permalink)
References <pWm09-42O-3@gated-at.bofh.it>
Organization linux.* mail to news gateway

Show all headers | View raw


cgroup core only recently grew generic notification support.  Wire up
"memory.events" so that it triggers a file modified event whenever its
content changes.

Signed-off-by: Tejun Heo <tj@kernel.org>
Cc: Li Zefan <lizefan@huawei.com>
Cc: Johannes Weiner <hannes@cmpxchg.org>
Cc: Michal Hocko <mhocko@kernel.org>
---
 mm/memcontrol.c | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/mm/memcontrol.c b/mm/memcontrol.c
index 78ba418..10db5f1 100644
--- a/mm/memcontrol.c
+++ b/mm/memcontrol.c
@@ -295,6 +295,9 @@ struct mem_cgroup {
 	/* OOM-Killer disable */
 	int		oom_kill_disable;
 
+	/* handle for "memory.events" */
+	struct cgroup_file events_file;
+
 	/* protect arrays of thresholds */
 	struct mutex thresholds_lock;
 
@@ -5499,6 +5502,7 @@ static struct cftype memory_files[] = {
 	{
 		.name = "events",
 		.flags = CFTYPE_NOT_ON_ROOT,
+		.file_offset = offsetof(struct mem_cgroup, events_file),
 		.seq_show = memory_events_show,
 	},
 	{ }	/* terminate */
@@ -5530,6 +5534,7 @@ void mem_cgroup_events(struct mem_cgroup *memcg,
 		       unsigned int nr)
 {
 	this_cpu_add(memcg->stat->events[idx], nr);
+	cgroup_file_notify(&memcg->events_file);
 }
 
 /**
-- 
2.4.3

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Back to linux.kernel | Previous | NextNext in thread | Find similar | Unroll thread


Thread

[PATCH 8/8] memcg: generate file modified notifications on "memory.events" Tejun Heo <tj@kernel.org> - 2015-08-11 20:00 +0200
  Re: [PATCH 8/8] memcg: generate file modified notifications on  "memory.events" Tejun Heo <tj@kernel.org> - 2015-08-11 20:10 +0200
    Re: [PATCH 8/8] memcg: generate file modified notifications on  "memory.events" Michal Hocko <mhocko@kernel.org> - 2015-08-17 16:40 +0200
      Re: [PATCH 8/8] memcg: generate file modified notifications on  "memory.events" Tejun Heo <tj@kernel.org> - 2015-08-17 22:00 +0200

csiph-web