Commit 85cfb245 authored by Shakeel Butt's avatar Shakeel Butt Committed by Linus Torvalds

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.comSigned-off-by: default avatarShakeel Butt <shakeelb@google.com>
Acked-by: default avatarJohannes 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: default avatarAndrew Morton <akpm@linux-foundation.org>
Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
parent 86b27bea
...@@ -724,9 +724,6 @@ struct task_struct { ...@@ -724,9 +724,6 @@ struct task_struct {
#endif #endif
#ifdef CONFIG_MEMCG #ifdef CONFIG_MEMCG
unsigned in_user_fault:1; unsigned in_user_fault:1;
#ifdef CONFIG_MEMCG_KMEM
unsigned memcg_kmem_skip_account:1;
#endif
#endif #endif
#ifdef CONFIG_COMPAT_BRK #ifdef CONFIG_COMPAT_BRK
unsigned brk_randomized:1; unsigned brk_randomized:1;
......
...@@ -2460,7 +2460,7 @@ static void memcg_kmem_cache_create_func(struct work_struct *w) ...@@ -2460,7 +2460,7 @@ static void memcg_kmem_cache_create_func(struct work_struct *w)
/* /*
* Enqueue the creation of a per-memcg kmem_cache. * Enqueue the creation of a per-memcg kmem_cache.
*/ */
static void __memcg_schedule_kmem_cache_create(struct mem_cgroup *memcg, static void memcg_schedule_kmem_cache_create(struct mem_cgroup *memcg,
struct kmem_cache *cachep) struct kmem_cache *cachep)
{ {
struct memcg_kmem_cache_create_work *cw; struct memcg_kmem_cache_create_work *cw;
...@@ -2478,25 +2478,6 @@ static void __memcg_schedule_kmem_cache_create(struct mem_cgroup *memcg, ...@@ -2478,25 +2478,6 @@ static void __memcg_schedule_kmem_cache_create(struct mem_cgroup *memcg,
queue_work(memcg_kmem_cache_wq, &cw->work); queue_work(memcg_kmem_cache_wq, &cw->work);
} }
static void memcg_schedule_kmem_cache_create(struct mem_cgroup *memcg,
struct kmem_cache *cachep)
{
/*
* We need to stop accounting when we kmalloc, because if the
* corresponding kmalloc cache is not yet created, the first allocation
* in __memcg_schedule_kmem_cache_create will recurse.
*
* However, it is better to enclose the whole function. Depending on
* the debugging options enabled, INIT_WORK(), for instance, can
* trigger an allocation. This too, will make us recurse. Because at
* this point we can't allow ourselves back into memcg_kmem_get_cache,
* the safest choice is to do it like this, wrapping the whole function.
*/
current->memcg_kmem_skip_account = 1;
__memcg_schedule_kmem_cache_create(memcg, cachep);
current->memcg_kmem_skip_account = 0;
}
static inline bool memcg_kmem_bypass(void) static inline bool memcg_kmem_bypass(void)
{ {
if (in_interrupt() || !current->mm || (current->flags & PF_KTHREAD)) if (in_interrupt() || !current->mm || (current->flags & PF_KTHREAD))
...@@ -2531,9 +2512,6 @@ struct kmem_cache *memcg_kmem_get_cache(struct kmem_cache *cachep) ...@@ -2531,9 +2512,6 @@ struct kmem_cache *memcg_kmem_get_cache(struct kmem_cache *cachep)
if (memcg_kmem_bypass()) if (memcg_kmem_bypass())
return cachep; return cachep;
if (current->memcg_kmem_skip_account)
return cachep;
memcg = get_mem_cgroup_from_current(); memcg = get_mem_cgroup_from_current();
kmemcg_id = READ_ONCE(memcg->kmemcg_id); kmemcg_id = READ_ONCE(memcg->kmemcg_id);
if (kmemcg_id < 0) if (kmemcg_id < 0)
......
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