Received: by 2002:a05:6a10:16a7:0:0:0:0 with SMTP id gp39csp4269079pxb; Tue, 10 Nov 2020 12:00:30 -0800 (PST) X-Google-Smtp-Source: ABdhPJzDWBN2GmjfYQDRGAaFW7hHH8eurXovPC8JrbNfNluiiRSjmUUQj8fABuO62aK8rl0qmo/l X-Received: by 2002:a17:906:22c7:: with SMTP id q7mr22596125eja.291.1605038429380; Tue, 10 Nov 2020 12:00:29 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1605038429; cv=none; d=google.com; s=arc-20160816; b=ProZNt9Qa/1e4UYWSTsSc5Z/a0+kgECbKW0Fl4bBdhG2/NtTeBF78H9biAlOnYydoh 8vIX85CeDVl1cc0U+ypX3pRhQiQQ4SnnN6S+CCvVJHDcXcC/YhcAp/tVg8Rxon03jaM1 i6UYme5sPyweKs0TOzl/VaMQJMDakODF3v8ep0mgbkVf+361aNpT1UTD3XXh8BZMnl2u RhWyn14VakCHoCHeZvBhgM2MoelISejczuekj8avrdW/D3l3HU45bFT+chFusKeIeMnp 9f0tu/a8NBysCsaMgP37FVAuO2BlbCaTN8TNzM7P2Nv3Smwme8TWx/gkTPrbxRxioc7r VQpQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :message-id:date:subject:cc:to:from:dkim-signature; bh=hjOXAiNzgu9fDrCr2B26A5FENiij5QbaOJxXeBfw688=; b=YCQAdKEYaxqU52B7UIX/aocuiqplDrjF0j/AXq0l4UT/TjT4E+qeUOouBns6vAvzhd ZpGl5WPzHov8Tw7U5oj0fgBhHBbQhwLeCurpRJl4nTWaymIXGBlTlctUNDcqlAxZIExR RAVv9L25IA/CkGY2fqUsV1GXKpNR/dvtcz8CH0dT9fhPWQ96UYqzbWnw3hwrzQmfpefT OiTWs6axEMfyIpxlW0jsdGhI/acqXxnJz0jNGb5NCGyCtrh6PbZBtt0XkfPQPUO7JRNB UuOFWouW7wUSHUR4oe6bBhyV+fYnrNRB6JSkWjQfMGLlsGsVsEbOx6gzIElDLCD4A+9W GHGQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@fb.com header.s=facebook header.b=K7q3FGwJ; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=fb.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id cf25si9484627ejb.435.2020.11.10.12.00.04; Tue, 10 Nov 2020 12:00:29 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@fb.com header.s=facebook header.b=K7q3FGwJ; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=fb.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1731570AbgKJT6W (ORCPT + 99 others); Tue, 10 Nov 2020 14:58:22 -0500 Received: from mx0b-00082601.pphosted.com ([67.231.153.30]:15644 "EHLO mx0a-00082601.pphosted.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1729630AbgKJT6V (ORCPT ); Tue, 10 Nov 2020 14:58:21 -0500 Received: from pps.filterd (m0089730.ppops.net [127.0.0.1]) by m0089730.ppops.net (8.16.0.42/8.16.0.42) with SMTP id 0AAJiSDr015007 for ; Tue, 10 Nov 2020 11:58:20 -0800 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=fb.com; h=from : to : cc : subject : date : message-id : mime-version : content-transfer-encoding : content-type; s=facebook; bh=hjOXAiNzgu9fDrCr2B26A5FENiij5QbaOJxXeBfw688=; b=K7q3FGwJEI97/0gTF8YYY06a5DzpTJRmQrWfIMTQFsWXUgcP6Pg4WPrLZy6Y4YBtlBqZ seL2KYOyP1ORO2qXn0PMBOTRUg59i2pY98PiKRZKvNekXU+2hzzhXxLAea42lmaZj+Yx 9SS6gqQ71wRSFJJf0gIV7tyw3pdAqDyADQs= Received: from maileast.thefacebook.com ([163.114.130.16]) by m0089730.ppops.net with ESMTP id 34nqy2ft7w-6 (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128 verify=NOT) for ; Tue, 10 Nov 2020 11:58:20 -0800 Received: from intmgw003.06.prn3.facebook.com (2620:10d:c0a8:1b::d) by mail.thefacebook.com (2620:10d:c0a8:83::6) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.1979.3; Tue, 10 Nov 2020 11:58:08 -0800 Received: by devvm1755.vll0.facebook.com (Postfix, from userid 111017) id 31722238DAA4; Tue, 10 Nov 2020 11:57:59 -0800 (PST) From: Roman Gushchin To: Andrew Morton , CC: Shakeel Butt , Johannes Weiner , Michal Hocko , Christoph Lameter , , , Roman Gushchin Subject: [PATCH 1/2] mm: slub: call account_slab_page() after slab page initialization Date: Tue, 10 Nov 2020 11:57:52 -0800 Message-ID: <20201110195753.530157-1-guro@fb.com> X-Mailer: git-send-email 2.24.1 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-FB-Internal: Safe Content-Type: text/plain X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10434:6.0.312,18.0.737 definitions=2020-11-10_07:2020-11-10,2020-11-10 signatures=0 X-Proofpoint-Spam-Details: rule=fb_default_notspam policy=fb_default score=0 priorityscore=1501 mlxlogscore=855 phishscore=0 mlxscore=0 malwarescore=0 spamscore=0 bulkscore=0 impostorscore=0 suspectscore=0 clxscore=1015 adultscore=0 lowpriorityscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2009150000 definitions=main-2011100135 X-FB-Internal: deliver Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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 --- 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 k= mem_cache *s, else page =3D __alloc_pages_node(node, flags, order); =20 - if (page) - account_slab_page(page, order, s); - return page; } =20 @@ -1777,6 +1774,8 @@ static struct page *allocate_slab(struct kmem_cache= *s, gfp_t flags, int node) =20 page->objects =3D oo_objects(oo); =20 + account_slab_page(page, oo_order(oo), s, flags); + page->slab_cache =3D s; __SetPageSlab(page); if (page_is_pfmemalloc(page)) --=20 2.26.2