Received: by 2002:ab2:1689:0:b0:1f7:5705:b850 with SMTP id d9csp1645800lqa; Mon, 29 Apr 2024 14:59:38 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCVB9JRNVhnPtkvfc6eMPd1ZuhEGAY4yKtnwjuxAOWd7TPzGeq7quHB4mtisBVhXGHgXXWspXNb0PwfmcRM45Z7gEmG0RA1L/S+fEV1Piw== X-Google-Smtp-Source: AGHT+IH72fmG7sLKUg06igo6jbg4x3+zsJBft4puZnlWCKbghKtgByo7ITljZf23MMUQqC+6BgZL X-Received: by 2002:a05:622a:1a96:b0:43a:f80c:6923 with SMTP id s22-20020a05622a1a9600b0043af80c6923mr840491qtc.36.1714427977747; Mon, 29 Apr 2024 14:59:37 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1714427977; cv=pass; d=google.com; s=arc-20160816; b=NPhfB9x9AzGfhAiCHYjWnecF0UO8+cRCLh0sSk0rzT0jA1yRQ6P/pTdAL95JKgVbLI +gwlUTFAG5XZSgmrYgyff+iiZ0b8OcjKDXmx30SZ7yQj1UJN4uPDfmRsBpQoMVlG5l56 TJoqSxkudpz8twepkPdxNGH030JMos1x8xsMovB66WX4MKGT2If+2cbGgmfcYI6IbBbk D/+z/UY2yVuvl7smG08WVE65yiXpxWrxbc6sNrCJaglfHmVSFsLssrS8WjUZtsNffNZL zsvDqYc91fOeqNZWTLYODM7jiIbvXlNi1OOt5SsSUVbbjVtlGYR5q4pBhftM8Y2yi0d+ qtZQ== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=in-reply-to:content-disposition:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:references:message-id:subject:cc :to:from:dkim-signature:date; bh=2oq8GpknbuUizjxkKnYJjGUQCiIjEtDOZULkmvv0Vfs=; fh=EtmzgUDl7YWyKMNs6TjPGPlxEbIQxspZo+ZGll7FwB0=; b=gUzMR00mmuBRb7RfgGC/uktp7hy0qyy5rquR9wgrTMKYvnpDWTtZy1v+OQufeNfPhW /jaINbfUKqVci/jURxIhAZ45FMfoOz1imXkMGRqtCWVS7C1uOD5/ezANPD5fkKWz+q/m fugnZq3pq3uUaw3Aou9SBejaI3GoRCmGuenBjnxMeGML6tTie76elVFUgDkPa6s7cjMS wrpUJ7t2zAKDRWhoM1Y1BPc5Xy9NjBeHgWQOHvHvMNnw80JDe3IllyZ6QjhcYqU6xCmE aciSh7ULnQ9lXrSam96hGZGJJo7+b+g5AO5Gjkacrn9ra50KKtDRQi3Y2bIiALwqSeUj xGAw==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@linux.dev header.s=key1 header.b=ixxDWaYp; 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-163084-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-163084-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linux.dev Return-Path: Received: from ny.mirrors.kernel.org (ny.mirrors.kernel.org. [2604:1380:45d1:ec00::1]) by mx.google.com with ESMTPS id ff20-20020a05622a4d9400b00437b3df9c70si26686010qtb.9.2024.04.29.14.59.37 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 29 Apr 2024 14:59:37 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-163084-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) client-ip=2604:1380:45d1:ec00::1; Authentication-Results: mx.google.com; dkim=pass header.i=@linux.dev header.s=key1 header.b=ixxDWaYp; 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-163084-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-163084-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 ny.mirrors.kernel.org (Postfix) with ESMTPS id 78D651C21E24 for ; Mon, 29 Apr 2024 21:59:37 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id DFBA8190687; Mon, 29 Apr 2024 21:59:32 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linux.dev header.i=@linux.dev header.b="ixxDWaYp" Received: from out-182.mta0.migadu.com (out-182.mta0.migadu.com [91.218.175.182]) (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 3ECE81779BD for ; Mon, 29 Apr 2024 21:59:28 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=91.218.175.182 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1714427971; cv=none; b=XQY6Id57g32SuctaX0FvQsM8XuENyIpvVQ56Li9B5bMd6yBw2GJjxrVUfuaAWUsYu6xbGcTxUGaNDMVNHTITa0wkM2Hul+JfpfrESY3P9hEch2w81Sw3Wk5S5EFsS5X/6xEhLMLvbZOX97ovm4Mx7JerEMkhc9lM9AgizHZldOc= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1714427971; c=relaxed/simple; bh=Sm/QhYaANzS96GQWMRGXzHvIopnHpQxaOfBEBSIv3tU=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=QZ76zaC+CG1/15+wh68J9McIVUX6noUXrjXOP/EFRUih9uFrHKHBgPbKxlqDC5fZYOruk4wvn8tkUk1CN3GJdOStCXFdAnX6PwjuNAi4vDLo6TMntwaPm/qQDGLiDpAyEQ/s9ypcemSeraxz6QoPwv7+EY8oYH/W3IxTkuommR4= 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=ixxDWaYp; arc=none smtp.client-ip=91.218.175.182 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 Date: Mon, 29 Apr 2024 14:59:22 -0700 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linux.dev; s=key1; t=1714427967; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=2oq8GpknbuUizjxkKnYJjGUQCiIjEtDOZULkmvv0Vfs=; b=ixxDWaYpir3Wna7zhULD0rDFlZCTLryAoW7WU11UVrwuHqwNsrvNiRagbc6zExkzSrcFzK IKfT0T/zXOd2uOg4/R6TnRAOMeZ59JeTJyWRoWhzm3thd3XZq7KC0lQUSUcOwDEs06tvF2 wQ2ttgJn8cCQ2VMbm5P1Pr4rGyoxPnE= X-Report-Abuse: Please report any abuse attempt to abuse@migadu.com and include these headers. From: Shakeel Butt To: Roman Gushchin Cc: Andrew Morton , Johannes Weiner , Michal Hocko , Muchun Song , linux-mm@kvack.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH v2 2/7] memcg: dynamically allocate lruvec_stats Message-ID: References: <20240427003733.3898961-1-shakeel.butt@linux.dev> <20240427003733.3898961-3-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-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: X-Migadu-Flow: FLOW_OUT On Mon, Apr 29, 2024 at 02:02:23PM -0700, Roman Gushchin wrote: > On Mon, Apr 29, 2024 at 12:46:32PM -0700, Shakeel Butt wrote: > > On Mon, Apr 29, 2024 at 08:50:11AM -0700, Roman Gushchin wrote: > > > On Fri, Apr 26, 2024 at 05:37:28PM -0700, Shakeel Butt wrote: > > [...] > > > > > > + return x; > > > > +} > > > > + > > > > /* Subset of vm_event_item to report for memcg event stats */ > > > > static const unsigned int memcg_vm_event_stat[] = { > > > > PGPGIN, > > > > @@ -5492,18 +5546,25 @@ 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); > > > > > > Why not GFP_KERNEL_ACCOUNT? > > > > > > > Previously struct lruvec_stats was part of struct mem_cgroup_per_node > > and we use GFP_KERNEL to allocate struct mem_cgroup_per_node. I kept the > > behavior same and if we want to switch to GFP_KERNEL_ACCOUNT, I think it > > should be a separate patch. > > Agree. Here is the patch: Awesome, I will pull this in my v3 post. > > -- > > From fd6854c0b272c5314bce6c9dee7d3c8f8cee3a86 Mon Sep 17 00:00:00 2001 > From: Roman Gushchin > Date: Mon, 29 Apr 2024 13:57:26 -0700 > Subject: [PATCH] mm: memcg: account memory used for memcg vmstats and lruvec > stats > > 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 Acked-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 d11536ef59ef..2fe25d49cfaa 100644 > --- a/mm/memcontrol.c > +++ b/mm/memcontrol.c > @@ -5661,8 +5661,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; > > @@ -5733,7 +5733,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.2 >