Received: by 2002:ab2:1689:0:b0:1f7:5705:b850 with SMTP id d9csp1600303lqa; Mon, 29 Apr 2024 13:13:25 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCUsmzA/UZYbUlhJZUAR1PpoKhxovd/14fmahNdexepKKL8aJZfpcLzoum8QVCl0MwGT9lVvbCztKVDOVpLxzYKw1WKkc2CCifb3dnsGDg== X-Google-Smtp-Source: AGHT+IHzwakmHYfECa6Y+o6c/tR/nVZPmm+p9pYgi1YzpZzGZjwrZXw4hGYv/V89Yl9gjX2ciW4/ X-Received: by 2002:a05:6359:4288:b0:18e:3ec:94bb with SMTP id kp8-20020a056359428800b0018e03ec94bbmr12909872rwb.23.1714421605434; Mon, 29 Apr 2024 13:13:25 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1714421605; cv=pass; d=google.com; s=arc-20160816; b=E0FHPjCpXx7lvJl1AA3PmTcuukiqK9sD+HDGvnm6O5bMjC06ThVIiV2PuYXOjNCzaP MAlUco2ZRhVt/5fVqTfiRBacNKo3dxJE1hKX55gjAc52YMcn+Dwf0O6FmpXs5fvY1XkY 8inDKCnjOwkE0muX5BV0Bd4XpskCLlNIs9drUTbKGMx5ZCGmEtTfIvGMc9/5kcpTUfdN gfVZ6N6Zsh+VoKmINbEZo3G146yzMuokPivv4JSu/2lx5PcqknOrcw38s/DAITmBE1zh nIQynXfWsNQh0nUi/BCbxpoEDzjVl5shvo+kq5qvnorNBZRUJFGaiAHHN1JYt5qrtcc4 PW/w== 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=rpO5NCX7yPwq2W+mZcrPJ8HtJBcgstQPIgknTXB/zH0=; fh=jSoP2QUElH2L6QybtW+2I+gwhCN58IRXJuu0FlOWj1Y=; b=pA+dSlgFaDoX7FVuB1g8c1OSqK7Ad4BNJ9LQib+zpxXpPaAwGfRPT27GDp+QSyDu3Y DhrU6vgNDU8vBero/LfcoIrhReT1Zr58uE5L7nSbDOFZ2h9U95tOfbCHLrKzQY5xTc5y trStFFi1Yz/BNoq9wKppbxkewKOgk0vsy9C4VMQXKU4/HgOfsWzdrcBvrB4ZYBpbFv1U xY0kryJaYKaBiniyS9Mvuh5wqGFCLtX/s7Qe75UrxaHgLarRkRIZ8IFQPnN5YR1ZIsnU 55zInfgtjsT+SuI8vZmvhb5wUWYnEzWXyW/V3PUbmKQd47gmk5x9GYTr4YmDHdDINKj+ hFyw==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@linux.dev header.s=key1 header.b=TrynBSTp; 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-163005-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-163005-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. [2604:1380:45e3:2400::1]) by mx.google.com with ESMTPS id d17-20020a639911000000b005dcc8a3fdc5si20120240pge.485.2024.04.29.13.13.25 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 29 Apr 2024 13:13:25 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-163005-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) client-ip=2604:1380:45e3:2400::1; Authentication-Results: mx.google.com; dkim=pass header.i=@linux.dev header.s=key1 header.b=TrynBSTp; 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-163005-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-163005-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 108A62830BA for ; Mon, 29 Apr 2024 20:13:22 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 217871411DC; Mon, 29 Apr 2024 20:13:17 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linux.dev header.i=@linux.dev header.b="TrynBSTp" Received: from out-187.mta0.migadu.com (out-187.mta0.migadu.com [91.218.175.187]) (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 DB4611411E1 for ; Mon, 29 Apr 2024 20:13:13 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=91.218.175.187 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1714421596; cv=none; b=YGCpPCybq/9MqnizNlDKP+Kjj3AEXRv05+5YM5GcLOdTv9biBnL1VC7A53Bw9P3/U0WEQSzf2xiafqG01LThIr4ujfNXTUBwt+LNV5sqN9lGEXWmrsczJRNMHWgGkgH+DEh/DrAxJz6oFeICI3+AwTTQF4l5K8xigQKaZiSRBFI= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1714421596; c=relaxed/simple; bh=QgerTxy6+NGCL0V2nByCzbiGRtOFxT52kK2sHQmXnxk=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=QXLtRlVrov5DLnkiqq02uZu8bT4MP2gpXMCXsejkXa4jZYqh0L/9BKJ/uqsqsT2aBP3u5/p9IFT4+MNxEo8DQ8Qx0an2ipjbviCaIRQ/JtJfJZMu/KL4sJt+1nPLl7iQLWV00qPtt2xE+eMphH9AScK8aVHXgMfNsA3qHbo+mJE= 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=TrynBSTp; arc=none smtp.client-ip=91.218.175.187 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 13:13:05 -0700 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linux.dev; s=key1; t=1714421591; 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=rpO5NCX7yPwq2W+mZcrPJ8HtJBcgstQPIgknTXB/zH0=; b=TrynBSTpKkErpI1SOS8qM8bNSXMhC0m05bv/XRJDKNgYHYo8yr0yAhOhU+1bZld+jm+oIE bOQwUobFmJi+1tQ2Evgj9fP8DBYRznWyHkSIVuJC5qxc7RAkgoGKvaTpWZ17/Da+9zTO2z 4c8OLN+irw+TLW9/EFmUOkCSzQ5Ybws= X-Report-Abuse: Please report any abuse attempt to abuse@migadu.com and include these headers. From: Shakeel Butt To: "T.J. Mercier" Cc: Andrew Morton , Johannes Weiner , Michal Hocko , Roman Gushchin , Muchun Song , linux-mm@kvack.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH v2 3/7] memcg: reduce memory for the lruvec and memcg stats Message-ID: References: <20240427003733.3898961-1-shakeel.butt@linux.dev> <20240427003733.3898961-4-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 Mon, Apr 29, 2024 at 10:35:38AM -0700, T.J. Mercier wrote: > On Fri, Apr 26, 2024 at 5:37 PM Shakeel Butt wrote: > > [...] > > + > > +static const unsigned int memcg_stat_items[] = { > > + 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.