mm: memcontrol: use generic mod_memcg_page_state for kmem pages
The kmem-specific functions do the same thing. Switch and drop. Link: http://lkml.kernel.org/r/20170530181724.27197-5-hannes@cmpxchg.org Signed-off-by: Johannes Weiner <hannes@cmpxchg.org> Acked-by: Vladimir Davydov <vdavydov.dev@gmail.com> Cc: Josef Bacik <josef@toxicpanda.com> Cc: Michal Hocko <mhocko@suse.com> Cc: Rik van Riel <riel@redhat.com> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
This commit is contained in:
committed by
Linus Torvalds
parent
320492961c
commit
ed52be7bfd
@@ -929,19 +929,6 @@ static inline int memcg_cache_id(struct mem_cgroup *memcg)
|
|||||||
return memcg ? memcg->kmemcg_id : -1;
|
return memcg ? memcg->kmemcg_id : -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* memcg_kmem_update_page_stat - update kmem page state statistics
|
|
||||||
* @page: the page
|
|
||||||
* @idx: page state item to account
|
|
||||||
* @val: number of pages (positive or negative)
|
|
||||||
*/
|
|
||||||
static inline void memcg_kmem_update_page_stat(struct page *page,
|
|
||||||
enum memcg_stat_item idx, int val)
|
|
||||||
{
|
|
||||||
if (memcg_kmem_enabled() && page->mem_cgroup)
|
|
||||||
this_cpu_add(page->mem_cgroup->stat->count[idx], val);
|
|
||||||
}
|
|
||||||
|
|
||||||
#else
|
#else
|
||||||
#define for_each_memcg_cache_index(_idx) \
|
#define for_each_memcg_cache_index(_idx) \
|
||||||
for (; NULL; )
|
for (; NULL; )
|
||||||
@@ -964,10 +951,6 @@ static inline void memcg_put_cache_ids(void)
|
|||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
static inline void memcg_kmem_update_page_stat(struct page *page,
|
|
||||||
enum memcg_stat_item idx, int val)
|
|
||||||
{
|
|
||||||
}
|
|
||||||
#endif /* CONFIG_MEMCG && !CONFIG_SLOB */
|
#endif /* CONFIG_MEMCG && !CONFIG_SLOB */
|
||||||
|
|
||||||
#endif /* _LINUX_MEMCONTROL_H */
|
#endif /* _LINUX_MEMCONTROL_H */
|
||||||
|
|||||||
@@ -326,7 +326,7 @@ static void account_kernel_stack(struct task_struct *tsk, int account)
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* All stack pages belong to the same memcg. */
|
/* All stack pages belong to the same memcg. */
|
||||||
memcg_kmem_update_page_stat(vm->pages[0], MEMCG_KERNEL_STACK_KB,
|
mod_memcg_page_state(vm->pages[0], MEMCG_KERNEL_STACK_KB,
|
||||||
account * (THREAD_SIZE / 1024));
|
account * (THREAD_SIZE / 1024));
|
||||||
} else {
|
} else {
|
||||||
/*
|
/*
|
||||||
@@ -338,7 +338,7 @@ static void account_kernel_stack(struct task_struct *tsk, int account)
|
|||||||
mod_zone_page_state(page_zone(first_page), NR_KERNEL_STACK_KB,
|
mod_zone_page_state(page_zone(first_page), NR_KERNEL_STACK_KB,
|
||||||
THREAD_SIZE / 1024 * account);
|
THREAD_SIZE / 1024 * account);
|
||||||
|
|
||||||
memcg_kmem_update_page_stat(first_page, MEMCG_KERNEL_STACK_KB,
|
mod_memcg_page_state(first_page, MEMCG_KERNEL_STACK_KB,
|
||||||
account * (THREAD_SIZE / 1024));
|
account * (THREAD_SIZE / 1024));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -285,7 +285,7 @@ static __always_inline int memcg_charge_slab(struct page *page,
|
|||||||
if (ret)
|
if (ret)
|
||||||
return ret;
|
return ret;
|
||||||
|
|
||||||
memcg_kmem_update_page_stat(page,
|
mod_memcg_page_state(page,
|
||||||
(s->flags & SLAB_RECLAIM_ACCOUNT) ?
|
(s->flags & SLAB_RECLAIM_ACCOUNT) ?
|
||||||
NR_SLAB_RECLAIMABLE : NR_SLAB_UNRECLAIMABLE,
|
NR_SLAB_RECLAIMABLE : NR_SLAB_UNRECLAIMABLE,
|
||||||
1 << order);
|
1 << order);
|
||||||
@@ -298,7 +298,7 @@ static __always_inline void memcg_uncharge_slab(struct page *page, int order,
|
|||||||
if (!memcg_kmem_enabled())
|
if (!memcg_kmem_enabled())
|
||||||
return;
|
return;
|
||||||
|
|
||||||
memcg_kmem_update_page_stat(page,
|
mod_memcg_page_state(page,
|
||||||
(s->flags & SLAB_RECLAIM_ACCOUNT) ?
|
(s->flags & SLAB_RECLAIM_ACCOUNT) ?
|
||||||
NR_SLAB_RECLAIMABLE : NR_SLAB_UNRECLAIMABLE,
|
NR_SLAB_RECLAIMABLE : NR_SLAB_UNRECLAIMABLE,
|
||||||
-(1 << order));
|
-(1 << order));
|
||||||
|
|||||||
Reference in New Issue
Block a user