Commit 31176c78 authored by Johannes Weiner's avatar Johannes Weiner Committed by Linus Torvalds

mm: memcontrol: clean up memory.events counting function

We only ever count single events, drop the @nr parameter.  Rename the
function accordingly.  Remove low-information kerneldoc.

Link: http://lkml.kernel.org/r/20170404220148.28338-1-hannes@cmpxchg.orgSigned-off-by: default avatarJohannes Weiner <hannes@cmpxchg.org>
Acked-by: default avatarVladimir Davydov <vdavydov.dev@gmail.com>
Acked-by: default avatarMichal Hocko <mhocko@suse.com>
Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
parent 2a2e4885
...@@ -287,17 +287,10 @@ static inline bool mem_cgroup_disabled(void) ...@@ -287,17 +287,10 @@ static inline bool mem_cgroup_disabled(void)
return !cgroup_subsys_enabled(memory_cgrp_subsys); return !cgroup_subsys_enabled(memory_cgrp_subsys);
} }
/** static inline void mem_cgroup_event(struct mem_cgroup *memcg,
* mem_cgroup_events - count memory events against a cgroup enum mem_cgroup_events_index idx)
* @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)
{ {
this_cpu_add(memcg->stat->events[idx], nr); this_cpu_inc(memcg->stat->events[idx]);
cgroup_file_notify(&memcg->events_file); cgroup_file_notify(&memcg->events_file);
} }
...@@ -614,9 +607,8 @@ static inline bool mem_cgroup_disabled(void) ...@@ -614,9 +607,8 @@ static inline bool mem_cgroup_disabled(void)
return true; return true;
} }
static inline void mem_cgroup_events(struct mem_cgroup *memcg, static inline void mem_cgroup_event(struct mem_cgroup *memcg,
enum mem_cgroup_events_index idx, enum mem_cgroup_events_index idx)
unsigned int nr)
{ {
} }
......
...@@ -1825,7 +1825,7 @@ static void reclaim_high(struct mem_cgroup *memcg, ...@@ -1825,7 +1825,7 @@ static void reclaim_high(struct mem_cgroup *memcg,
do { do {
if (page_counter_read(&memcg->memory) <= memcg->high) if (page_counter_read(&memcg->memory) <= memcg->high)
continue; 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); try_to_free_mem_cgroup_pages(memcg, nr_pages, gfp_mask, true);
} while ((memcg = parent_mem_cgroup(memcg))); } while ((memcg = parent_mem_cgroup(memcg)));
} }
...@@ -1916,7 +1916,7 @@ static int try_charge(struct mem_cgroup *memcg, gfp_t gfp_mask, ...@@ -1916,7 +1916,7 @@ static int try_charge(struct mem_cgroup *memcg, gfp_t gfp_mask,
if (!gfpflags_allow_blocking(gfp_mask)) if (!gfpflags_allow_blocking(gfp_mask))
goto nomem; 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, nr_reclaimed = try_to_free_mem_cgroup_pages(mem_over_limit, nr_pages,
gfp_mask, may_swap); gfp_mask, may_swap);
...@@ -1959,7 +1959,7 @@ static int try_charge(struct mem_cgroup *memcg, gfp_t gfp_mask, ...@@ -1959,7 +1959,7 @@ static int try_charge(struct mem_cgroup *memcg, gfp_t gfp_mask,
if (fatal_signal_pending(current)) if (fatal_signal_pending(current))
goto force; 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, mem_cgroup_oom(mem_over_limit, gfp_mask,
get_order(nr_pages * PAGE_SIZE)); get_order(nr_pages * PAGE_SIZE));
...@@ -5142,7 +5142,7 @@ static ssize_t memory_max_write(struct kernfs_open_file *of, ...@@ -5142,7 +5142,7 @@ static ssize_t memory_max_write(struct kernfs_open_file *of,
continue; continue;
} }
mem_cgroup_events(memcg, MEMCG_OOM, 1); mem_cgroup_event(memcg, MEMCG_OOM);
if (!mem_cgroup_out_of_memory(memcg, GFP_KERNEL, 0)) if (!mem_cgroup_out_of_memory(memcg, GFP_KERNEL, 0))
break; break;
} }
......
...@@ -2526,7 +2526,7 @@ static bool shrink_node(pg_data_t *pgdat, struct scan_control *sc) ...@@ -2526,7 +2526,7 @@ static bool shrink_node(pg_data_t *pgdat, struct scan_control *sc)
sc->memcg_low_skipped = 1; sc->memcg_low_skipped = 1;
continue; continue;
} }
mem_cgroup_events(memcg, MEMCG_LOW, 1); mem_cgroup_event(memcg, MEMCG_LOW);
} }
reclaimed = sc->nr_reclaimed; reclaimed = sc->nr_reclaimed;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment