mm: memcontrol: account slab stats per lruvec

Josef's redesign of the balancing between slab caches and the page cache
requires slab cache statistics at the lruvec level.

Link: http://lkml.kernel.org/r/[email protected]
Signed-off-by: Johannes Weiner <[email protected]>
Acked-by: Vladimir Davydov <[email protected]>
Cc: Josef Bacik <[email protected]>
Cc: Michal Hocko <[email protected]>
Cc: Rik van Riel <[email protected]>
Signed-off-by: Andrew Morton <[email protected]>
Signed-off-by: Linus Torvalds <[email protected]>
This commit is contained in:
Johannes Weiner 2017-07-06 15:40:55 -07:00 • committed by Linus Torvalds
commit 7779f21236
3 changed files with 7 additions and 27 deletions

View file

@ -1425,11 +1425,9 @@ static struct page *kmem_getpages(struct kmem_cache *cachep, gfp_t flags,
nr_pages = (1 << cachep->gfporder);
if (cachep->flags & SLAB_RECLAIM_ACCOUNT)
add_node_page_state(page_pgdat(page),
NR_SLAB_RECLAIMABLE, nr_pages);
mod_lruvec_page_state(page, NR_SLAB_RECLAIMABLE, nr_pages);
else
add_node_page_state(page_pgdat(page),
NR_SLAB_UNRECLAIMABLE, nr_pages);
mod_lruvec_page_state(page, NR_SLAB_UNRECLAIMABLE, nr_pages);
__SetPageSlab(page);
/* Record if ALLOC_NO_WATERMARKS was set when allocating the slab */
@ -1459,11 +1457,9 @@ static void kmem_freepages(struct kmem_cache *cachep, struct page *page)
kmemcheck_free_shadow(page, order);
if (cachep->flags & SLAB_RECLAIM_ACCOUNT)
sub_node_page_state(page_pgdat(page),
NR_SLAB_RECLAIMABLE, nr_freed);
mod_lruvec_page_state(page, NR_SLAB_RECLAIMABLE, -nr_freed);
else
sub_node_page_state(page_pgdat(page),
NR_SLAB_UNRECLAIMABLE, nr_freed);
mod_lruvec_page_state(page, NR_SLAB_UNRECLAIMABLE, -nr_freed);
BUG_ON(!PageSlab(page));
__ClearPageSlabPfmemalloc(page);