From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by smtp.lore.kernel.org (Postfix) with ESMTP id 650C7C5B543 for ; Thu, 5 Jun 2025 11:54:09 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id EF4586B00A3; Thu, 5 Jun 2025 07:54:08 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id ECA506B00A4; Thu, 5 Jun 2025 07:54:08 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id DE0866B04B8; Thu, 5 Jun 2025 07:54:08 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0012.hostedemail.com [216.40.44.12]) by kanga.kvack.org (Postfix) with ESMTP id BAB416B00A3 for ; Thu, 5 Jun 2025 07:54:08 -0400 (EDT) Received: from smtpin14.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay05.hostedemail.com (Postfix) with ESMTP id 3CACC5AD8B for ; Thu, 5 Jun 2025 11:54:08 +0000 (UTC) X-FDA: 83521188576.14.57E0F6F Received: from mgamail.intel.com (mgamail.intel.com [198.175.65.19]) by imf11.hostedemail.com (Postfix) with ESMTP id 6748840005 for ; Thu, 5 Jun 2025 11:54:05 +0000 (UTC) Authentication-Results: imf11.hostedemail.com; dkim=pass header.d=intel.com header.s=Intel header.b=CYV2yBh+; spf=none (imf11.hostedemail.com: domain of kirill.shutemov@linux.intel.com has no SPF policy when checking 198.175.65.19) smtp.mailfrom=kirill.shutemov@linux.intel.com; dmarc=pass (policy=none) header.from=intel.com ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1749124446; h=from:from:sender: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: in-reply-to:in-reply-to:references:references:dkim-signature; bh=vTCGkBWNa9SpCizPF+0iT3ngCdTaWRNC5NbMqG5ieXQ=; b=18hpm9gu3wJTRwZrOGnlZYuBEOQjrPMT1Z40xx5OZyhCtq4QveVtysDw3lhefd1Degk9uu YPo3lceSJ6r3PbYFrX4xGWl9YacU91VuP2+f+R6KY1Z1RKvD073AUKZj4sAx32JP7rYV1h fznjHnAx1oB+oj9343goZjBnWU/DPRU= ARC-Authentication-Results: i=1; imf11.hostedemail.com; dkim=pass header.d=intel.com header.s=Intel header.b=CYV2yBh+; spf=none (imf11.hostedemail.com: domain of kirill.shutemov@linux.intel.com has no SPF policy when checking 198.175.65.19) smtp.mailfrom=kirill.shutemov@linux.intel.com; dmarc=pass (policy=none) header.from=intel.com ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1749124446; a=rsa-sha256; cv=none; b=GSkuo1J8cSxF2qe59pxE6L0bpGjvCQZp0dTTi5VltP2WWw8v2nFTBp9sKtamQzYTRe5VZC xIReeXI4vX0kAebqnptHeTYSU5CmZrbCIYjM4/vVf8s7QYMYc7BazyvmR3zoRYhQGjEKLC yTTd6IrN+CbLk7mTdWJ21C/1d/O4QPA= DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1749124445; x=1780660445; h=date:from:to:cc:subject:message-id:references: mime-version:in-reply-to; bh=EYKhhN5+DbG+XDi2bwEn1W6G5NA1x/Wu782IrUgh8lg=; b=CYV2yBh+KS1C4YWWz3Kg6/Mcx0dumI6TUHRpGvPXU/3hLqrMQEPENsWU b7bnmKgN8c9Y3jBohRqc/jmooIK/KIf1tUINJJ4KJlscUS0bVJAm4bnJz vZAUP8UoZUXgq1ONjp6OVkABRZCsIYZm5D087KPf8Ha+XjdMURLDvUSB5 yXrodamo8CTh8toRPlreh6kA3Fv4LA18BIQ6uF+dAlYQ8Qhp1jkIchSxQ PEm9CaBUCMdt6sHqPOoIl1t/+k95nIjnTsQSPZKjPFkhpNDi9743B0dvo EanUbaY5NBukfFpKdo63mMSeSjZKg3XCIZ0kZdJu4KkMqP5gMla8HrKyg Q==; X-CSE-ConnectionGUID: 2JU5hy4tSV6cFqvo4tOyOw== X-CSE-MsgGUID: GLrUNMFwTSOPj+dsP53njg== X-IronPort-AV: E=McAfee;i="6800,10657,11454"; a="51110008" X-IronPort-AV: E=Sophos;i="6.16,211,1744095600"; d="scan'208";a="51110008" Received: from orviesa006.jf.intel.com ([10.64.159.146]) by orvoesa111.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 05 Jun 2025 04:54:04 -0700 X-CSE-ConnectionGUID: aSgzIK4bQHyJ8u06am4XBw== X-CSE-MsgGUID: E5HXAx2/T2qZ79fs7/Lg9w== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="6.16,211,1744095600"; d="scan'208";a="145379925" Received: from black.fi.intel.com ([10.237.72.28]) by orviesa006.jf.intel.com with ESMTP; 05 Jun 2025 04:54:01 -0700 Received: by black.fi.intel.com (Postfix, from userid 1000) id 360FF19D; Thu, 05 Jun 2025 14:53:59 +0300 (EEST) Date: Thu, 5 Jun 2025 14:53:59 +0300 From: "Kirill A. Shutemov" To: Vlastimil Babka Cc: Andrew Morton , David Hildenbrand , lorenzo.stoakes@oracle.com, Liam.Howlett@oracle.com, rppt@kernel.org, surenb@google.com, mhocko@suse.com, hannes@cmpxchg.org, shakeel.butt@linux.dev, muchun.song@linux.dev, linux-mm@kvack.org, linux-kernel@vger.kernel.org, Randy Dunlap , Konstantin Khlebnikov Subject: Re: [PATCH] mm/vmstat: Fix build with MEMCG=y and VM_EVENT_COUNTERS=n Message-ID: <7lakc6hxbimvkgakpocj3aa65sdhmskm5p6hlurbwzyps33gfb@2z2eoz253hs4> References: <20250604095111.533783-1-kirill.shutemov@linux.intel.com> <6fffd2fe-0cee-405f-af78-b57b5e5d02e8@suse.cz> <20250604142043.bdfdf4f9a6a6cbb57946f1a5@linux-foundation.org> <03c2b01b-18f5-4015-a19b-79b8af656697@suse.cz> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <03c2b01b-18f5-4015-a19b-79b8af656697@suse.cz> X-Rspamd-Server: rspam01 X-Rspamd-Queue-Id: 6748840005 X-Stat-Signature: fcydq9cf4z8woqdi7tr5uf1xffowz38g X-Rspam-User: X-HE-Tag: 1749124445-839370 X-HE-Meta: U2FsdGVkX18C3nsw63ZMgwFuEhrGe8OalgGYoOT63aoKyB+IiWYJF2zju9HvbT2ZUzFBbH61zxhtd4x5Sz93rG4wZLFKbsECXUS1c4mr2XZocgoTBYv4mA2pmR5GK5LH4dtK6sLqaHIWMEHK9dUVWkyzoRWVqGXvLd6ACK05cCQnNrxtahgSkmeGjIcX+0RCXqvpC32as2th01HWlvME0LJVB/0zDOHL2/h0Dcutk3FChUPsPQ0xjt79EXmvylURyJhuctLxmUhcqNDrEhQs33rSjCh6ylT+H7dx6Qm1pdD1kaJd6NQ9tIByOJcTzDbZTYgNyS2TnS7hRNDtcDsvw4/W+2oFQDG5VFR+67Wy70RNA3uiG7/4iFqjwQ1/Jwx44rAGkm1uNIGc83CSuGafl8H0w9FePj4iUI2z/4wpqd1eX9nMy2Ml0ETA+pPPSlOh6xnDlIqWuAgiNoK4nS7sJPkyFzMozF8eAD5arOG8IUEObAzeKdwtsVJuTlOSepeGR7dXLgbt37yhS36TS51MbCTIXr1U1jmqe2Z9bkDRXmSuYb2RLU51I5TdOe9zHiSCU8xU9xRn7cq35MD0pB+J8lW+f8JD7i5lX9ACWokqK+tLN1Aje+7oBvjXLJsFDZNe0eapRMGaOnt3AvLRVYERSJ0p79dD1crRL9gN0kVZphbsMV6n9Y7E1y5ZwUfq+cktrM+ICmI/E2mxJKYDVmQnxi66TmT7RwE0W23YchGnSxnB3G0tgSGjvr5q4WbaZexkMYQzHKe4vjTtdEPc4cL9llmCnobSEY1+v+nQoAh9ZjSMiY3KGL/R6E2fd5eexNgodMzZ8T3XXBAciAd8C9RBzauFytde11LICQjuczCEAKCcuRxKiSsQcMhCMUEPs+X5A41a71oWlZPMGtqplkgqF3P0w4sNd3WoKdqRMv5MXdWAJr9renLQjnepMi+GZwHOTRRvHTqLQ9dR4eNUbff 6ucFxhOk 0wxogUHfpknWiYsPXeYcOF4AtZwEMQmdEkKLpe/1TLdkIDW9pICjKt5kV0wblr8qHzByhFvgm+e+BvqIaZPZlQGCbk2XGYjGwpxJ/NUked68AifOhXMTGVPebXeSTv5ARawxYL5CN+2JoSSPSIAWFPo1HwJaH9uCvKobRxUPnxIZWgI6hZUGz5R660Sc0wXMuqE1dCwhlgk8N4+x6DZ94+tPtPVKnvwGFFiNrri9bT7biOgzu1ZrxFmZwdgBqJbJGq3jlnRXL3vA0SN6CQfrOOdineRCwfHZowJ7sV+yKEqe76PRFrlsYp1XbBy9jmrBer2ZY X-Bogosity: Ham, tests=bogofilter, spamicity=0.000000, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: List-Subscribe: List-Unsubscribe: On Thu, Jun 05, 2025 at 08:19:28AM +0200, Vlastimil Babka wrote: > On 6/4/25 23:20, Andrew Morton wrote: > > On Wed, 4 Jun 2025 11:56:42 +0200 Vlastimil Babka wrote: > > > >> > There is no need to backport this fix to stable trees. Without the > >> > strict BUILD_BUG_ON(), the issue is not harmful. The elements in > >> > question would only be read by the memcg code, not by /proc/vmstat. > >> > > >> > Signed-off-by: Kirill A. Shutemov > >> > Reported-by: Randy Dunlap > >> > Fixes: ebc5d83d0443 ("mm/memcontrol: use vmstat names for printing statistics") > >> > >> Well in that case I think we should put Fixes: to the BUILD_BUG_ON() change. > >> And if it's not yet a stable sha1, squash that together with this? > >> It doesn't seem ebc5d83d0443 alone needs this fix. > > > > I shuffled things around. > > > > I moved "mm: strictly check vmstat_text array size" from mm-hotfixes > > and back into mm-new for the next cycle. > > > > I reworked "mm/vmstat: fix build with MEMCG=y and VM_EVENT_COUNTERS=n" > > so it precedes "mm: strictly check vmstat_text array size". > > > > I reworked "mm/vmstat: utilize designated initializers for the > > vmstat_text array" so it comes last. > > > > > > So the applying order is now > > I checked and in general it looks good, except a nit below. > > > mm-hotfixes: > > mm-fix-vmstat-after-removing-nr_bounce.patch > > > > mm-new: > > mm-vmstat-fix-build-with-memcg=y-and-vm_event_counters=n.patch > > mm-strictly-check-vmstat_text-array-size.patch > > The changelogs of these two don't reflect the new ordering though, maybe > Kirill can provide updated ones? Maybe something like this, for the first patch? mm/vmstat: Make MEMCG select VM_EVENT_COUNTERS The vmstat_text array contains labels for counters displayed in /proc/vmstat. It is important to keep the labels in sync with the counters. There is a BUILD_BUG_ON() check in vmstat_start() that ensures the size of the vmstat_text is not smaller than VM_EVENT_COUNTERS. This helps to catch cases where a new counter is added but the label is not. However, it does not help if a counter is removed but the label remains. It would be nice to make the BUILD_BUG_ON() check more strict to catch such cases. However, when compiling with MEMCG enabled but VM_EVENT_COUNTERS disabled, the vmstat_text array is larger than NR_VMSTAT_ITEMS. This issue arises because some elements of the vmstat_text array are present when either MEMCG or VM_EVENT_COUNTERS is enabled, but NR_VMSTAT_ITEMS only accounts for these elements if VM_EVENT_COUNTERS is enabled. Instead of adjusting the NR_VMSTAT_ITEMS definition to account for MEMCG, make MEMCG select VM_EVENT_COUNTERS. VM_EVENT_COUNTERS is enabled in most configurations anyway. -- Kiryl Shutsemau / Kirill A. Shutemov