Skip to content

Commit 85cfb24

Browse files
shakeelbtorvalds
authored andcommitted
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>
1 parent 86b27be commit 85cfb24

2 files changed

Lines changed: 1 addition & 26 deletions

File tree

‎include/linux/sched.h‎

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -724,9 +724,6 @@ struct task_struct {
724724
#endif
725725
#ifdef CONFIG_MEMCG
726726
unsigned in_user_fault:1;
727-
#ifdef CONFIG_MEMCG_KMEM
728-
unsigned memcg_kmem_skip_account:1;
729-
#endif
730727
#endif
731728
#ifdef CONFIG_COMPAT_BRK
732729
unsigned brk_randomized:1;

‎mm/memcontrol.c‎

Lines changed: 1 addition & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -2460,7 +2460,7 @@ static void memcg_kmem_cache_create_func(struct work_struct *w)
24602460
/*
24612461
* Enqueue the creation of a per-memcg kmem_cache.
24622462
*/
2463-
static void __memcg_schedule_kmem_cache_create(struct mem_cgroup *memcg,
2463+
static void memcg_schedule_kmem_cache_create(struct mem_cgroup *memcg,
24642464
struct kmem_cache *cachep)
24652465
{
24662466
struct memcg_kmem_cache_create_work *cw;
@@ -2478,25 +2478,6 @@ static void __memcg_schedule_kmem_cache_create(struct mem_cgroup *memcg,
24782478
queue_work(memcg_kmem_cache_wq, &cw->work);
24792479
}
24802480

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-
}
2499-
25002481
static inline bool memcg_kmem_bypass(void)
25012482
{
25022483
if (in_interrupt() || !current->mm || (current->flags & PF_KTHREAD))
@@ -2531,9 +2512,6 @@ struct kmem_cache *memcg_kmem_get_cache(struct kmem_cache *cachep)
25312512
if (memcg_kmem_bypass())
25322513
return cachep;
25332514

2534-
if (current->memcg_kmem_skip_account)
2535-
return cachep;
2536-
25372515
memcg = get_mem_cgroup_from_current();
25382516
kmemcg_id = READ_ONCE(memcg->kmemcg_id);
25392517
if (kmemcg_id < 0)

0 commit comments

Comments
 (0)