Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

memcg: remove memcg_kmem_skip_account

The flag memcg_kmem_skip_account was added during the era of opt-out kmem
accounting. There is no need for such flag in the opt-in world as there
aren't any __GFP_ACCOUNT allocations within memcg_create_cache_enqueue().

Link: http://lkml.kernel.org/r/20180919004501.178023-1-shakeelb@google.com
Signed-off-by: Shakeel Butt <shakeelb@google.com>
Acked-by: Johannes Weiner <hannes@cmpxchg.org>
Cc: Michal Hocko <mhocko@kernel.org>
Cc: Vladimir Davydov <vdavydov.dev@gmail.com>
Cc: Greg Thelen <gthelen@google.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>

authored by

Shakeel Butt and committed by
Linus Torvalds
85cfb245 86b27bea

+1 -26
-3
include/linux/sched.h
··· 724 724 #endif 725 725 #ifdef CONFIG_MEMCG 726 726 unsigned in_user_fault:1; 727 - #ifdef CONFIG_MEMCG_KMEM 728 - unsigned memcg_kmem_skip_account:1; 729 - #endif 730 727 #endif 731 728 #ifdef CONFIG_COMPAT_BRK 732 729 unsigned brk_randomized:1;
+1 -23
mm/memcontrol.c
··· 2460 2460 /* 2461 2461 * Enqueue the creation of a per-memcg kmem_cache. 2462 2462 */ 2463 - static void __memcg_schedule_kmem_cache_create(struct mem_cgroup *memcg, 2463 + static void memcg_schedule_kmem_cache_create(struct mem_cgroup *memcg, 2464 2464 struct kmem_cache *cachep) 2465 2465 { 2466 2466 struct memcg_kmem_cache_create_work *cw; ··· 2476 2476 INIT_WORK(&cw->work, memcg_kmem_cache_create_func); 2477 2477 2478 2478 queue_work(memcg_kmem_cache_wq, &cw->work); 2479 - } 2480 - 2481 - static void memcg_schedule_kmem_cache_create(struct mem_cgroup *memcg, 2482 - struct kmem_cache *cachep) 2483 - { 2484 - /* 2485 - * We need to stop accounting when we kmalloc, because if the 2486 - * corresponding kmalloc cache is not yet created, the first allocation 2487 - * in __memcg_schedule_kmem_cache_create will recurse. 2488 - * 2489 - * However, it is better to enclose the whole function. Depending on 2490 - * the debugging options enabled, INIT_WORK(), for instance, can 2491 - * trigger an allocation. This too, will make us recurse. Because at 2492 - * this point we can't allow ourselves back into memcg_kmem_get_cache, 2493 - * the safest choice is to do it like this, wrapping the whole function. 2494 - */ 2495 - current->memcg_kmem_skip_account = 1; 2496 - __memcg_schedule_kmem_cache_create(memcg, cachep); 2497 - current->memcg_kmem_skip_account = 0; 2498 2479 } 2499 2480 2500 2481 static inline bool memcg_kmem_bypass(void) ··· 2510 2529 VM_BUG_ON(!is_root_cache(cachep)); 2511 2530 2512 2531 if (memcg_kmem_bypass()) 2513 - return cachep; 2514 - 2515 - if (current->memcg_kmem_skip_account) 2516 2532 return cachep; 2517 2533 2518 2534 memcg = get_mem_cgroup_from_current();