Received: by 2002:ab2:60d1:0:b0:1f7:5705:b850 with SMTP id i17csp621829lqm; Wed, 1 May 2024 10:27:13 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCVjf9x/LmvpaQ0D0T2nqAGdSF7tLEnFN+NWs9QtWCaVLc6XS96DcSdcuodjKRIQvHlQyEbEs2SieUAf0ATl3XrJ1M1EOZYnO8LWUXZy+A== X-Google-Smtp-Source: AGHT+IH2VQHy5V8BuYcH3t4Gg3BqFfGtUycuyLEwiYf7dTw/TDtyOtsRd8KtwXMVRMWZGtnEfHj5 X-Received: by 2002:a05:6870:b60c:b0:23c:b87a:6fb6 with SMTP id cm12-20020a056870b60c00b0023cb87a6fb6mr2967827oab.45.1714584433091; Wed, 01 May 2024 10:27:13 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1714584433; cv=pass; d=google.com; s=arc-20160816; b=FuoV/oz9N4j68/NtX+eyJv6P9zxVDmjjVI5xOjfViZgIboM9MpFLFQ61Rhi4fPss51 yZRhwMg4slHeBZPZF+hOC74qIRVyF87O0PwpcqDgPPL6siLZcM+k1ga43ZUYqBvqrfqW 8Dz3r9LtBZaWsPOfhqOUqM+fBnZwKzIVJnMYbsJay8RvZsT5WqWYyNjjCwYQyGQFXWaz DqVuiir3u82rSfT9r5+IfozYRrPChr8NMqdvYbecCM8Evv/0u7n1c+/SsEWCGNV/8SXm m5RDqyPJiriX0cCAAEoQPEZOm3ljQa9++4j6AuPwo2oMac/NprdRB+2hGGhb7Ey13dZc K/Fg== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:references:in-reply-to:message-id :date:subject:cc:to:from:dkim-signature; bh=JuviNSLTVsDm2/Um5Hfjfi5K4HkGkzN+hyrTetNNaTI=; fh=wnfKuHOUY4Mz1NUoc5XDTD1KV85duf1XGuItoJ8zV0s=; b=qbXobovwVOVjSEUDkHBfVIkgZl+XOI6QID3HcblL1gmZGk48XCuc1pw1WpY1Yrz0uv NcqGjbKmKA+clQ+fhQS2nIM/YCjU3mAQwmYzhtdapAKRDEI3qCSltpXV/WBzsTFxU3lX CErSvnMd4L4tXUAgVNH23hWz/kUbNXsMwq8esYF0skIDJUE3RpCzYgGeQxFc/apo/+Jk yUXfOKU/WoO+IVBKJCK8UY5fNbsjAHzlTW4Ur10kOgbDQvusJF3sAfE3WckUbAtEH9R5 y0lcHSDmWkwW69vjEdl8LS23g3HQJ33ErzwtEB60hri0nDGJ7J5NTncbmF87H8mDKcws Y6XQ==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@linux.dev header.s=key1 header.b=If080VrU; arc=pass (i=1 spf=pass spfdomain=linux.dev dkim=pass dkdomain=linux.dev dmarc=pass fromdomain=linux.dev); spf=pass (google.com: domain of linux-kernel+bounces-165645-linux.lists.archive=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) smtp.mailfrom="linux-kernel+bounces-165645-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linux.dev Return-Path: Received: from sv.mirrors.kernel.org (sv.mirrors.kernel.org. [139.178.88.99]) by mx.google.com with ESMTPS id e123-20020a636981000000b005dc491389b1si23622196pgc.679.2024.05.01.10.27.12 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 01 May 2024 10:27:13 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-165645-linux.lists.archive=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) client-ip=139.178.88.99; Authentication-Results: mx.google.com; dkim=pass header.i=@linux.dev header.s=key1 header.b=If080VrU; arc=pass (i=1 spf=pass spfdomain=linux.dev dkim=pass dkdomain=linux.dev dmarc=pass fromdomain=linux.dev); spf=pass (google.com: domain of linux-kernel+bounces-165645-linux.lists.archive=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) smtp.mailfrom="linux-kernel+bounces-165645-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linux.dev Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by sv.mirrors.kernel.org (Postfix) with ESMTPS id AF63F2839A9 for ; Wed, 1 May 2024 17:27:09 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 484661B947; Wed, 1 May 2024 17:26:41 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linux.dev header.i=@linux.dev header.b="If080VrU" Received: from out-185.mta1.migadu.com (out-185.mta1.migadu.com [95.215.58.185]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id E61911CD37 for ; Wed, 1 May 2024 17:26:38 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=95.215.58.185 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1714584400; cv=none; b=mCxUzdriDewQZGxQOYwt0ain/mKiGRImrvrpWJQwtnYyTyXzbUze0v8geWCTXYHZKnolisON3rM803US5/6FYfbE3KPKtYlvJRaMqTAm9QfuJGCkWP8UF9goq5VstHy/ULoRCSHaNUBMa6vnhK1xOW2Nguv/2NBC1rbU9jN7FFk= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1714584400; c=relaxed/simple; bh=SGpb1457OsTElJRTOe797yw4gXpVrtIvEhr3MxZFSo4=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=A1ZiM+kBp2vfS4VJfnqB0f4hma7jVrsk3gltp/mwhGA2ltrdOqB8PjnB1HzBUPJeVYFn0StwjrsbSaAVdWpGshUHqGtOYpTETHD6Vo6J5w2+57l2t5clzXniw46qWNCcV+xw+690w/by9U7W2479gI5iSyZFiEDeWR8ansMOZT4= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.dev; spf=pass smtp.mailfrom=linux.dev; dkim=pass (1024-bit key) header.d=linux.dev header.i=@linux.dev header.b=If080VrU; arc=none smtp.client-ip=95.215.58.185 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.dev Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=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> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Migadu-Flow: FLOW_OUT 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; -- 2.43.0