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 27F9BC5B543 for ; Tue, 10 Jun 2025 09:59:37 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 3CE586B007B; Tue, 10 Jun 2025 05:59:37 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 3582A6B0089; Tue, 10 Jun 2025 05:59:37 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 220246B008A; Tue, 10 Jun 2025 05:59:37 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0013.hostedemail.com [216.40.44.13]) by kanga.kvack.org (Postfix) with ESMTP id 013C66B007B for ; Tue, 10 Jun 2025 05:59:36 -0400 (EDT) Received: from smtpin17.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay01.hostedemail.com (Postfix) with ESMTP id 441EC1D82B3 for ; Tue, 10 Jun 2025 09:59:36 +0000 (UTC) X-FDA: 83539043952.17.7B1D7C2 Received: from mail-wm1-f54.google.com (mail-wm1-f54.google.com [209.85.128.54]) by imf15.hostedemail.com (Postfix) with ESMTP id 41E13A0008 for ; Tue, 10 Jun 2025 09:59:33 +0000 (UTC) Authentication-Results: imf15.hostedemail.com; dkim=pass header.d=suse.com header.s=google header.b=bIbhe04f; dmarc=pass (policy=quarantine) header.from=suse.com; spf=pass (imf15.hostedemail.com: domain of mhocko@suse.com designates 209.85.128.54 as permitted sender) smtp.mailfrom=mhocko@suse.com ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1749549574; a=rsa-sha256; cv=none; b=o1j21iVjJ/wT36sBujnpXp2wsdkGHbt/9DjcgylQorA98k7rm5bg/TyALX83hjCN0fL7Sa gdjwgQSTkX6NT+UAV2KFjpM6C+ouMGVV4Oq5GaoQwZg+GnvUdSfPSfRvx1QJeL5+Gm0Zfx NUj0iNXw7Kfdpyl1c54FGeq1zjebjzg= ARC-Authentication-Results: i=1; imf15.hostedemail.com; dkim=pass header.d=suse.com header.s=google header.b=bIbhe04f; dmarc=pass (policy=quarantine) header.from=suse.com; spf=pass (imf15.hostedemail.com: domain of mhocko@suse.com designates 209.85.128.54 as permitted sender) smtp.mailfrom=mhocko@suse.com ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1749549574; 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=WtZfRWe7jumYhORD8bhAM/HNKsZrd0S3kChFZwMp2GU=; b=UzDoGZlx2U1EQqiXirD6+bSpddBHsHQPe6BqNBy0M/X6pYRCnwVjVjVsCjUez+moHczHPO 0UFnFAwzJxgWqOWjUU/gdut4oHxefLl/QhCUSIETuhZPmWX7dhAOjbbvwe85BcUyOAAdWs cEmIAQG08TEJBW8ghv4OkNuWEy5KFNo= Received: by mail-wm1-f54.google.com with SMTP id 5b1f17b1804b1-450ce3a2dd5so46641575e9.3 for ; Tue, 10 Jun 2025 02:59:33 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.com; s=google; t=1749549572; x=1750154372; darn=kvack.org; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:from:date:from:to:cc:subject:date:message-id:reply-to; bh=WtZfRWe7jumYhORD8bhAM/HNKsZrd0S3kChFZwMp2GU=; b=bIbhe04fSbF6c1ZnGTOSQFooxcsIPcZZnIAbBNicACA5tjTdSeMBZz9szQp96iR3bc sK0JbZ9fK8THbrRvq77rA8/1oBQfpo7ihwg26HelIrcYEHjp9z3/NULI2M2RsbsPWueU EEtNCO01r8YgAe6SU5MT2LblZrt8vGzpEhmS/U4a2XwJ1YNoPE879Hzjy7cp6lcKe8HT yJq/nJgQxh+ZLRiE9eCk733BS2xvmfhUrqWCEHzy1E+/07l76RtH7iYxZ9FSVYUxlXzx f+2UlFM92pZQ1zRUkT6H6WEwcVXNgYYQHBtKdlGsrZzdnCo/ZarqkI7ji7sZIq7b6oEo Fq5g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1749549572; x=1750154372; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:from:date:x-gm-message-state:from:to:cc:subject:date :message-id:reply-to; bh=WtZfRWe7jumYhORD8bhAM/HNKsZrd0S3kChFZwMp2GU=; b=MyxFpNDy8wl4alZAmuQeyD6ajr81nsmv7CammGtWY+03svwfy+bgDsL+m516om2VCg LehXQJrixA92RPWu8TQAa60YHrsb4NfCT7d7xWbHNnqPK8pJQEYmRZO+zvBV9ZxtahuR nK+weiYvgZn07V8Wy26CSjSiMwRxDWysPU336xdnNaxIXGwp3JIq+asyJldLOYK4Qrhd TiK1ZOIPbgY4oGdpu1bwjwLq6j4RBlm82EKF6i7Vam/Ji0qdp1cCGz6mXbXMbl9zrew6 VgXSLqUVWSOaN0SlmCnfl6PI34KiJdk2i4USBTnX9HB+12jF4fl5+uz38B7KhpjUf7b6 XLcw== X-Forwarded-Encrypted: i=1; AJvYcCXU+gKGxM2O8vmX4LHW/FRambb6CakeorlrIjwQCV2sP3uyczAKr8JTvl71HMh7SM03p7XSRPufLA==@kvack.org X-Gm-Message-State: AOJu0YwZEsR/Qvu3bQOH0VIyBTDWiWC4f5umymopcZ8QUmYorHDeFKYN Xry2W6wxTNswAKhpazUtd/tUyEbk8jxKBrTJlWsOME3zP2gBKLPMmxu9I/a+laPibOs= X-Gm-Gg: ASbGncvA7tVp/YYisxY58cCC8CxajpV2Jp79psf7n1eZm5k1Ciz3G+HVU05m42X/WxW DCv98FOjyKXvCmFOQKYkXRlswxbYMr71jDoKdkS5yeVy5MnghgIF73KKbOy1w+1hL8zN15ZrpqQ 4Ubh0QrMwVrqcVNu14lIygRFk3xrpAl8lS2b5ym6jo8gYCXXIxswvx0/5d78n+6O/9w1nxHbtIP 2v/o7/a5+MrmsEE4x4OJTRM80FNy76mFUFvMrLXrYpz83ohIEk2zW+wi4jiKctHXphf7jUSulp4 fA3BvNMoGixvxSh0+Bk6XV7v7IUJNSItj5BDbqODkAfJatlW4HpwH9FpqphQUY9LeEDyxNiklmz w0ACoVS4Stw== X-Google-Smtp-Source: AGHT+IGl3y7tGpOe1smwbVjVe6Qrr+nVtzasTtqSpTPNV7IeliyjEvSIX1HfFN4Q5jCM9QnyAR7OyQ== X-Received: by 2002:a05:600c:37c9:b0:43d:1b95:6d0e with SMTP id 5b1f17b1804b1-452013d7e24mr138183715e9.23.1749549572531; Tue, 10 Jun 2025 02:59:32 -0700 (PDT) Received: from localhost (109-81-91-146.rct.o2.cz. [109.81.91.146]) by smtp.gmail.com with UTF8SMTPSA id ffacd0b85a97d-3a53229de7csm12006149f8f.14.2025.06.10.02.59.31 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 10 Jun 2025 02:59:32 -0700 (PDT) Date: Tue, 10 Jun 2025 11:59:31 +0200 From: Michal Hocko To: Shakeel Butt Cc: Andrew Morton , Vlastimil Babka , "Ritesh Harjani (IBM)" , Baolin Wang , david@redhat.com, lorenzo.stoakes@oracle.com, Liam.Howlett@oracle.com, rppt@kernel.org, surenb@google.com, donettom@linux.ibm.com, aboorvad@linux.ibm.com, sj@kernel.org, linux-mm@kvack.org, linux-fsdevel@vger.kernel.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH v2] mm: fix the inaccurate memory statistics issue for users Message-ID: References: <87bjqx4h82.fsf@gmail.com> <890b825e-b3b1-4d32-83ec-662495e35023@linux.alibaba.com> <87a56h48ow.fsf@gmail.com> <4c113d58-c858-4ef8-a7f1-bae05c293edf@suse.cz> <06d9981e-4a4a-4b99-9418-9dec0a3420e8@suse.cz> <20250609171758.afc946b81451e1ad5a8ce027@linux-foundation.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: X-Rspamd-Server: rspam08 X-Rspamd-Queue-Id: 41E13A0008 X-Stat-Signature: xk5w8hjey3axn3e585eitiizzwty1kfp X-Rspam-User: X-HE-Tag: 1749549573-395747 X-HE-Meta: U2FsdGVkX1/EGYYkzrzEGMdEFaHjCwhm7a19cG316DXvuv3P335DW9pzxU802JCKPZoeWNXnt4YfRAc7tkMpFfoj3/upkzKierka92KoPpsbG/9uTj+vWPyoHK2kFksB9V3qIBj3z78mu5y8erfz+QRdz8DwnujLURcDnr319PdJx+a7muEqrxnkCpASZ3lnueKOrmBIs/K5MSvCyYcdaoW0S0G+eNdp8wpCa3uPFnijHWInDVg6wNZ5azYOhSNss3OuE5aAHFefsZRCLQzE6V/fIgljlF8ZYnwYlQ8AqJkCzy2ySU6vYVEAqAxmXEnFlegiPCVS4PBqCsansg/dNoJwF+JVmVob8QUBVRQW59Qlc1U6WC0TWMx3AAXdHemHod78plkkDA0xPKOjySrm+qIF+o+/RB8LPl9BVWkW5wr9giAetvBv8mWW4U6CKxNRXV1x0rIS4qVerkg50LAMFsZyiELdruCOYZR9d4MmVrDIOnuiA1hf8uMjDjsFlYxfET08tRSQeUl7EymzxdjsgpLTUaHDZSCMUa/mraznZPdSo+hEvkDFfRA62YgveX8iqxk7SL6TTQmgrCAdtISRZM2T92lcSivUe9nnWsXYjHQEKDFeFBRe2l1mobXGGp05gVhC3CcPoeLak6BDLQbvJreaJPuLyqmOCqpcdCkW/ouaaSK4tuNlmRPGaURPBrOJgRrJz6gOzTpInrw6hzswinsBpxeAjvpDd6gKPqdhmfsH/xqw/yajjETeGw1Vk00wdvHWHcUfeYdHKv2A9PATnlRqnM9HHtXoABjcZg0s7QOuf8ZfWlLR6Ub2BDWZ4xMQyZgwbDXkdHbKJLuBw++3mNv9SGH4hGEHOrSg/l4eBVsx9mS1nykw4UliF185ULtzaD7EllfLjiFjeXB/Hqtc0piR8snck6GYiJGgGhF+ustnAtvfOvInmnDeWpjAb2dDj6lA7YdmeOKMW6TNw4t ejb5XMvy NucrPhjWDHPXYBAtOzIdZsLArAEU0hSQdIdgSVspfijFhs3s1xYqsWDx0Syl2RbTYUmPknsexwTuH/wIMCpOMSHwuzY+Lt3RkMEP5524xn+aozR4GNJV+nCqRaWhSpbcN3kFw39VJzwLStDShAaha//yNu9j0dkcLRYGtSN6C8ej8tqcijNeEIZOYJxOFzxNPy9aKHweFGRQseMs3wYwm7bdH1gox/XslDGiqa7z0wX4tmK5wPr2s0IdOBIjH80E8ZYIJRwOgdaimtfdywJF2KTpSAIKiaOIF3sCqSRXmAMPUyVfW6cI1alQjH/T+eI6tiVgXw27Ic/9taQDssmPypfXZ51AOqxlE8zMnaAt6n1Tk6L3/MFwdlfS/Eo74fAb6rhDQhMa19IWzMlEDK0zxGerZY+NKtV3+fAXu 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 Mon 09-06-25 17:45:05, Shakeel Butt wrote: > On Mon, Jun 09, 2025 at 05:17:58PM -0700, Andrew Morton wrote: > > On Mon, 9 Jun 2025 10:56:46 +0200 Vlastimil Babka wrote: > > > > > On 6/9/25 10:52 AM, Vlastimil Babka wrote: > > > > On 6/9/25 10:31 AM, Ritesh Harjani (IBM) wrote: > > > >> Baolin Wang writes: > > > >> > > > >>> On 2025/6/9 15:35, Michal Hocko wrote: > > > >>>> On Mon 09-06-25 10:57:41, Ritesh Harjani wrote: > > > >>>>> > > > >>>>> Any reason why we dropped the Fixes tag? I see there were a series of > > > >>>>> discussion on v1 and it got concluded that the fix was correct, then why > > > >>>>> drop the fixes tag? > > > >>>> > > > >>>> This seems more like an improvement than a bug fix. > > > >>> > > > >>> Yes. I don't have a strong opinion on this, but we (Alibaba) will > > > >>> backport it manually, > > > >>> > > > >>> because some of user-space monitoring tools depend > > > >>> on these statistics. > > > >> > > > >> That sounds like a regression then, isn't it? > > > > > > > > Hm if counters were accurate before f1a7941243c1 and not afterwards, and > > > > this is making them accurate again, and some userspace depends on it, > > > > then Fixes: and stable is probably warranted then. If this was just a > > > > perf improvement, then not. But AFAIU f1a7941243c1 was the perf > > > > improvement... > > > > > > Dang, should have re-read the commit log of f1a7941243c1 first. It seems > > > like the error margin due to batching existed also before f1a7941243c1. > > > > > > " This patch converts the rss_stats into percpu_counter to convert the > > > error margin from (nr_threads * 64) to approximately (nr_cpus ^ 2)." > > > > > > so if on some systems this means worse margin than before, the above > > > "if" chain of thought might still hold. > > > > f1a7941243c1 seems like a good enough place to tell -stable > > maintainers where to insert the patch (why does this sound rude). > > > > The patch is simple enough. I'll add fixes:f1a7941243c1 and cc:stable > > and, as the problem has been there for years, I'll leave the patch in > > mm-unstable so it will eventually get into LTS, in a well tested state. > > One thing f1a7941243c1 noted was that the percpu counter conversion > enabled us to get more accurate stats with some cpu cost and in this > patch Baolin has shown that the cpu cost of accurate stats is > reasonable, so seems safe for stable backport. Also it seems like > multiple users are impacted by this issue, so I am fine with stable > backport. Fair point. -- Michal Hocko SUSE Labs