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


Groups > linux.kernel > #1205336 > unrolled thread

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

Started byTejun Heo <tj@kernel.org>
First post2015-08-11 20:00 +0200
Last post2015-08-17 22:00 +0200
Articles 4 — 2 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 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

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

FromTejun Heo <tj@kernel.org>
Date2015-08-11 20:00 +0200
Subject[PATCH 8/8] memcg: generate file modified notifications on "memory.events"
Message-ID<pWm0a-42O-5@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.

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/

[toc] | [next] | [standalone]


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

FromTejun Heo <tj@kernel.org>
Date2015-08-11 20:10 +0200
SubjectRe: [PATCH 8/8] memcg: generate file modified notifications on "memory.events"
Message-ID<pWm9Q-4tl-23@gated-at.bofh.it>
In reply to#1205336
On Tue, Aug 11, 2015 at 01:58:09PM -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.
> 
> 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>

So, this won't apply to the current -mm.  Once the earlier part of the
series gets applied to cgroup/for-4.3, I'll refresh this patch on top
of -mm.

Thanks.

-- 
tejun
--
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]


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

FromMichal Hocko <mhocko@kernel.org>
Date2015-08-17 16:40 +0200
SubjectRe: [PATCH 8/8] memcg: generate file modified notifications on "memory.events"
Message-ID<pYtJU-1F3-33@gated-at.bofh.it>
In reply to#1205347
[Ups this was hanging in to-be-posted since last week - sorry about that]

On Tue 11-08-15 14:02:36, Tejun Heo wrote:
> On Tue, Aug 11, 2015 at 01:58:09PM -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.
> > 
> > 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>

I cannot say I would be fond of the offset logic but whatever suits the
cgroup core...

Acked-by: Michal Hocko <mhocko@suse.com>

> So, this won't apply to the current -mm.  Once the earlier part of the
> series gets applied to cgroup/for-4.3, I'll refresh this patch on top
> of -mm.

I think you can route it via the same tree.

-- 
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] | [next] | [standalone]


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

FromTejun Heo <tj@kernel.org>
Date2015-08-17 22:00 +0200
SubjectRe: [PATCH 8/8] memcg: generate file modified notifications on "memory.events"
Message-ID<pYyJz-lu-7@gated-at.bofh.it>
In reply to#1208626
Hello, Michal.

On Mon, Aug 17, 2015 at 04:30:57PM +0200, Michal Hocko wrote:
> I cannot say I would be fond of the offset logic but whatever suits the
> cgroup core...

I don't particularly like it either but couldn't think of anything
prettier. :(

Thanks.

-- 
tejun
--
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