diff options
author | Johannes Weiner <hannes@cmpxchg.org> | 2014-12-10 18:42:50 -0500 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2014-12-10 20:41:05 -0500 |
commit | 6d3d6aa22af30580cde0d2e23890027bb47a3544 (patch) | |
tree | 12d6e488b3b1c364922a21ef9f4f92e3cdbac8a3 /mm/memcontrol.c | |
parent | b2052564e66da2f0551d34a09488411919cfa14d (diff) |
mm: memcontrol: remove synchronous stock draining code
With charge reparenting, the last synchronous stock drainer left.
Signed-off-by: Johannes Weiner <hannes@cmpxchg.org>
Reviewed-by: Vladimir Davydov <vdavydov@parallels.com>
Acked-by: Michal Hocko <mhocko@suse.cz>
Cc: David Rientjes <rientjes@google.com>
Cc: Tejun Heo <tj@kernel.org>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'mm/memcontrol.c')
-rw-r--r-- | mm/memcontrol.c | 46 |
1 files changed, 6 insertions, 40 deletions
diff --git a/mm/memcontrol.c b/mm/memcontrol.c index f90e43c1499f..3a628435f36a 100644 --- a/mm/memcontrol.c +++ b/mm/memcontrol.c | |||
@@ -634,8 +634,6 @@ static void disarm_static_keys(struct mem_cgroup *memcg) | |||
634 | disarm_kmem_keys(memcg); | 634 | disarm_kmem_keys(memcg); |
635 | } | 635 | } |
636 | 636 | ||
637 | static void drain_all_stock_async(struct mem_cgroup *memcg); | ||
638 | |||
639 | static struct mem_cgroup_per_zone * | 637 | static struct mem_cgroup_per_zone * |
640 | mem_cgroup_zone_zoneinfo(struct mem_cgroup *memcg, struct zone *zone) | 638 | mem_cgroup_zone_zoneinfo(struct mem_cgroup *memcg, struct zone *zone) |
641 | { | 639 | { |
@@ -2302,13 +2300,15 @@ static void refill_stock(struct mem_cgroup *memcg, unsigned int nr_pages) | |||
2302 | 2300 | ||
2303 | /* | 2301 | /* |
2304 | * Drains all per-CPU charge caches for given root_memcg resp. subtree | 2302 | * Drains all per-CPU charge caches for given root_memcg resp. subtree |
2305 | * of the hierarchy under it. sync flag says whether we should block | 2303 | * of the hierarchy under it. |
2306 | * until the work is done. | ||
2307 | */ | 2304 | */ |
2308 | static void drain_all_stock(struct mem_cgroup *root_memcg, bool sync) | 2305 | static void drain_all_stock(struct mem_cgroup *root_memcg) |
2309 | { | 2306 | { |
2310 | int cpu, curcpu; | 2307 | int cpu, curcpu; |
2311 | 2308 | ||
2309 | /* If someone's already draining, avoid adding running more workers. */ | ||
2310 | if (!mutex_trylock(&percpu_charge_mutex)) | ||
2311 | return; | ||
2312 | /* Notify other cpus that system-wide "drain" is running */ | 2312 | /* Notify other cpus that system-wide "drain" is running */ |
2313 | get_online_cpus(); | 2313 | get_online_cpus(); |
2314 | curcpu = get_cpu(); | 2314 | curcpu = get_cpu(); |
@@ -2329,41 +2329,7 @@ static void drain_all_stock(struct mem_cgroup *root_memcg, bool sync) | |||
2329 | } | 2329 | } |
2330 | } | 2330 | } |
2331 | put_cpu(); | 2331 | put_cpu(); |
2332 | |||
2333 | if (!sync) | ||
2334 | goto out; | ||
2335 | |||
2336 | for_each_online_cpu(cpu) { | ||
2337 | struct memcg_stock_pcp *stock = &per_cpu(memcg_stock, cpu); | ||
2338 | if (test_bit(FLUSHING_CACHED_CHARGE, &stock->flags)) | ||
2339 | flush_work(&stock->work); | ||
2340 | } | ||
2341 | out: | ||
2342 | put_online_cpus(); | 2332 | put_online_cpus(); |
2343 | } | ||
2344 | |||
2345 | /* | ||
2346 | * Tries to drain stocked charges in other cpus. This function is asynchronous | ||
2347 | * and just put a work per cpu for draining localy on each cpu. Caller can | ||
2348 | * expects some charges will be back later but cannot wait for it. | ||
2349 | */ | ||
2350 | static void drain_all_stock_async(struct mem_cgroup *root_memcg) | ||
2351 | { | ||
2352 | /* | ||
2353 | * If someone calls draining, avoid adding more kworker runs. | ||
2354 | */ | ||
2355 | if (!mutex_trylock(&percpu_charge_mutex)) | ||
2356 | return; | ||
2357 | drain_all_stock(root_memcg, false); | ||
2358 | mutex_unlock(&percpu_charge_mutex); | ||
2359 | } | ||
2360 | |||
2361 | /* This is a synchronous drain interface. */ | ||
2362 | static void drain_all_stock_sync(struct mem_cgroup *root_memcg) | ||
2363 | { | ||
2364 | /* called when force_empty is called */ | ||
2365 | mutex_lock(&percpu_charge_mutex); | ||
2366 | drain_all_stock(root_memcg, true); | ||
2367 | mutex_unlock(&percpu_charge_mutex); | 2333 | mutex_unlock(&percpu_charge_mutex); |
2368 | } | 2334 | } |
2369 | 2335 | ||
@@ -2472,7 +2438,7 @@ retry: | |||
2472 | goto retry; | 2438 | goto retry; |
2473 | 2439 | ||
2474 | if (!drained) { | 2440 | if (!drained) { |
2475 | drain_all_stock_async(mem_over_limit); | 2441 | drain_all_stock(mem_over_limit); |
2476 | drained = true; | 2442 | drained = true; |
2477 | goto retry; | 2443 | goto retry; |
2478 | } | 2444 | } |