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 ED012C5B552 for ; Tue, 10 Jun 2025 00:18:03 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 2EED86B007B; Mon, 9 Jun 2025 20:18:03 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 2A10E6B0088; Mon, 9 Jun 2025 20:18:03 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 1B61D6B0089; Mon, 9 Jun 2025 20:18:03 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0015.hostedemail.com [216.40.44.15]) by kanga.kvack.org (Postfix) with ESMTP id F116E6B007B for ; Mon, 9 Jun 2025 20:18:02 -0400 (EDT) Received: from smtpin12.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay10.hostedemail.com (Postfix) with ESMTP id 7BFF2C06C3 for ; Tue, 10 Jun 2025 00:18:02 +0000 (UTC) X-FDA: 83537578404.12.C9ECE07 Received: from tor.source.kernel.org (tor.source.kernel.org [172.105.4.254]) by imf05.hostedemail.com (Postfix) with ESMTP id 04F7510000A for ; Tue, 10 Jun 2025 00:18:00 +0000 (UTC) Authentication-Results: imf05.hostedemail.com; dkim=pass header.d=linux-foundation.org header.s=korg header.b=QaHON5fU; spf=pass (imf05.hostedemail.com: domain of akpm@linux-foundation.org designates 172.105.4.254 as permitted sender) smtp.mailfrom=akpm@linux-foundation.org; dmarc=none ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1749514681; 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:content-transfer-encoding: in-reply-to:in-reply-to:references:references:dkim-signature; bh=fHPz+4PLrQdP7O0FA/7F71XviJvMcvtzg515NCQGQFM=; b=BPYjhLSazxs0aTUj+HO9Z4vm0FUb45Jwk9DPbddeMA3zlb4279Xvwwlq0FYxbxh0+AOTGg 840pDDZyR1o8DJZpQ0Q12lwNUCL3x0LOq64zcxZe3n9G5afDXi2OW7yOwHThEsv3Ltls9Z QbViwUHMBdOpphpccDLyym3IX37GgUU= ARC-Authentication-Results: i=1; imf05.hostedemail.com; dkim=pass header.d=linux-foundation.org header.s=korg header.b=QaHON5fU; spf=pass (imf05.hostedemail.com: domain of akpm@linux-foundation.org designates 172.105.4.254 as permitted sender) smtp.mailfrom=akpm@linux-foundation.org; dmarc=none ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1749514681; a=rsa-sha256; cv=none; b=bjP0zFrxbz0E1k1GLzD7wuFz9safHYILLkF852LZN6yE4fk/Jkj3ev1xS3h4NYElrmm7Du QCGCTUcksbEG8zQ8dDGLZNufe0tGzeaydXrj+IhmRc00KdyakhTpeRsyNOJ7wgpGveiKfo yu1N9qFDBdN6X6aAKxW91bZ5U9mpaYQ= Received: from smtp.kernel.org (transwarp.subspace.kernel.org [100.75.92.58]) by tor.source.kernel.org (Postfix) with ESMTP id 03656629E1; Tue, 10 Jun 2025 00:18:00 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 2BDBEC4CEEB; Tue, 10 Jun 2025 00:17:59 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linux-foundation.org; s=korg; t=1749514679; bh=otKscOGsiwswJAP2raTv6afdx7wYswde19W4gMqQ4qw=; h=Date:From:To:Cc:Subject:In-Reply-To:References:From; b=QaHON5fU8ZUwLLicgsjDySztS0Qr9fDJet8az4Kqx27A+rUQhPyaEX26oVuy/DOhE BwKCfrYiz5+IpbTqKVW4QoeMr8zmTm+RAr6I68IuFLThnS0Zr745A9tVfzhqm4njGE XF0hOptAcc8kKvM8y8fve8y/73P0Z3cNTKxjRnP4= Date: Mon, 9 Jun 2025 17:17:58 -0700 From: Andrew Morton To: Vlastimil Babka Cc: "Ritesh Harjani (IBM)" , Baolin Wang , Michal Hocko , david@redhat.com, shakeel.butt@linux.dev, 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: <20250609171758.afc946b81451e1ad5a8ce027@linux-foundation.org> In-Reply-To: <06d9981e-4a4a-4b99-9418-9dec0a3420e8@suse.cz> 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> X-Mailer: Sylpheed 3.8.0beta1 (GTK+ 2.24.33; x86_64-pc-linux-gnu) Mime-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit X-Rspamd-Server: rspam03 X-Rspamd-Queue-Id: 04F7510000A X-Stat-Signature: n3w551zoz1qckchezycb3i3a7jnynujr X-Rspam-User: X-HE-Tag: 1749514680-380107 X-HE-Meta: U2FsdGVkX19A/kRg+zFFvL2xbDMp1U7SNyAHfm23ZPPiw2o8yD5+J0gaXSow6uGxyI9qIELqAweZKjYOZZ1aA3sxDhkBmL1FstE7/l8pb2BtceQEK3IyWtzACjTAgdaV/1zrY1I8SCk//yKFgg9zA76YVEbzSlYUG6HYO8O0Pb2anSzNi2YG/K9usCbkD9OLM+zMPNpeNVUZ77akA/GCAwM4i93XB/uQ+/dBT+IvCyhpeXAvgjawQhPiSTIIa3kY2XNyD9aKpz9ypt/d+yq98Xp2Q2TdEiO22jVPFCm5eI+WgoxF1tuILEHwvljCWLPILyCxuV5Jc8Cgke3S64RUiKzjzqI2lAaOhfgzikkq5sGGR7gK6l6hYzXnN1wqy4Tm+jPDDUdqJ35U6GmuBSTcHM0TofuE6BIO9EG2QdpP4/qpfuxJOGYyzV55YzrhNsXsxzXSjK6SzdGY1IpGW/YNtqUM/R1vJMiM1ZSTQltpy9saRVZali/8/vlIDlZsqT08+6APrXDLhEFYcOiHSfqd9NG430RkQJ8i+FzLPLMgu0unpknl/+RV1b7ikUTO3mNFPdCO0RsYF2R3NJwvflggRmPuIxw0knoHrByUrui+BJBVqDPgHqdDDetOnmu1nOCf85p+roCoJhPa0cbSDYDjf86NPtoYxI8E4Jh7OrXjzGkWjlLlZt3gqMzrI1PBvXE/CTB9kJwuNByPNmLvmqJQrW0zK2BZNMCuXvP8CsDS27QgXA/yQP4yMO1ysEQyf4TMIOozA2qq9BXDSqG6UdiKcDBoH6ZrxbSEdXJahhkCnx6qWIQGldC89UkcEuzYRRda3+YKKHlqfH9mXyLZc19feFP40+TbUeJg2TYBJ3KgEHiC1nEDK4M1ZoWEYQAp1/SlBpsSmdmG2eAYuR0kMbF5KOgl0DYXli0TF/UaYNF6gQbdX+DxfgVDbSCMbrz3zQOmvMESE7vCkjzS7ZpT9by 9RU+Pl/0 tK5MbYJO3DvZYqc3MnU0wXbj55Q== 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, 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.