From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-15.8 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER, INCLUDES_PATCH,MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id C9105C433E6 for ; Tue, 29 Dec 2020 23:15:10 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id 86DA121D94 for ; Tue, 29 Dec 2020 23:15:10 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 86DA121D94 Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=linux-foundation.org Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=owner-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix) id 276EC8D007E; Tue, 29 Dec 2020 18:15:10 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id 249EF8D006A; Tue, 29 Dec 2020 18:15:10 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 161878D007E; Tue, 29 Dec 2020 18:15:10 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0118.hostedemail.com [216.40.44.118]) by kanga.kvack.org (Postfix) with ESMTP id EF09D8D006A for ; Tue, 29 Dec 2020 18:15:09 -0500 (EST) Received: from smtpin15.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay05.hostedemail.com (Postfix) with ESMTP id B8774181AEF07 for ; Tue, 29 Dec 2020 23:15:09 +0000 (UTC) X-FDA: 77647877538.15.trade22_291153f274a0 Received: from filter.hostedemail.com (10.5.16.251.rfc1918.com [10.5.16.251]) by smtpin15.hostedemail.com (Postfix) with ESMTP id 8344F1814B0C1 for ; Tue, 29 Dec 2020 23:15:09 +0000 (UTC) X-HE-Tag: trade22_291153f274a0 X-Filterd-Recvd-Size: 2816 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by imf06.hostedemail.com (Postfix) with ESMTP for ; Tue, 29 Dec 2020 23:15:09 +0000 (UTC) Received: by mail.kernel.org (Postfix) with ESMTPSA id 08E4C22209; Tue, 29 Dec 2020 23:15:08 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linux-foundation.org; s=korg; t=1609283708; bh=o9L4INN7jM+h/jWMta1csQDzdwUzM0efDVa+ZoGj9R8=; h=Date:From:To:Subject:In-Reply-To:From; b=RYAP45Fogb9iFA2he4PZRNFYHqoNVobEZo0lSpSt27ZfvooLO9evDiK/aJzZf25tV /BNIxiCJ0WAS2B1ESBVIyCvwJVk/0dmR60YplHivzZXOykY4BRERv23h8v/Ne9pt/t cVguk5vs/QhIaZawrymSnKBV1hWV93Nv6D4hIEO0= Date: Tue, 29 Dec 2020 15:15:07 -0800 From: Andrew Morton To: akpm@linux-foundation.org, cl@linux.com, guro@fb.com, hannes@cmpxchg.org, linux-mm@kvack.org, mhocko@kernel.org, mm-commits@vger.kernel.org, shakeelb@google.com, torvalds@linux-foundation.org Subject: [patch 16/16] mm: slub: call account_slab_page() after slab page initialization Message-ID: <20201229231507.0MS9eCjiX%akpm@linux-foundation.org> In-Reply-To: <20201229151349.3285926ec0d1f65a27ac8534@linux-foundation.org> User-Agent: s-nail v14.8.16 X-Bogosity: Ham, tests=bogofilter, spamicity=0.000000, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: From: Roman Gushchin Subject: 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. [akpm@linux-foundation.org: 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/20201110195753.530157-1-guro@fb.com Signed-off-by: Roman Gushchin Acked-by: Johannes Weiner Reviewed-by: Shakeel Butt Cc: Michal Hocko Cc: Christoph Lameter Signed-off-by: Andrew Morton --- mm/slub.c | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) --- a/mm/slub.c~mm-slub-call-account_slab_page-after-slab-page-initialization +++ a/mm/slub.c @@ -1619,9 +1619,6 @@ static inline struct page *alloc_slab_pa else page = __alloc_pages_node(node, flags, order); - if (page) - account_slab_page(page, order, s); - return page; } @@ -1774,6 +1771,8 @@ static struct page *allocate_slab(struct page->objects = oo_objects(oo); + account_slab_page(page, oo_order(oo), s); + page->slab_cache = s; __SetPageSlab(page); if (page_is_pfmemalloc(page)) _