From: Michal Hocko <mhocko@kernel.org> To: Johannes Weiner <hannes@cmpxchg.org> Cc: Andrew Morton <akpm@linux-foundation.org>, Vladimir Davydov <vdavydov.dev@gmail.com>, linux-mm@kvack.org, cgroups@vger.kernel.org, linux-kernel@vger.kernel.org, kernel-team@fb.com Subject: Re: [PATCH 1/4] mm: memcontrol: clean up memory.events counting function Date: Fri, 7 Apr 2017 14:20:39 +0200 [thread overview] Message-ID: <20170407122038.GD16413@dhcp22.suse.cz> (raw) In-Reply-To: <20170404220148.28338-1-hannes@cmpxchg.org> On Tue 04-04-17 18:01:45, Johannes Weiner wrote: > We only ever count single events, drop the @nr parameter. Rename the > function accordingly. Remove low-information kerneldoc. > > Signed-off-by: Johannes Weiner <hannes@cmpxchg.org> Acked-by: Michal Hocko <mhocko@suse.com> > --- > include/linux/memcontrol.h | 18 +++++------------- > mm/memcontrol.c | 8 ++++---- > mm/vmscan.c | 2 +- > 3 files changed, 10 insertions(+), 18 deletions(-) > > diff --git a/include/linux/memcontrol.h b/include/linux/memcontrol.h > index cfa91a3ca0ca..bc0c16e284c0 100644 > --- a/include/linux/memcontrol.h > +++ b/include/linux/memcontrol.h > @@ -287,17 +287,10 @@ static inline bool mem_cgroup_disabled(void) > return !cgroup_subsys_enabled(memory_cgrp_subsys); > } > > -/** > - * mem_cgroup_events - count memory events against a cgroup > - * @memcg: the memory cgroup > - * @idx: the event index > - * @nr: the number of events to account for > - */ > -static inline void mem_cgroup_events(struct mem_cgroup *memcg, > - enum mem_cgroup_events_index idx, > - unsigned int nr) > +static inline void mem_cgroup_event(struct mem_cgroup *memcg, > + enum mem_cgroup_events_index idx) > { > - this_cpu_add(memcg->stat->events[idx], nr); > + this_cpu_inc(memcg->stat->events[idx]); > cgroup_file_notify(&memcg->events_file); > } > > @@ -614,9 +607,8 @@ static inline bool mem_cgroup_disabled(void) > return true; > } > > -static inline void mem_cgroup_events(struct mem_cgroup *memcg, > - enum mem_cgroup_events_index idx, > - unsigned int nr) > +static inline void mem_cgroup_event(struct mem_cgroup *memcg, > + enum mem_cgroup_events_index idx) > { > } > > diff --git a/mm/memcontrol.c b/mm/memcontrol.c > index 108d5b097db1..1ffa3ad201ea 100644 > --- a/mm/memcontrol.c > +++ b/mm/memcontrol.c > @@ -1825,7 +1825,7 @@ static void reclaim_high(struct mem_cgroup *memcg, > do { > if (page_counter_read(&memcg->memory) <= memcg->high) > continue; > - mem_cgroup_events(memcg, MEMCG_HIGH, 1); > + mem_cgroup_event(memcg, MEMCG_HIGH); > try_to_free_mem_cgroup_pages(memcg, nr_pages, gfp_mask, true); > } while ((memcg = parent_mem_cgroup(memcg))); > } > @@ -1916,7 +1916,7 @@ static int try_charge(struct mem_cgroup *memcg, gfp_t gfp_mask, > if (!gfpflags_allow_blocking(gfp_mask)) > goto nomem; > > - mem_cgroup_events(mem_over_limit, MEMCG_MAX, 1); > + mem_cgroup_event(mem_over_limit, MEMCG_MAX); > > nr_reclaimed = try_to_free_mem_cgroup_pages(mem_over_limit, nr_pages, > gfp_mask, may_swap); > @@ -1959,7 +1959,7 @@ static int try_charge(struct mem_cgroup *memcg, gfp_t gfp_mask, > if (fatal_signal_pending(current)) > goto force; > > - mem_cgroup_events(mem_over_limit, MEMCG_OOM, 1); > + mem_cgroup_event(mem_over_limit, MEMCG_OOM); > > mem_cgroup_oom(mem_over_limit, gfp_mask, > get_order(nr_pages * PAGE_SIZE)); > @@ -5142,7 +5142,7 @@ static ssize_t memory_max_write(struct kernfs_open_file *of, > continue; > } > > - mem_cgroup_events(memcg, MEMCG_OOM, 1); > + mem_cgroup_event(memcg, MEMCG_OOM); > if (!mem_cgroup_out_of_memory(memcg, GFP_KERNEL, 0)) > break; > } > diff --git a/mm/vmscan.c b/mm/vmscan.c > index b3f62cf37097..18731310ca36 100644 > --- a/mm/vmscan.c > +++ b/mm/vmscan.c > @@ -2526,7 +2526,7 @@ static bool shrink_node(pg_data_t *pgdat, struct scan_control *sc) > sc->memcg_low_skipped = 1; > continue; > } > - mem_cgroup_events(memcg, MEMCG_LOW, 1); > + mem_cgroup_event(memcg, MEMCG_LOW); > } > > reclaimed = sc->nr_reclaimed; > -- > 2.12.1 > -- Michal Hocko SUSE Labs
WARNING: multiple messages have this Message-ID (diff)
From: Michal Hocko <mhocko@kernel.org> To: Johannes Weiner <hannes@cmpxchg.org> Cc: Andrew Morton <akpm@linux-foundation.org>, Vladimir Davydov <vdavydov.dev@gmail.com>, linux-mm@kvack.org, cgroups@vger.kernel.org, linux-kernel@vger.kernel.org, kernel-team@fb.com Subject: Re: [PATCH 1/4] mm: memcontrol: clean up memory.events counting function Date: Fri, 7 Apr 2017 14:20:39 +0200 [thread overview] Message-ID: <20170407122038.GD16413@dhcp22.suse.cz> (raw) In-Reply-To: <20170404220148.28338-1-hannes@cmpxchg.org> On Tue 04-04-17 18:01:45, Johannes Weiner wrote: > We only ever count single events, drop the @nr parameter. Rename the > function accordingly. Remove low-information kerneldoc. > > Signed-off-by: Johannes Weiner <hannes@cmpxchg.org> Acked-by: Michal Hocko <mhocko@suse.com> > --- > include/linux/memcontrol.h | 18 +++++------------- > mm/memcontrol.c | 8 ++++---- > mm/vmscan.c | 2 +- > 3 files changed, 10 insertions(+), 18 deletions(-) > > diff --git a/include/linux/memcontrol.h b/include/linux/memcontrol.h > index cfa91a3ca0ca..bc0c16e284c0 100644 > --- a/include/linux/memcontrol.h > +++ b/include/linux/memcontrol.h > @@ -287,17 +287,10 @@ static inline bool mem_cgroup_disabled(void) > return !cgroup_subsys_enabled(memory_cgrp_subsys); > } > > -/** > - * mem_cgroup_events - count memory events against a cgroup > - * @memcg: the memory cgroup > - * @idx: the event index > - * @nr: the number of events to account for > - */ > -static inline void mem_cgroup_events(struct mem_cgroup *memcg, > - enum mem_cgroup_events_index idx, > - unsigned int nr) > +static inline void mem_cgroup_event(struct mem_cgroup *memcg, > + enum mem_cgroup_events_index idx) > { > - this_cpu_add(memcg->stat->events[idx], nr); > + this_cpu_inc(memcg->stat->events[idx]); > cgroup_file_notify(&memcg->events_file); > } > > @@ -614,9 +607,8 @@ static inline bool mem_cgroup_disabled(void) > return true; > } > > -static inline void mem_cgroup_events(struct mem_cgroup *memcg, > - enum mem_cgroup_events_index idx, > - unsigned int nr) > +static inline void mem_cgroup_event(struct mem_cgroup *memcg, > + enum mem_cgroup_events_index idx) > { > } > > diff --git a/mm/memcontrol.c b/mm/memcontrol.c > index 108d5b097db1..1ffa3ad201ea 100644 > --- a/mm/memcontrol.c > +++ b/mm/memcontrol.c > @@ -1825,7 +1825,7 @@ static void reclaim_high(struct mem_cgroup *memcg, > do { > if (page_counter_read(&memcg->memory) <= memcg->high) > continue; > - mem_cgroup_events(memcg, MEMCG_HIGH, 1); > + mem_cgroup_event(memcg, MEMCG_HIGH); > try_to_free_mem_cgroup_pages(memcg, nr_pages, gfp_mask, true); > } while ((memcg = parent_mem_cgroup(memcg))); > } > @@ -1916,7 +1916,7 @@ static int try_charge(struct mem_cgroup *memcg, gfp_t gfp_mask, > if (!gfpflags_allow_blocking(gfp_mask)) > goto nomem; > > - mem_cgroup_events(mem_over_limit, MEMCG_MAX, 1); > + mem_cgroup_event(mem_over_limit, MEMCG_MAX); > > nr_reclaimed = try_to_free_mem_cgroup_pages(mem_over_limit, nr_pages, > gfp_mask, may_swap); > @@ -1959,7 +1959,7 @@ static int try_charge(struct mem_cgroup *memcg, gfp_t gfp_mask, > if (fatal_signal_pending(current)) > goto force; > > - mem_cgroup_events(mem_over_limit, MEMCG_OOM, 1); > + mem_cgroup_event(mem_over_limit, MEMCG_OOM); > > mem_cgroup_oom(mem_over_limit, gfp_mask, > get_order(nr_pages * PAGE_SIZE)); > @@ -5142,7 +5142,7 @@ static ssize_t memory_max_write(struct kernfs_open_file *of, > continue; > } > > - mem_cgroup_events(memcg, MEMCG_OOM, 1); > + mem_cgroup_event(memcg, MEMCG_OOM); > if (!mem_cgroup_out_of_memory(memcg, GFP_KERNEL, 0)) > break; > } > diff --git a/mm/vmscan.c b/mm/vmscan.c > index b3f62cf37097..18731310ca36 100644 > --- a/mm/vmscan.c > +++ b/mm/vmscan.c > @@ -2526,7 +2526,7 @@ static bool shrink_node(pg_data_t *pgdat, struct scan_control *sc) > sc->memcg_low_skipped = 1; > continue; > } > - mem_cgroup_events(memcg, MEMCG_LOW, 1); > + mem_cgroup_event(memcg, MEMCG_LOW); > } > > reclaimed = sc->nr_reclaimed; > -- > 2.12.1 > -- Michal Hocko SUSE Labs -- To unsubscribe, send a message with 'unsubscribe linux-mm' in the body to majordomo@kvack.org. For more info on Linux MM, see: http://www.linux-mm.org/ . Don't email: <a href=mailto:"dont@kvack.org"> email@kvack.org </a>
next prev parent reply other threads:[~2017-04-07 12:20 UTC|newest] Thread overview: 29+ messages / expand[flat|nested] mbox.gz Atom feed top 2017-04-04 22:01 [PATCH 1/4] mm: memcontrol: clean up memory.events counting function Johannes Weiner 2017-04-04 22:01 ` Johannes Weiner 2017-04-04 22:01 ` [PATCH 2/4] mm: memcontrol: re-use global VM event enum Johannes Weiner 2017-04-04 22:01 ` Johannes Weiner 2017-04-06 8:49 ` Vladimir Davydov 2017-04-06 8:49 ` Vladimir Davydov 2017-04-10 14:17 ` Johannes Weiner 2017-04-10 14:17 ` Johannes Weiner 2017-04-07 12:47 ` Michal Hocko 2017-04-07 12:47 ` Michal Hocko 2017-04-10 14:13 ` Johannes Weiner 2017-04-10 14:13 ` Johannes Weiner 2017-04-11 12:30 ` Michal Hocko 2017-04-11 12:30 ` Michal Hocko 2017-04-04 22:01 ` [PATCH 3/4] mm: memcontrol: re-use node VM page state enum Johannes Weiner 2017-04-04 22:01 ` Johannes Weiner 2017-04-06 8:59 ` Vladimir Davydov 2017-04-06 8:59 ` Vladimir Davydov 2017-04-04 22:01 ` [PATCH 4/4] mm: memcontrol: use node page state naming scheme for memcg Johannes Weiner 2017-04-04 22:01 ` Johannes Weiner 2017-04-06 9:01 ` Vladimir Davydov 2017-04-06 9:01 ` Vladimir Davydov 2017-04-07 12:54 ` Michal Hocko 2017-04-07 12:54 ` Michal Hocko 2017-04-07 12:54 ` Michal Hocko 2017-04-06 8:31 ` [PATCH 1/4] mm: memcontrol: clean up memory.events counting function Vladimir Davydov 2017-04-06 8:31 ` Vladimir Davydov 2017-04-07 12:20 ` Michal Hocko [this message] 2017-04-07 12:20 ` Michal Hocko
Reply instructions: You may reply publicly to this message via plain-text email using any one of the following methods: * Save the following mbox file, import it into your mail client, and reply-to-all from there: mbox Avoid top-posting and favor interleaved quoting: https://en.wikipedia.org/wiki/Posting_style#Interleaved_style * Reply using the --to, --cc, and --in-reply-to switches of git-send-email(1): git send-email \ --in-reply-to=20170407122038.GD16413@dhcp22.suse.cz \ --to=mhocko@kernel.org \ --cc=akpm@linux-foundation.org \ --cc=cgroups@vger.kernel.org \ --cc=hannes@cmpxchg.org \ --cc=kernel-team@fb.com \ --cc=linux-kernel@vger.kernel.org \ --cc=linux-mm@kvack.org \ --cc=vdavydov.dev@gmail.com \ /path/to/YOUR_REPLY https://kernel.org/pub/software/scm/git/docs/git-send-email.html * If your mail client supports setting the In-Reply-To header via mailto: links, try the mailto: linkBe sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes, see mirroring instructions on how to clone and mirror all data and code used by this external index.