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 9E5B0C3F6B0 for ; Wed, 24 Aug 2022 20:20:58 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 0F034940007; Wed, 24 Aug 2022 16:20:58 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 0A0EC6B0074; Wed, 24 Aug 2022 16:20:58 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id EA96E940007; Wed, 24 Aug 2022 16:20:57 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0010.hostedemail.com [216.40.44.10]) by kanga.kvack.org (Postfix) with ESMTP id DCD316B0073 for ; Wed, 24 Aug 2022 16:20:57 -0400 (EDT) Received: from smtpin31.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay04.hostedemail.com (Postfix) with ESMTP id AE7751A0237 for ; Wed, 24 Aug 2022 20:20:57 +0000 (UTC) X-FDA: 79835604954.31.57625F3 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by imf01.hostedemail.com (Postfix) with ESMTP id 4D9EB4004F for ; Wed, 24 Aug 2022 20:20:57 +0000 (UTC) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 78E3361856; Wed, 24 Aug 2022 20:20:56 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 7151FC433D6; Wed, 24 Aug 2022 20:20:55 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linux-foundation.org; s=korg; t=1661372455; bh=kRQnWajQgE2HYeZwEoZJedDllC5u1W7kZ8WwowXaYZs=; h=Date:From:To:Cc:Subject:In-Reply-To:References:From; b=SlzzfNubdkMe2QxX9jTNJ0N2WInsKhQ16Qz3XTkrg6lUYoF5q50eiCBDoPwlj2M00 BL0H4KtHiWyD+7Jml8cfjV0Uy0Erelp1luMfxF92MQBkjj8MG9wiDXQYGyxnBlE6XR U8MYQatJJQp3B9dsgI/VIE2MXXnOloaWvpGZWUQI= Date: Wed, 24 Aug 2022 13:20:54 -0700 From: Andrew Morton To: Marcelo Tosatti Cc: atomlin@redhat.com, frederic@kernel.org, cl@linux.com, tglx@linutronix.de, mingo@kernel.org, peterz@infradead.org, pauld@redhat.com, neelx@redhat.com, oleksandr@natalenko.name, linux-kernel@vger.kernel.org, linux-mm@kvack.org Subject: Re: [PATCH v7 1/3] mm/vmstat: Use per cpu variable to track a vmstat discrepancy Message-Id: <20220824132054.54ec0472496db153223282c4@linux-foundation.org> In-Reply-To: <20220817191524.140710201@redhat.com> References: <20220817191346.287594886@redhat.com> <20220817191524.140710201@redhat.com> X-Mailer: Sylpheed 3.7.0 (GTK+ 2.24.33; x86_64-redhat-linux-gnu) Mime-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit ARC-Authentication-Results: i=1; imf01.hostedemail.com; dkim=pass header.d=linux-foundation.org header.s=korg header.b=SlzzfNub; spf=pass (imf01.hostedemail.com: domain of akpm@linux-foundation.org designates 139.178.84.217 as permitted sender) smtp.mailfrom=akpm@linux-foundation.org; dmarc=none ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1661372457; a=rsa-sha256; cv=none; b=6PPUCUoW1irs6xAfBQXDTmlZhQhJUEs8+gKw8qC+jZyl7thL1+pRdm5G8YgL4/PLx5gvxG CLSrDVukqO6w8HPG0NNtkU7Ye/ai/bg1Jf8c7incoRijiAgkH9DGDUnLRKnWACUpyJvwLk vpI6bSY/W4gf1WixVBSbIeKXAeQBTiI= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1661372457; 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=sf7GgOibjMTBXZd8ALe0ELeDNEJLMCxp5hRQr45M3vE=; b=domoEmeH9RLUKhjjvK41JeGlRBzo6xTLChFVnZmr+V/ufnRYsQWTmZwIG/LIdGWzKH53sW Fu+K012aMtFZG/UQ3EZf7CjxdReimysv3LWbTgUVhtf+9O9aToYfLUk/9InGG3vVsVusiG KmAX1koCXwSzTDwok/BmBYJGR3XuEuc= X-Rspamd-Server: rspam08 X-Rspamd-Queue-Id: 4D9EB4004F X-Rspam-User: Authentication-Results: imf01.hostedemail.com; dkim=pass header.d=linux-foundation.org header.s=korg header.b=SlzzfNub; spf=pass (imf01.hostedemail.com: domain of akpm@linux-foundation.org designates 139.178.84.217 as permitted sender) smtp.mailfrom=akpm@linux-foundation.org; dmarc=none X-Stat-Signature: rruuj1gpnfcbombznb5rgqgtmnre63ag X-HE-Tag: 1661372457-956424 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: On Wed, 17 Aug 2022 16:13:47 -0300 Marcelo Tosatti wrote: > From: Aaron Tomlin > > Add CPU-specific variable namely vmstat_dirty to indicate if > a vmstat imbalance is present for a given CPU. Therefore, at the > appropriate time, we can fold all the remaining differentials. > > This speeds up quiet_vmstat in case no per-CPU differentials exist. > > Based on > https://lore.kernel.org/lkml/20220204173554.763888172@fedora.localdomain/ > > Signed-off-by: Aaron Tomlin > Signed-off-by: Marcelo Tosatti > > --- > mm/vmstat.c | 54 ++++++++++++++++++++---------------------------------- > 1 file changed, 20 insertions(+), 34 deletions(-) > > Index: linux-2.6/mm/vmstat.c > =================================================================== > --- linux-2.6.orig/mm/vmstat.c > +++ linux-2.6/mm/vmstat.c > @@ -195,6 +195,12 @@ void fold_vm_numa_events(void) > #endif > > #ifdef CONFIG_SMP > +static DEFINE_PER_CPU_ALIGNED(bool, vmstat_dirty); > + > +static inline void mark_vmstat_dirty(void) > +{ > + this_cpu_write(vmstat_dirty, true); > +} If we're to have a helper for this then how about helpers for clearing it and reading it? Also, vmstat_mark_dirty(), vmstat_clear_dirty() and vmstat_dirty() would be better identifiers. Then those helper functions become good sites for comments explaining what's going on.