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 B4F96C61CE8 for ; Tue, 10 Jun 2025 00:45:32 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 322876B007B; Mon, 9 Jun 2025 20:45:32 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 2D59F6B0088; Mon, 9 Jun 2025 20:45:32 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 1EC666B0089; Mon, 9 Jun 2025 20:45:32 -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 F423B6B007B for ; Mon, 9 Jun 2025 20:45:31 -0400 (EDT) Received: from smtpin17.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay03.hostedemail.com (Postfix) with ESMTP id 9B118BB59C for ; Tue, 10 Jun 2025 00:45:31 +0000 (UTC) X-FDA: 83537647662.17.5E0479C Received: from out-174.mta1.migadu.com (out-174.mta1.migadu.com [95.215.58.174]) by imf25.hostedemail.com (Postfix) with ESMTP id CC9B6A0002 for ; Tue, 10 Jun 2025 00:45:29 +0000 (UTC) Authentication-Results: imf25.hostedemail.com; dkim=pass header.d=linux.dev header.s=key1 header.b=ZJzaQ8X1; spf=pass (imf25.hostedemail.com: domain of shakeel.butt@linux.dev designates 95.215.58.174 as permitted sender) smtp.mailfrom=shakeel.butt@linux.dev; dmarc=pass (policy=none) header.from=linux.dev ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1749516330; 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=K20VVd+wIYPeI78t96QglGZe8BTe3O5cy4tZdboIubk=; b=TNreCeCQUzKDZ0DXtBsi04XmaknEiaPM+Yp9Jscn2C9Rnm9zTGiM96/nsz/RK4xy57wdDU f8oeXFFXSbENXXTYBykARaWoLy4qGyIvYm3TKRw3SBUIdPNWueyISd2IhvL6alhFJSLAmg IGnJO0GH3HHbcO2JB7Gohtn/bNCRvb8= ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1749516330; a=rsa-sha256; cv=none; b=py3sVXJtze4B7BzYncnjNmUlIkULhPJLQbKOSq5tpr8VUYIQrKdpEqR7hlpD2hr8cM7fOF RiJTxjUurlv5HzGZkYNIqEE8dpNcG8K2fU34ZkXlZShiK4O2bBhqFl0eTv6Wt4cpQqjBsL nVswOLojqNbeCR6eVejKwGerG9HE6JQ= ARC-Authentication-Results: i=1; imf25.hostedemail.com; dkim=pass header.d=linux.dev header.s=key1 header.b=ZJzaQ8X1; spf=pass (imf25.hostedemail.com: domain of shakeel.butt@linux.dev designates 95.215.58.174 as permitted sender) smtp.mailfrom=shakeel.butt@linux.dev; dmarc=pass (policy=none) header.from=linux.dev Date: Mon, 9 Jun 2025 17:45:05 -0700 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linux.dev; s=key1; t=1749516324; 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: in-reply-to:in-reply-to:references:references; bh=K20VVd+wIYPeI78t96QglGZe8BTe3O5cy4tZdboIubk=; b=ZJzaQ8X14i+j9T2bYFvj4dh4I3oEb0hhtA7D3jE2PTPcmQpV/adBveWSKgzgpcItHAc3Dp d6euJ28IP6Ii6ECu29b4DBhsg/UNjSdaAYeuv5JYRoRJt+54pNav0UQnKFa1vWHr9tHVfb BtTnDjf5giI3R1YNuz1adnCV2feTGx0= X-Report-Abuse: Please report any abuse attempt to abuse@migadu.com and include these headers. From: Shakeel Butt To: Andrew Morton Cc: Vlastimil Babka , "Ritesh Harjani (IBM)" , Baolin Wang , Michal Hocko , 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: <20250609171758.afc946b81451e1ad5a8ce027@linux-foundation.org> X-Migadu-Flow: FLOW_OUT X-Rspamd-Server: rspam06 X-Rspamd-Queue-Id: CC9B6A0002 X-Stat-Signature: 3cegdkj3xnrad4bf73eyky7wxf5jg88g X-Rspam-User: X-HE-Tag: 1749516329-835779 X-HE-Meta: U2FsdGVkX1/m0M7BNrmKQToY26eYlccB2BBgxArT2m+MdF5ef6I88h5yXXsqx1iDG98S7dVri1EUXg5tRBi0dajEYN5J9wKDZAl7hbKnnbeD89i6h1PpH2lY0lJqGdjqBKGs1sf+k/GDGgsrWw8WpP9XhY1RJAhFmLV6pRfskzEFrgCn7Caxf5CHiCgndW92GZPEGl5G9EAL2ybg4RDeeSJi2KDVC8WNBCHRjjLXAFjr5C5ZO+AO8rkAliJ+im1Pq62jmbIIC9HmGbmafRkHkKJ6zj3sJbCBCh6keCVQoSP/o0HrfIor4uYYWSMyRyYChUg9u6Ckk8gCEH+6nwvmzy4tqAq2ELU6SrdTvSUaA0JtLImHaLkqI3oChumzfbPlt4k8lyEOc13QrvzkllJkpuS+hu/C0AuR0Zuni69QiPVkZer91jVHKPxM3dlkTAqF6Qx+DvGvsSu1zOvMdFJG3+JyEDCT5zZEqKIw6z6tWKjbJ+VdwbvdJWs8i7oEfVYWonklIArcn0LjGeiBqXYObKKGUUQTOX7wAjlxjS4u116y0AO0odqpeZ3JVnoc2Z6AaR1h0HFbUoK2KXoFVc7pWxbfKlNhreV5+Ljor1cDAVXHK6XfPT3vnzf8RPODo4+g0CEKiXhiDUapCFmYwWRqyfeT/s2K5pzepAAHygbcTO/y/Nf90/Qgaazd96xrkQ8fSJOU9Zap99qaNK5C4GmMhr7MCeF+4tk7KnKmYFHRpD4r9PvZuJkVqKVkFuAasxQ3RCv/0Zgc6c3x65beCNbU6GYmbLVsdGfQc2Wg5VtQ8FbmM4ANahIxQ8ewH5CWHz6yoEwnBn8ilecChjCA59/30X582MElSy3aM+t8URoGF431in7NX9dxrE4XeIvfXdpvx4hpxEW4h04loHvsWEzhApxg6MMCjJTh2blWUHZuEa+GxGfva+bfvBr8trRhFrwJNBZFy2ctD8BFyOV98Sr 2bejQbGl zXITTXyQDHvEIwL99QHoYbTcO2l387yqMOIPvYMFkQXM5Q6F527OdU+ic3pcmOlHBX3jMvQ3j6/XJJ53JYg+/IkHAGQ8oDoioi249XDZ2/qYBBXZagqdk/Qoi/nRP2GMx2CfYiM44hyFYwlC9t95DUTJiiBfdAgNpoeDYdAKIwNsjd+kVYs8Key7NBvE/6LRi7rmaERRyOGYkviOzvRIuMQho8+MDHOJlIpEqXZwvgq0vzqI3tbeQq21F/+CVYKupa0Gl3vrk8uSK4vVjKUlUyAqiTmbnN8IZQbIwoV1uwOSHeDqyxMAv1gNpJg== 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, 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.