Received: by 2002:ab2:1689:0:b0:1f7:5705:b850 with SMTP id d9csp1657150lqa; Mon, 29 Apr 2024 15:24:03 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCVaqnUkvriZisLpZDq79YlZIw1IdWsB1A8gW6kiJRp/Q1Cbi7aeLLfUIP7jmp5u3q8rqD1sFpnMbHsBz9dBrRvzEB9lTb29dngPo2YzHQ== X-Google-Smtp-Source: AGHT+IH9QU495yeIHsUHjgl8voUMsvLMj20FruqQIR5IzUBdAAtHbGOM6KjvHg1hxrBvcU4g0QbG X-Received: by 2002:a50:cc95:0:b0:56e:2daf:1ee6 with SMTP id q21-20020a50cc95000000b0056e2daf1ee6mr4609745edi.16.1714429443545; Mon, 29 Apr 2024 15:24:03 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1714429443; cv=pass; d=google.com; s=arc-20160816; b=kfpxvpBtnUEYxp+xIg4IZI4AV56INiW/PX33EluMkFV/JF5sT+hwMn8ht48soWr7wO G6vXEAqRqZOndz94go8IOhYRRNd53DD5Hfy4Z8mwkBtfTZn43dU0EuwhclaTIyC9L0KQ CP+P+yWjV5azWbCOg+cjx56BIvLp18M3Z7GvbyFNXlRN1zwZm9kPhfP5c0xRz2CSB6qE NUoCW3CRCkmhUW+r27S/nStlbMmfZTgJVpxw9ZhEl1c3Hw+5TZjOuWt+Ie2rMsYXVqAU 6aaNuLtSw7g9+oSNsZv2YXghOV9YzBornQ0Bdaj1eln759UDK859X1Zb6+Isk4GMrFe6 gOWQ== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:list-unsubscribe:list-subscribe :list-id:precedence:dkim-signature; bh=OGlufsSMUfGTy8V2I8bIM/xvglG1OuNLwieN2n+XFOw=; fh=CcLipv1E73xSZOiZgfb/x3dXikEXzdUme9+txXWkiLw=; b=xkuylNMSLLsVAq36HrZh5qRVerNmu6o8nUiIxrpFvDbruTKe5Lj/IyYz9lJwzsdUIF MxW6aa4IzLt3Y6wyPvnpEq9vA41bDPiCbbVNXecASfj37y9EjJhyRkmK/jcgsp0LRJZe 8quL3gWO1bL0UTw8u9VyT12jzPRksU45c4feu5PsvgnZ14LjST7knE4WBctfNKbkS2Fx TGahFCFmFmmMXUQ+PBe2lSWDge8PDyRd0vFglJIdYuBiMmH5jeeD+yZySar09Qu85BSY n+SRIhXgbqFu/4j0rU3h/gtTXRWDyKRslQeuI4exBS53mG8DkEesKR6FMPBHIPHvEinN ZaCg==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@google.com header.s=20230601 header.b="3AnwW7/q"; arc=pass (i=1 spf=pass spfdomain=google.com dkim=pass dkdomain=google.com dmarc=pass fromdomain=google.com); spf=pass (google.com: domain of linux-kernel+bounces-163099-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) smtp.mailfrom="linux-kernel+bounces-163099-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=google.com Return-Path: Received: from am.mirrors.kernel.org (am.mirrors.kernel.org. [147.75.80.249]) by mx.google.com with ESMTPS id k24-20020a056402049800b0056e0b92b647si14524351edv.242.2024.04.29.15.24.03 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 29 Apr 2024 15:24:03 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-163099-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) client-ip=147.75.80.249; Authentication-Results: mx.google.com; dkim=pass header.i=@google.com header.s=20230601 header.b="3AnwW7/q"; arc=pass (i=1 spf=pass spfdomain=google.com dkim=pass dkdomain=google.com dmarc=pass fromdomain=google.com); spf=pass (google.com: domain of linux-kernel+bounces-163099-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) smtp.mailfrom="linux-kernel+bounces-163099-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=google.com 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 am.mirrors.kernel.org (Postfix) with ESMTPS id 4B02D1F22507 for ; Mon, 29 Apr 2024 22:24:03 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id C3CA9194C96; Mon, 29 Apr 2024 22:23:42 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=google.com header.i=@google.com header.b="3AnwW7/q" Received: from mail-yb1-f177.google.com (mail-yb1-f177.google.com [209.85.219.177]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 94CB4194C88 for ; Mon, 29 Apr 2024 22:23:40 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.219.177 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1714429422; cv=none; b=QUcg+anpQi0tsRFvN0tX4H28VaE5XLYzWcf2oQq3jjgZjT3OWBUyU28n/dlylPAhO05heklTNxb6ciZPvYLxy/KnYvIXZBmYDqT/IpXi0dMmNcjkda/dsCDV6Yk0yc9zOIrI9vwOOxeYms56cE+wG849OV084Rn+vJDLw7CT1RM= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1714429422; c=relaxed/simple; bh=C4h5zkEyr8Y64gy7n6dsxrGyhQOLrBN0HPxO6F1zAyw=; h=MIME-Version:References:In-Reply-To:From:Date:Message-ID:Subject: To:Cc:Content-Type; b=MwWp478Z1KcGFVuCL7N/TYXybqeBm2yxAt3YsfgZuCz1p9+YBV5IkS0aldAu/9VnSz0nOI3xMRGp3VQkaJwlwpBH+eQ8gw+DJg2+gFtgs3aPZf7cs00cmmJW1ZqkfK93LkxB/wcsgoM3TsQ98IFfBCTzQdNJUOE2Z8ssOWihzU0= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=google.com; spf=pass smtp.mailfrom=google.com; dkim=pass (2048-bit key) header.d=google.com header.i=@google.com header.b=3AnwW7/q; arc=none smtp.client-ip=209.85.219.177 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=google.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=google.com Received: by mail-yb1-f177.google.com with SMTP id 3f1490d57ef6-de54b28c41eso5675674276.0 for ; Mon, 29 Apr 2024 15:23:40 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20230601; t=1714429419; x=1715034219; darn=vger.kernel.org; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:from:to:cc:subject:date :message-id:reply-to; bh=OGlufsSMUfGTy8V2I8bIM/xvglG1OuNLwieN2n+XFOw=; b=3AnwW7/qt2NY4X4SppN269zumAqVP8dgWSz29q9hDW0TCMbFkJ/3R4R65EGKy+8BRH fXU8i4pluLMRCLJGeZxa5lW5ZcOAwwwfThjY6/DZNuPGsJtFZR5jOyIIhl789SYmPspz cLzV+rg5gmT8k0AneojDRWu3epgxaB4R7jVQfJDq6AMBJZubjS5OWDRCGl+usQzY4DUv eB77sQqf2DfTplW4A10KroHlBazI39fx+Nbae8Noi1ouQVfSUzGEsIqccn4LrhQXgzYH YxrnxXXb/KEAu/xCmUd2oZdySD/ObThezgEvCtw1jgjb6GT2HlfnLPJALDJwmD7NW68p q/6w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1714429419; x=1715034219; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=OGlufsSMUfGTy8V2I8bIM/xvglG1OuNLwieN2n+XFOw=; b=leGKUietEuucWfLJzt+aEVbAYg2oJYqeKewdNh1WG0mKvgj8wPFZxRdACL6dWTQ/t7 xoZr6lGb4q6HkkxCcOQposLaGYdFl4MgAbOhtqr6cyVGmwJn4lS8pDgmGjPGgNSDcidz BMwbFPK3g9TrsCZ5yTfN6GOwTIfnIcMe3ZXhwC/mJj7evjvhy1wfazewhOSEr0y4xa+D eSqUPGOB15hBKJBdTLq9vYGE66t6COfxYKI7HcwhLyjb9oRNDrVrC3Qovg7q7fMZQLxW RTvIhZaP1la+lQqn5HXOOy7393WJB7i97UiitdKnMwcSWiVBhp9unBebDjzGtzGquhwX L3Tg== X-Forwarded-Encrypted: i=1; AJvYcCWiry29ZhkVOxtXGBg8Rx8grV7XYRVn7JKtp6zf+RRxye2o71UYDtA29ViwipiOOMXA5m6YX9l4BqwY3a4zD1JiIGUr1scpl3ET9e9s X-Gm-Message-State: AOJu0YwMmDcpzcSy93//dHZMzCmXBhP5NiMvYCt0NX6aNynvrLT3tp0m 2dwnZTmsc3D2Lh7MujiK/21SXQCDmYDzCQYlr8wcGdVlv6OdE0Bes7k7yhR2THQLG1AhtefjxUP p1C8vANacmaIdbHkDt5pGmcn0ujrYJc0EHJ4+ X-Received: by 2002:a05:6902:160d:b0:de5:5647:c87e with SMTP id bw13-20020a056902160d00b00de55647c87emr14146085ybb.33.1714429419440; Mon, 29 Apr 2024 15:23:39 -0700 (PDT) Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 References: <20240427003733.3898961-1-shakeel.butt@linux.dev> <20240427003733.3898961-4-shakeel.butt@linux.dev> In-Reply-To: From: "T.J. Mercier" Date: Mon, 29 Apr 2024 15:23:28 -0700 Message-ID: Subject: Re: [PATCH v2 3/7] memcg: reduce memory for the lruvec and memcg stats To: Shakeel Butt Cc: Andrew Morton , Johannes Weiner , Michal Hocko , Roman Gushchin , Muchun Song , linux-mm@kvack.org, linux-kernel@vger.kernel.org Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable On Mon, Apr 29, 2024 at 1:13=E2=80=AFPM Shakeel Butt wrote: > > On Mon, Apr 29, 2024 at 10:35:38AM -0700, T.J. Mercier wrote: > > On Fri, Apr 26, 2024 at 5:37=E2=80=AFPM Shakeel Butt wrote: > > > > [...] > > > + > > > +static const unsigned int memcg_stat_items[] =3D { > > > + MEMCG_SWAP, > > > + MEMCG_SOCK, > > > + MEMCG_PERCPU_B, > > > + MEMCG_VMALLOC, > > > + MEMCG_KMEM, > > > + MEMCG_ZSWAP_B, > > > + MEMCG_ZSWAPPED, > > > +}; > > > > Unsigned for these? All the values are positive now, but I don't think > > we'll get a build warning if a negative one ever got added, just a > > crash or corruption. BUG_ON in init_memcg_stats if a > > memcg_stat_items[i] < 0? > > We are depending on NR_VM_NODE_STAT_ITEMS to tell the number of elements > for vmstats. So, I think there is an implicit assumption that there are > no negative enums in enum node_stat_item. So, if we want to verify those > assumptions then we should be adding such warnings/build-bugs in vmstat > first. Ok fair. I guess this if we get C23: enum node_stat_item : unsigned {