Received: by 2002:ab2:1689:0:b0:1f7:5705:b850 with SMTP id d9csp1816786lqa; Mon, 29 Apr 2024 23:07:35 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCVrHISGlfHI8MS1d3vyTcKy/G9fwtsCpdKj5+kAirpxiMuWVK6V5jrnlo32uEyLMigZ1LKPB2skLeDKlXTDOdbbhlIXQpsVWfusEQOrQg== X-Google-Smtp-Source: AGHT+IHHHiwdi9nYVAt+tvH4uty6/ubmEK3fICmhZV9nYgLn3W28OhPzJskVGBe1iGGYsp85k7ep X-Received: by 2002:a05:6a00:179c:b0:6f3:ee23:3c39 with SMTP id s28-20020a056a00179c00b006f3ee233c39mr2407774pfg.7.1714457255083; Mon, 29 Apr 2024 23:07:35 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1714457255; cv=pass; d=google.com; s=arc-20160816; b=aXZzzJP6Eh/c3GMH/Wm6wu/YIqndNNCQTNoBBLiGhGvC7GTmyUkZ+eRTWzi3lEx46T NvHN/GQg/3singU+3x9XH2vLxhE/ZxXaEeW+DqoG7z2qd4kSD+qQlO3CCxZFhtg0zLcD Qg88reuIsCBUwE5E3qbyU/uWJX4ZCsbhg6ZfkZSENpa7HdNw5Jw0WETXd/fwE0bkY/3Y 92UN9TDb0BwCqFtS2yUr9U3VpPqu5NlJI+8MeDZfeVgNO24vXuyL5PMengRYTl9+AkDo FZh6odPYWm0aI9vR1w4mpbELw5DxHlvyNyQCQ1X8J0Rr4YAkZDK57KzgqZZEqL0s3fCZ Y2wg== 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=5r5hMtfswp5qoj9glT20FCqOKYLmIdRrP0lNWsirtps=; fh=wnfKuHOUY4Mz1NUoc5XDTD1KV85duf1XGuItoJ8zV0s=; b=VphVnFSR+H1eo7DqtTyPJGSgyWk2Q98smg9kUZc94KhL9gQ3q+FE2gXoene/9jbd+X lmbl2AjqxYbh9Nf0Ol1Kv6bOCIjkuqFNjF2dExsW5fjUYF9QsHkrKqfn/p6rMD8jbtHu /OA5lTK1R9p85itXjRywzVQMlCbw7NxcGhidcYkDuDza1Y6MGZe645L5yYSkfwejGTen 4FjL/V33rWLN5v68g7lGAQYxvlVw4pIWlFwsB7TKjyrjzaQUBUJiz3eITme3giaaYih9 WjxOolWaaBEWV7P85qnYFf37f+AxrxPZet8QSW0PVhzEqBmn2lboxXMzLyl1UrG/eNpr tqwQ==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@linux.dev header.s=key1 header.b=PeTHaWtH; 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-163388-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:40f1:3f00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-163388-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linux.dev Return-Path: Received: from sy.mirrors.kernel.org (sy.mirrors.kernel.org. [2604:1380:40f1:3f00::1]) by mx.google.com with ESMTPS id kp7-20020a056a00464700b006ece3da5268si21329405pfb.391.2024.04.29.23.07.34 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 29 Apr 2024 23:07:35 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-163388-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:40f1:3f00::1 as permitted sender) client-ip=2604:1380:40f1:3f00::1; Authentication-Results: mx.google.com; dkim=pass header.i=@linux.dev header.s=key1 header.b=PeTHaWtH; 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-163388-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:40f1:3f00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-163388-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 sy.mirrors.kernel.org (Postfix) with ESMTPS id B4CCBB22343 for ; Tue, 30 Apr 2024 06:07:06 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id B1BB21C291; Tue, 30 Apr 2024 06:06:35 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linux.dev header.i=@linux.dev header.b="PeTHaWtH" Received: from out-176.mta0.migadu.com (out-176.mta0.migadu.com [91.218.175.176]) (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 73F871B96B for ; Tue, 30 Apr 2024 06:06:32 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=91.218.175.176 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1714457194; cv=none; b=kKxmgym+dC40xeItspBPDIUH5lRsBsUC6oGCzyhcQBESBUOnWfnZRgGOv9pWmOKZsALSe3AC725BFdFDo73r6xvS/bSj07R50LiJjHFUPOOiQyhmOVO16rV28R4+JB4VdICae5IvmyBX/RBztoy8uvS3MV/A47I+IFX5Aja9KUU= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1714457194; c=relaxed/simple; bh=OCjUhL8u0ustWTtr862Hux6+rr/q4YzkONnKLU21Nk0=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=dDjfyemwqCF4PS3px04aFyJoQe8NS+GPh0uG3vbYtMJTfxpLtQbDoLK8rtoYX9Q5iQd/0A+NnaMs3x0CxNupv145BsosRkfbqFe2dCX5+TxehZ2fQfNTvsTW/kCoHgEnD5VyMTRu2iI3oHAPQ/YzE1pE/IfV3sIEtPt1AsKoEBw= 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=PeTHaWtH; arc=none smtp.client-ip=91.218.175.176 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=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> 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 --- 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