Received: by 2002:ab2:60d1:0:b0:1f7:5705:b850 with SMTP id i17csp141967lqm; Tue, 30 Apr 2024 16:01:01 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCUArCbkxnAlhMdshOTeORvAE6H+bCyifaufeQ8fTEHlT/cuS09qfQ4kNOwkZbNZqHJURjXSXUz8Z+zj9j7vFL0BMBmFuql1w92pRvBmHg== X-Google-Smtp-Source: AGHT+IHUXvelgdbsYiguVWLG81vuB5YAQaH0rHKFCXF7fLqq5XsGirP7Ub5RusLIOwAVD1W5E4+N X-Received: by 2002:a05:6a20:da91:b0:1a9:499c:5778 with SMTP id iy17-20020a056a20da9100b001a9499c5778mr1491236pzb.35.1714518061335; Tue, 30 Apr 2024 16:01:01 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1714518061; cv=pass; d=google.com; s=arc-20160816; b=qzRD0PYNXLVYPudLvQ4UwWCwdp9C6IvBIZBM0AKe6FdzZV6NrCG/NnNwpZHEzEESi8 C6ntb65tQK1RCdPe5Ab9HCJxuySOnGJkUuDI3Cu3t67tOd7GcmV/HbDe4WlRNzqbdo/+ OWeDKLc2/RMGo7rB2ShQGgt+lAyAM4YHyQI1bCYR0Z2coo4mYzRM8dw/nuU9AuMqMLfn judjGVkc3M40amRyyZQxWOdvHkK622e33Ty8tEaMxisSEhDqk2kOaIcsg2fm2O/QXYyN II0W8sinjO+giKBd+fQPzs8IIQDrHJtuI1m8YlGzKb0ZCqwQg12FK6ODh2pNooUcfRSA zKTw== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=in-reply-to:content-transfer-encoding:content-disposition :mime-version:list-unsubscribe:list-subscribe:list-id:precedence :references:message-id:subject:cc:to:from:dkim-signature:date; bh=ZUW4oNFaD0o6Bd2QS09RU7OZsgb/vrqxqdIPqn7qFTM=; fh=k7OS/AJKcwtUnXgEkq0FrLhMtZ79/y+iBZO3DpeowZg=; b=h8cEPb0n9WwVAxF0nABtd1jq7AZwV5zboPBGX8jjUxJwiZGf+BU6pPV2JTp+HtFNMa YWkV0PZF9DhxcUU8P7v0JEKiMWogSUgMOtqnpumDvS0D7OASfpPhgiKocQSg6wD/mlrO HwK2wXx2FrxCCTmkgInbU13qPXgS0gDHKfnzcLBGTw1cWblSvvSrM9oXxmdOt1dEdc1W 2ivdZcvepAC7DSn9J2GWDcOgkXVUgmJRKBrZEeqM0Q6sSCL5TONabN7PQwUvqJpCkhT/ zgEhoigQDJgsKELYcYhe2zo7eAQoSkSbm8ZVCE0ZGifEa/VRxJYsTmGA6/nH/Gwz84ky K0nw==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@linux.dev header.s=key1 header.b=sEmKXuMs; 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-164787-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.48.161 as permitted sender) smtp.mailfrom="linux-kernel+bounces-164787-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. [147.75.48.161]) by mx.google.com with ESMTPS id sy16-20020a17090b2d1000b002b079e5cee3si218092pjb.133.2024.04.30.16.01.00 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 30 Apr 2024 16:01:01 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-164787-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.48.161 as permitted sender) client-ip=147.75.48.161; Authentication-Results: mx.google.com; dkim=pass header.i=@linux.dev header.s=key1 header.b=sEmKXuMs; 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-164787-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.48.161 as permitted sender) smtp.mailfrom="linux-kernel+bounces-164787-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 691CBB22774 for ; Tue, 30 Apr 2024 23:00:58 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id E87DD53E33; Tue, 30 Apr 2024 23:00:52 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linux.dev header.i=@linux.dev header.b="sEmKXuMs" Received: from out-183.mta0.migadu.com (out-183.mta0.migadu.com [91.218.175.183]) (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 E4F1A129E72 for ; Tue, 30 Apr 2024 23:00:48 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=91.218.175.183 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1714518051; cv=none; b=tTThTwEHMSu/wKguApADxOS+sTxT1AIA0DkGHYu5KZxt3M92BJRsUPx35EqiB1+/xPR19KiUn6AgExw9YI0Am0N812AoqXrIQiWEEeKFJwhCgEeZ5G1guV+OX262DUk9CWcWppSQ73+4slpL2BY3KQpiu2o3SuOpw+1+wt1Nlxg= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1714518051; c=relaxed/simple; bh=a7tAcJXwom+s+uXCOJcRVhUgJEZG/cOxHfzIa0V0PO4=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=YTJ3LMcSVqDp/4LBIQ9OUO097mPrOVYGWc+GxmF9yTAMmCp7dtS3wlNqkPboYy0FRG2YrUxj+fDo1G6wpys3AF/Ex6xlZgwV0Kx0ARq9Pv5u299TeaWkvS8LG6uAqXQVoJO4poR4Dxv8SVkgtxWrFJx851ttVaeU7vcrldyMIcc= 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=sEmKXuMs; arc=none smtp.client-ip=91.218.175.183 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: Tue, 30 Apr 2024 16:00:42 -0700 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linux.dev; s=key1; t=1714518046; 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: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=ZUW4oNFaD0o6Bd2QS09RU7OZsgb/vrqxqdIPqn7qFTM=; b=sEmKXuMs/tKb6YFbpFESPjYFZZneT4newThJeg2ABphFxrhnt/dYKudgLEjR8CmGYem0HV 5pxkQ+/qWntvBI7Mxgy0YzGMKozzD0M80LEqFnTeTBUm3lw3mzdr3UYNBhDt/WRj3Sixkz 9RlUVI277LiDMnD31IAQvgoqF0I6cyY= X-Report-Abuse: Please report any abuse attempt to abuse@migadu.com and include these headers. From: Shakeel Butt To: Yosry Ahmed Cc: Andrew Morton , Johannes Weiner , Michal Hocko , Roman Gushchin , Muchun Song , "T . J . Mercier" , kernel-team@meta.com, linux-mm@kvack.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH v3 4/8] memcg: reduce memory for the lruvec and memcg stats Message-ID: References: <20240430060612.2171650-1-shakeel.butt@linux.dev> <20240430060612.2171650-5-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=utf-8 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: X-Migadu-Flow: FLOW_OUT On Tue, Apr 30, 2024 at 10:41:01AM -0700, Yosry Ahmed wrote: > On Tue, Apr 30, 2024 at 10:38 AM Shakeel Butt wrote: > > > > On Tue, Apr 30, 2024 at 01:41:38AM -0700, Yosry Ahmed wrote: > > > On Mon, Apr 29, 2024 at 11:06 PM Shakeel Butt wrote: > > > > > > [...] > > > > + > > > > +#define NR_MEMCG_NODE_STAT_ITEMS ARRAY_SIZE(memcg_node_stat_items) > > > > +#define NR_MEMCG_STATS (NR_MEMCG_NODE_STAT_ITEMS + ARRAY_SIZE(memcg_stat_items)) > > > > +static int8_t mem_cgroup_stats_index[MEMCG_NR_STAT] __read_mostly; > > > > > > NR_MEMCG_STATS and MEMCG_NR_STAT are awfully close and have different > > > meanings. I think we should come up with better names (sorry nothing > > > comes to mind) or add a comment to make the difference more obvious. > > > > > > > How about the following comment? > > The comment LGTM. I prefer renaming them though if someone can come up > with better names. > I will be posting v4 and will change the name (still thinking about the name) becasuse: > > > > +static void init_memcg_stats(void) > > > > +{ > > > > + int8_t i, j = 0; > > > > + > > > > + /* Switch to short once this failure occurs. */ > > > > + BUILD_BUG_ON(NR_MEMCG_STATS >= 127 /* INT8_MAX */); The above should be MEMCG_NR_STAT instead of NR_MEMCG_STATS.