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


Groups > linux.kernel > #1228315 > unrolled thread

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

Started byTejun Heo <tj@kernel.org>
First post2015-09-19 00:10 +0200
Last post2015-09-19 18:30 +0200
Articles 3 — 3 participants

Back to article view | Back to linux.kernel

This discussion starts older than the indexed window; earlier articles aren't shown. The article labeled Started by below is the oldest one visible, not the original post.


Contents

  [PATCH v2 8/8] memcg: generate file modified notifications on  "memory.events" Tejun Heo <tj@kernel.org> - 2015-09-19 00:10 +0200
    Re: [PATCH v2 8/8] memcg: generate file modified notifications on  "memory.events" Johannes Weiner <hannes@cmpxchg.org> - 2015-09-19 12:20 +0200
    Re: [PATCH v2 8/8] memcg: generate file modified notifications on  "memory.events" Michal Hocko <mhocko@kernel.org> - 2015-09-19 18:30 +0200

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

FromTejun Heo <tj@kernel.org>
Date2015-09-19 00:10 +0200
Subject[PATCH v2 8/8] memcg: generate file modified notifications on "memory.events"
Message-ID<qac0W-7kT-23@gated-at.bofh.it>
cgroup core only recently grew generic notification support.  Wire up
"memory.events" so that it triggers a file modified event whenever its
content changes.

v2: Refreshed on top of mem_cgroup relocation.

Signed-off-by: Tejun Heo <tj@kernel.org>
Acked-by: Michal Hocko <mhocko@kernel.org>
Cc: Li Zefan <lizefan@huawei.com>
Cc: Johannes Weiner <hannes@cmpxchg.org>
---
Hello,

Once cgroup/for-4.4 gets propagated to mm, this should apply cleanly.
Alternatively, I can apply it through the cgroup tree.  Which would
you prefer?

Thanks.

 include/linux/memcontrol.h |    4 ++++
 mm/memcontrol.c            |    1 +
 2 files changed, 5 insertions(+)

--- a/include/linux/memcontrol.h
+++ b/include/linux/memcontrol.h
@@ -213,6 +213,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;
 
@@ -286,6 +289,7 @@ static inline void mem_cgroup_events(str
 		       unsigned int nr)
 {
 	this_cpu_add(memcg->stat->events[idx], nr);
+	cgroup_file_notify(&memcg->events_file);
 }
 
 bool mem_cgroup_low(struct mem_cgroup *root, struct mem_cgroup *memcg);
--- a/mm/memcontrol.c
+++ b/mm/memcontrol.c
@@ -5202,6 +5202,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 */
--
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/

[toc] | [next] | [standalone]


#1228426

FromJohannes Weiner <hannes@cmpxchg.org>
Date2015-09-19 12:20 +0200
Message-ID<qanpo-6SK-39@gated-at.bofh.it>
In reply to#1228315
On Fri, Sep 18, 2015 at 06:01:59PM -0400, Tejun Heo wrote:
> cgroup core only recently grew generic notification support.  Wire up
> "memory.events" so that it triggers a file modified event whenever its
> content changes.
> 
> v2: Refreshed on top of mem_cgroup relocation.
> 
> Signed-off-by: Tejun Heo <tj@kernel.org>
> Acked-by: Michal Hocko <mhocko@kernel.org>
> Cc: Li Zefan <lizefan@huawei.com>
> Cc: Johannes Weiner <hannes@cmpxchg.org>

Acked-by: Johannes Weiner <hannes@cmpxchg.org>

> Once cgroup/for-4.4 gets propagated to mm, this should apply cleanly.
> Alternatively, I can apply it through the cgroup tree.  Which would
> you prefer?

cgroup tree works for me.
--
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/

[toc] | [prev] | [next] | [standalone]


#1228472

FromMichal Hocko <mhocko@kernel.org>
Date2015-09-19 18:30 +0200
Message-ID<qatbr-6DF-15@gated-at.bofh.it>
In reply to#1228315
On Fri 18-09-15 18:01:59, Tejun Heo wrote:
> Hello,
> 
> Once cgroup/for-4.4 gets propagated to mm, this should apply cleanly.
> Alternatively, I can apply it through the cgroup tree.  Which would
> you prefer?

I am OK to go via your tree as well.
-- 
Michal Hocko
SUSE Labs
--
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/

[toc] | [prev] | [standalone]


Back to top | Article view | linux.kernel


csiph-web