From patchwork Tue Apr 30 06:06:07 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Shakeel Butt X-Patchwork-Id: 13648289 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 96D49C4345F for ; Tue, 30 Apr 2024 06:06:34 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 260546B0099; Tue, 30 Apr 2024 02:06:34 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 1E9266B009A; Tue, 30 Apr 2024 02:06:34 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 0B1A36B009B; Tue, 30 Apr 2024 02:06:34 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0017.hostedemail.com [216.40.44.17]) by kanga.kvack.org (Postfix) with ESMTP id DA7CB6B0099 for ; Tue, 30 Apr 2024 02:06:33 -0400 (EDT) Received: from smtpin22.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay04.hostedemail.com (Postfix) with ESMTP id 547061A0313 for ; Tue, 30 Apr 2024 06:06:33 +0000 (UTC) X-FDA: 82065163866.22.3F32336 Received: from out-182.mta0.migadu.com (out-182.mta0.migadu.com [91.218.175.182]) by imf11.hostedemail.com (Postfix) with ESMTP id 928F640011 for ; Tue, 30 Apr 2024 06:06:31 +0000 (UTC) Authentication-Results: imf11.hostedemail.com; dkim=pass header.d=linux.dev header.s=key1 header.b=PeTHaWtH; spf=pass (imf11.hostedemail.com: domain of shakeel.butt@linux.dev designates 91.218.175.182 as permitted sender) smtp.mailfrom=shakeel.butt@linux.dev; dmarc=pass (policy=none) header.from=linux.dev ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1714457191; 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=5r5hMtfswp5qoj9glT20FCqOKYLmIdRrP0lNWsirtps=; b=HsvAdTX8AP5hY39z8TB+Pu3iYGt6Ijclwj+HlxoAIIe1sVbcyF1KDy2gWRTxj5KTpVC02N YqV9VEbcH9p8MobRhGxf+2yUOfPBAEzcZHdVyjFjz/RjWTjxtnHPnSzcHMrsXzi9kCPNNC Hxd0z2zHefGYhulO7jcKAckQHm+lHxM= ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1714457191; a=rsa-sha256; cv=none; b=oMATbWNqMxgXlQ+5janmjNaYU16zJjtdujYatcVUDPLO0EVdPMk3LvHnV2OSbwzyL2x4+a W6bKqHtDqmziUfsiEsWnbf5aTMlJqqw5l+1nimmhqiu1JHXErc7k9dw8gBYdjN5YONAh4k b2paNArbrNY8eqTgKQOkWI/dKRmjuIA= ARC-Authentication-Results: i=1; imf11.hostedemail.com; dkim=pass header.d=linux.dev header.s=key1 header.b=PeTHaWtH; spf=pass (imf11.hostedemail.com: domain of shakeel.butt@linux.dev designates 91.218.175.182 as permitted sender) smtp.mailfrom=shakeel.butt@linux.dev; dmarc=pass (policy=none) header.from=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=1714457190; 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=5r5hMtfswp5qoj9glT20FCqOKYLmIdRrP0lNWsirtps=; b=PeTHaWtHFNHgJkCXWCF/Ai07h2OyJw4wbWxj/hRwj0ynslSaUgA9yIq+xHiiRg6Is0gE5T dBPacjZehCXpuz9tiwffhX/AyogEmjHQ/UiWLdnv0irunhDrAvkdSSYKPHm5ydKRd5y1H8 xYbZIifAU4bef22QTLtYPQfKgrHJZPI= 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 v3 3/8] mm: memcg: account memory used for memcg vmstats and lruvec stats Date: Mon, 29 Apr 2024 23:06:07 -0700 Message-ID: <20240430060612.2171650-4-shakeel.butt@linux.dev> In-Reply-To: <20240430060612.2171650-1-shakeel.butt@linux.dev> References: <20240430060612.2171650-1-shakeel.butt@linux.dev> MIME-Version: 1.0 X-Migadu-Flow: FLOW_OUT X-Rspam-User: X-Stat-Signature: xnoyrgptzkgdwykn18xqoewnnb4h8b4p X-Rspamd-Server: rspam11 X-Rspamd-Queue-Id: 928F640011 X-HE-Tag: 1714457191-60108 X-HE-Meta: U2FsdGVkX19Xjs/ixjGBd4ireM/N3+i4FabruC/Kmgi9J/2lpLRcgxDUcnXgEih3QYQRiqjlf7brOlr24EhUIfc4AFL7Yatv26FpYDu+TIhoHubAXnqARtp0lisVQvYSxVxp/FjOk0qnlTO3bKiRZnMczzuzTsC/fSHDUM1FMraFfIpC8hsmwHTbBHm2DNPjGMVDUPlxxkN6VOO81Pkih63i+HBgWKakuz5yg7Zh1P+e/7/citqQ+f402tucL4apMOlT6vj4hp0oR2zAtWjLPdJ1oLHnHLnbsiJ5YDwKEv0H8VAjw0y6r7UJv6MEEJBUSvSYQBo7SC5iItDcOYtfK9K6Fhj6mKKlZvybM9bzwDBpYUjJpbVTwrVU9ln8Xx9EvFCYbkdDQGEQFIUqp5rWmFruxyhqq6L/pMzFcFwz4//ZBzt2/K6QS1dS3rad1yahZhzg/SUsG3posFbzunV0SlgzzkjCHLEzEpgIjrpF2xdzx2NCkb3YoJXY2K/8vYbkDhbWeNAv9/dXw+BCoBzfKJP0NrB/jeu+oueiJj8vVOCIKHg/+GVPbuhQdYiDy5JyJVUSFSIRn6HgXzCWS4hYiM98fiH4oTDOf/eVrrrR8pSIWRRdd8EVT7NyWRLPXZOygi+4rSpl0ipgpLFNfO41XPNnZnqP10WXJ0ny0DDkSbW0dpDlYq3Gj9IfOQtX51G+HATa9x8Wc1DYj1L41/wixqba4itZFaz85WGcG4DVU/qDL4YbeGKwRFoJ0+Pm6L5mZU++Cx6GRvUW76UuI/tGWs85mzekCWjlTVC2qXBGEP3lDB0J1//wnUPfN56xccVWpHD/5UfD8kDEIa74HCioAD1R+oUWjFP3KxGCo31kTOiRkX6aSLKzy6YrlfsSoaA8zoTe2slZZXpAK96uAXf9ZVvruODb0noLsecLFprN+AgSjTqpMLWBu/PDjkELHTZun4wV4hLDihBCd5xFNJw /RuPa5Iu JpDpVL7DHlAANNmjMtUZkbctJXiLDQv5U0y6NmR+sQq4L4Dl/XfgavqH/ZCLFrY9KTCPdgh9nsqGR/fs= 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 --- 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;