linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 1/2] mm: slub: call account_slab_page() after slab page initialization
@ 2020-11-10 19:57 Roman Gushchin
  2020-11-10 19:57 ` [PATCH 2/2] mm: memcg/slab: pre-allocate obj_cgroups for slab caches with SLAB_ACCOUNT Roman Gushchin
                   ` (2 more replies)
  0 siblings, 3 replies; 13+ messages in thread
From: Roman Gushchin @ 2020-11-10 19:57 UTC (permalink / raw)
  To: Andrew Morton, linux-mm
  Cc: Shakeel Butt, Johannes Weiner, Michal Hocko, Christoph Lameter,
	linux-kernel, kernel-team, Roman Gushchin

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.

Signed-off-by: Roman Gushchin <guro@fb.com>
---
 mm/slub.c | 5 ++---
 1 file changed, 2 insertions(+), 3 deletions(-)

diff --git a/mm/slub.c b/mm/slub.c
index 8c9fa24ebbf3..ccdbb62e025d 100644
--- a/mm/slub.c
+++ b/mm/slub.c
@@ -1622,9 +1622,6 @@ static inline struct page *alloc_slab_page(struct kmem_cache *s,
 	else
 		page = __alloc_pages_node(node, flags, order);
 
-	if (page)
-		account_slab_page(page, order, s);
-
 	return page;
 }
 
@@ -1777,6 +1774,8 @@ static struct page *allocate_slab(struct kmem_cache *s, gfp_t flags, int node)
 
 	page->objects = oo_objects(oo);
 
+	account_slab_page(page, oo_order(oo), s, flags);
+
 	page->slab_cache = s;
 	__SetPageSlab(page);
 	if (page_is_pfmemalloc(page))
-- 
2.26.2


^ permalink raw reply related	[flat|nested] 13+ messages in thread

end of thread, other threads:[~2020-11-17 20:16 UTC | newest]

Thread overview: 13+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-11-10 19:57 [PATCH 1/2] mm: slub: call account_slab_page() after slab page initialization Roman Gushchin
2020-11-10 19:57 ` [PATCH 2/2] mm: memcg/slab: pre-allocate obj_cgroups for slab caches with SLAB_ACCOUNT Roman Gushchin
2020-11-10 20:50   ` Andrew Morton
2020-11-10 21:51     ` Roman Gushchin
2020-11-12 16:23   ` Johannes Weiner
2020-11-13  0:19     ` Roman Gushchin
2020-11-13  1:12       ` Andrew Morton
2020-11-13  1:46         ` Roman Gushchin
2020-11-16 15:03         ` Johannes Weiner
2020-11-17 17:42       ` Shakeel Butt
2020-11-17 20:15         ` Roman Gushchin
2020-11-12 15:18 ` [PATCH 1/2] mm: slub: call account_slab_page() after slab page initialization Johannes Weiner
2020-11-17 17:16 ` Shakeel Butt

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).