Skip to content

Commit

Permalink
mm: slab: rename (un)charge_slab_page() to (un)account_slab_page()
Browse files Browse the repository at this point in the history
charge_slab_page() and uncharge_slab_page() are not related anymore to
memcg charging and uncharging.  In order to make their names less
confusing, let's rename them to account_slab_page() and
unaccount_slab_page() respectively.

Signed-off-by: Roman Gushchin <[email protected]>
Signed-off-by: Andrew Morton <[email protected]>
Reviewed-by: Shakeel Butt <[email protected]>
Acked-by: Vlastimil Babka <[email protected]>
Cc: Christoph Lameter <[email protected]>
Cc: David Rientjes <[email protected]>
Cc: Johannes Weiner <[email protected]>
Cc: Joonsoo Kim <[email protected]>
Cc: Michal Hocko <[email protected]>
Cc: Pekka Enberg <[email protected]>
Link: http://lkml.kernel.org/r/[email protected]
Signed-off-by: Linus Torvalds <[email protected]>
  • Loading branch information
rgushchin authored and torvalds committed Aug 7, 2020
1 parent 8495048 commit 74d555b
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 8 deletions.
4 changes: 2 additions & 2 deletions mm/slab.c
Original file line number Diff line number Diff line change
Expand Up @@ -1379,7 +1379,7 @@ static struct page *kmem_getpages(struct kmem_cache *cachep, gfp_t flags,
return NULL;
}

charge_slab_page(page, cachep->gfporder, cachep);
account_slab_page(page, cachep->gfporder, cachep);
__SetPageSlab(page);
/* Record if ALLOC_NO_WATERMARKS was set when allocating the slab */
if (sk_memalloc_socks() && page_is_pfmemalloc(page))
Expand All @@ -1403,7 +1403,7 @@ static void kmem_freepages(struct kmem_cache *cachep, struct page *page)

if (current->reclaim_state)
current->reclaim_state->reclaimed_slab += 1 << order;
uncharge_slab_page(page, order, cachep);
unaccount_slab_page(page, order, cachep);
__free_pages(page, order);
}

Expand Down
8 changes: 4 additions & 4 deletions mm/slab.h
Original file line number Diff line number Diff line change
Expand Up @@ -423,15 +423,15 @@ static inline struct kmem_cache *virt_to_cache(const void *obj)
return page->slab_cache;
}

static __always_inline void charge_slab_page(struct page *page, int order,
struct kmem_cache *s)
static __always_inline void account_slab_page(struct page *page, int order,
struct kmem_cache *s)
{
mod_node_page_state(page_pgdat(page), cache_vmstat_idx(s),
PAGE_SIZE << order);
}

static __always_inline void uncharge_slab_page(struct page *page, int order,
struct kmem_cache *s)
static __always_inline void unaccount_slab_page(struct page *page, int order,
struct kmem_cache *s)
{
if (memcg_kmem_enabled())
memcg_free_page_obj_cgroups(page);
Expand Down
4 changes: 2 additions & 2 deletions mm/slub.c
Original file line number Diff line number Diff line change
Expand Up @@ -1621,7 +1621,7 @@ static inline struct page *alloc_slab_page(struct kmem_cache *s,
page = __alloc_pages_node(node, flags, order);

if (page)
charge_slab_page(page, order, s);
account_slab_page(page, order, s);

return page;
}
Expand Down Expand Up @@ -1844,7 +1844,7 @@ static void __free_slab(struct kmem_cache *s, struct page *page)
page->mapping = NULL;
if (current->reclaim_state)
current->reclaim_state->reclaimed_slab += pages;
uncharge_slab_page(page, order, s);
unaccount_slab_page(page, order, s);
__free_pages(page, order);
}

Expand Down

0 comments on commit 74d555b

Please sign in to comment.