Skip to content

Commit 1f3147b

Browse files
rgushchintorvalds
authored andcommitted
mm: slub: call account_slab_page() after slab page initialization
It's convenient to have page->objects initialized before calling into account_slab_page(). In particular, this information can be used to pre-alloc the obj_cgroup vector. Let's call account_slab_page() a bit later, after the initialization of page->objects. This commit doesn't bring any functional change, but is required for further optimizations. [[email protected]: undo changes needed by forthcoming mm-memcg-slab-pre-allocate-obj_cgroups-for-slab-caches-with-slab_account.patch] Link: https://lkml.kernel.org/r/[email protected] Signed-off-by: Roman Gushchin <[email protected]> Acked-by: Johannes Weiner <[email protected]> Reviewed-by: Shakeel Butt <[email protected]> Cc: Michal Hocko <[email protected]> Cc: Christoph Lameter <[email protected]> Signed-off-by: Andrew Morton <[email protected]> Signed-off-by: Linus Torvalds <[email protected]>
1 parent 605cc30 commit 1f3147b

File tree

1 file changed

+2
-3
lines changed

1 file changed

+2
-3
lines changed

mm/slub.c

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1619,9 +1619,6 @@ static inline struct page *alloc_slab_page(struct kmem_cache *s,
16191619
else
16201620
page = __alloc_pages_node(node, flags, order);
16211621

1622-
if (page)
1623-
account_slab_page(page, order, s);
1624-
16251622
return page;
16261623
}
16271624

@@ -1774,6 +1771,8 @@ static struct page *allocate_slab(struct kmem_cache *s, gfp_t flags, int node)
17741771

17751772
page->objects = oo_objects(oo);
17761773

1774+
account_slab_page(page, oo_order(oo), s);
1775+
17771776
page->slab_cache = s;
17781777
__SetPageSlab(page);
17791778
if (page_is_pfmemalloc(page))

0 commit comments

Comments
 (0)