From patchwork Wed May 1 17:26:12 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Shakeel Butt X-Patchwork-Id: 13651041 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by smtp.lore.kernel.org (Postfix) with ESMTP id 1E545C4345F for ; Wed, 1 May 2024 17:26:43 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id A435A6B0098; Wed, 1 May 2024 13:26:42 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 9F7096B0099; Wed, 1 May 2024 13:26:42 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 894C96B009A; Wed, 1 May 2024 13:26:42 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0012.hostedemail.com [216.40.44.12]) by kanga.kvack.org (Postfix) with ESMTP id 6761F6B0098 for ; Wed, 1 May 2024 13:26:42 -0400 (EDT) Received: from smtpin20.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay08.hostedemail.com (Postfix) with ESMTP id 16F7D1405F0 for ; Wed, 1 May 2024 17:26:42 +0000 (UTC) X-FDA: 82070506644.20.239BA23 Received: from out-178.mta1.migadu.com (out-178.mta1.migadu.com [95.215.58.178]) by imf10.hostedemail.com (Postfix) with ESMTP id 03252C0016 for ; Wed, 1 May 2024 17:26:38 +0000 (UTC) Authentication-Results: imf10.hostedemail.com; dkim=pass header.d=linux.dev header.s=key1 header.b=If080VrU; dmarc=pass (policy=none) header.from=linux.dev; spf=pass (imf10.hostedemail.com: domain of shakeel.butt@linux.dev designates 95.215.58.178 as permitted sender) smtp.mailfrom=shakeel.butt@linux.dev ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1714584399; h=from:from:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references:dkim-signature; bh=JuviNSLTVsDm2/Um5Hfjfi5K4HkGkzN+hyrTetNNaTI=; b=Ox8oUUlNFgR8EXrp03txx2tG2pRpo8JcEueCwkcpmJFZTox+AndAiiKnaIA9O5NcHjWa+n 4skfQmP8JBj7DR7fLl/yskj1XWtOtjYyHZGg589Q3l9j8oYHeAiZl/90frR6m+oDq9mwpX 3jN+GGFWjyAGKb99D59W53+MBaJ1ANk= ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1714584399; a=rsa-sha256; cv=none; b=sTMpyl0WoVo4DaGBdcXYZXR8I/lbpxexJBdNQYQayBWlbC/c2wQooo2rIN8ahEE/bD9AOD uuyKDWDWCICOrTHLVOKWPXtSy8fvTK0+ckSj6p371HC2OQjOZBawm5xPcpqquy635ErpCF Td175RFHVb1IoWdpgoxAuvJ3pzCRBII= ARC-Authentication-Results: i=1; imf10.hostedemail.com; dkim=pass header.d=linux.dev header.s=key1 header.b=If080VrU; dmarc=pass (policy=none) header.from=linux.dev; spf=pass (imf10.hostedemail.com: domain of shakeel.butt@linux.dev designates 95.215.58.178 as permitted sender) smtp.mailfrom=shakeel.butt@linux.dev X-Report-Abuse: Please report any abuse attempt to abuse@migadu.com and include these headers. DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linux.dev; s=key1; t=1714584397; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=JuviNSLTVsDm2/Um5Hfjfi5K4HkGkzN+hyrTetNNaTI=; b=If080VrUZeaO5mlZ3lObU0HLh9SFBUBimkTYvPuIkRA/tpnOeALwyjhGWuu/NaO77tLhLx mmezzwbTym0qQ927euj7Kk9h1CWx4JQ0J96wFEZT3cAJNQPrqkIkEpHJ7L8GlkhL/RHPiy KbmHTH6I7hXFRF+V0wq38poukU67Sr0= From: Shakeel Butt To: Andrew Morton , Johannes Weiner , Michal Hocko , Roman Gushchin , Muchun Song , Yosry Ahmed , "T . J . Mercier" Cc: kernel-team@meta.com, linux-mm@kvack.org, linux-kernel@vger.kernel.org Subject: [PATCH v4 3/8] mm: memcg: account memory used for memcg vmstats and lruvec stats Date: Wed, 1 May 2024 10:26:12 -0700 Message-ID: <20240501172617.678560-4-shakeel.butt@linux.dev> In-Reply-To: <20240501172617.678560-1-shakeel.butt@linux.dev> References: <20240501172617.678560-1-shakeel.butt@linux.dev> MIME-Version: 1.0 X-Migadu-Flow: FLOW_OUT X-Rspamd-Queue-Id: 03252C0016 X-Rspam-User: X-Rspamd-Server: rspam03 X-Stat-Signature: 3k45dsfk5n6rshb3x8peyx5pyryzuyxi X-HE-Tag: 1714584398-972462 X-HE-Meta: U2FsdGVkX1/xwhsneVz0gqskQmmqGGtm7gdI+jCN03A9XA0k4UULFlv47HscpF4kjICGAWz2+T5dQzNaSwSl+Z51iNH6lYIrAjs/v7Mbm3JRzVqBFfaQJef7wBLnDiUb8qNe8yjbuYZ59ZzBUpLQdkdU9us9DHWd2ChfYURQyn/xVLKuyHgY6102ORfL+I6AdjzxkuuqZWmeP9g1xr0ic3KWVeJTAt5SZ4dV71bgSMrhYi2Wcll2NaCUcXK95DYfj2EfV+mY87FVuHhbkuh32XPiTFAs1bgNF82wVDSS18GHqdvPMOvr5W1f+Me3wreVZzkUPIH090SZMb0ICPSASFK5auMwZPddkeak2aBtlurJfSCucSXY7DvrUH7RUZU1W15vPaENgjaXfhpa+OujLARcHud41AnzxzgXLmWj5bkHJdmZEgPovMxHXdd5ftXIdcz1yjeEeZAMOsFLHWIZ8XS5bcVJlGTi6yTbZSYkMDnP27Nl2rURtsjps/4yshbThwXAWGFK8pEMkaTZtRop5Je5KAJekGeQPHlLFe7LfDm+c+aOsGSs6JMkJuiZp84wfGqbEYLUVe5oIlDjtustj6V83K3wCcdOkHyBb5UnuTiU4UpKDif4zyH75sq2ffvpmCvZiszHsOGo1FgmnB2aiSeUHyKPG/cXY5GGH0TznyTGFAHR9nnZElV1m/OEoE4LoJjmOJpzejhqOgj/k+xABUeH+gxcogT47hj4sS+SVFehemnF4/10LKg57/d/sQjo1WupK/I7nrHxOSdbserPxniI7LgwydO/Hogv8ZKpG5bqAiofa2vsIZ/czqyLMDR/Uh5qE5aHLxhx8Wuz9o9k2A== 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: List-Subscribe: List-Unsubscribe: From: Roman Gushchin The percpu memory used by memcg's memory statistics is already accounted. For consistency, let's enable accounting for vmstats and lruvec stats as well. Signed-off-by: Roman Gushchin Signed-off-by: Shakeel Butt Reviewed-by: Yosry Ahmed Reviewed-by: T.J. Mercier --- Changes since v3: - N/A mm/memcontrol.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/mm/memcontrol.c b/mm/memcontrol.c index 7126459ec56a..434cff91b65e 100644 --- a/mm/memcontrol.c +++ b/mm/memcontrol.c @@ -5545,8 +5545,8 @@ static int alloc_mem_cgroup_per_node_info(struct mem_cgroup *memcg, int node) if (!pn) return 1; - pn->lruvec_stats = kzalloc_node(sizeof(struct lruvec_stats), GFP_KERNEL, - node); + pn->lruvec_stats = kzalloc_node(sizeof(struct lruvec_stats), + GFP_KERNEL_ACCOUNT, node); if (!pn->lruvec_stats) goto fail; @@ -5617,7 +5617,8 @@ static struct mem_cgroup *mem_cgroup_alloc(struct mem_cgroup *parent) goto fail; } - memcg->vmstats = kzalloc(sizeof(struct memcg_vmstats), GFP_KERNEL); + memcg->vmstats = kzalloc(sizeof(struct memcg_vmstats), + GFP_KERNEL_ACCOUNT); if (!memcg->vmstats) goto fail;