Received: by 2002:a05:6358:45e:b0:b5:b6eb:e1f9 with SMTP id 30csp3040rwe; Wed, 24 Aug 2022 14:51:30 -0700 (PDT) X-Google-Smtp-Source: AA6agR6wW+oGrOmsi4tpVeDAsR8ERRe5n6UPW5EyCmvpNuVPv2Z2WEIneu+68gxay+cSvyrs/UiB X-Received: by 2002:a17:907:6297:b0:72f:9aad:fcb with SMTP id nd23-20020a170907629700b0072f9aad0fcbmr558268ejc.161.1661377889959; Wed, 24 Aug 2022 14:51:29 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1661377889; cv=none; d=google.com; s=arc-20160816; b=bMvenTxiw12sjKjLnMNhtsy0AM8oQrTaqnSai1aZmkb6/nC9Tmuj71s8Yojrx8QsA4 W8iGSoMa2pp2K0tC/SUn89QNqMh/x1SdePKG9Lb+SSkwmZaE1qAzmhdhcrzvLaX6r9BA /+Mvtmq5Jhxnr1e72JUE0Rf08ONhzyAPIPhMz33xmrpLGwOdQLhqWz4HUUHueq7FM/YC 1zBaCzmrnJst40Elih9mdWheW3S1uY7FJomH46Y4D5DTOx2APHd1gvwtogFSYdHmz023 rR+aNJiBVmnJESIr5jN74Eu+5C5y7FHpKdwBG/FbIC1y9VQm7vEJef/wR59jQTNBGgWX IhaA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:subject:cc:to:from:date :dkim-signature; bh=sf7GgOibjMTBXZd8ALe0ELeDNEJLMCxp5hRQr45M3vE=; b=WNZXrpZctdB/6SAhbsmQlP/PY4jij8NJj2NS4U88/u/w9zdPlkrGt17aGeNRid0Z3M 0Jpi4LyNRF/fBAAMhOX6Cl9x78qrQowaW3i+RPcmgen/1mY4Csc42XrKjI44BZOEirZF 0cr3lalFfcgX7pF/A5gQiwQTv0F6p9zFgdMnz16f/4egYHeqCV4GqfUMd4IM1DClqGu7 QzVF7ViuZEc6ANlKbbk+HY3SS5aZmS2SpSrx5oJ2lOItmofqXRpc3rlC8y8niXRxJ4Xc ZEWLZ/MmCrVocVePh6dWWG9sbulT6HIlKRlBLadFNVxx+ku2C8EBc2KBy1gwH+QbRm1U o2Lg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linux-foundation.org header.s=korg header.b=SlzzfNub; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id hg4-20020a1709072cc400b0073159f049ddsi2735596ejc.659.2022.08.24.14.50.40; Wed, 24 Aug 2022 14:51:29 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@linux-foundation.org header.s=korg header.b=SlzzfNub; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S239861AbiHXUVA (ORCPT + 99 others); Wed, 24 Aug 2022 16:21:00 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:48208 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232285AbiHXUU5 (ORCPT ); Wed, 24 Aug 2022 16:20:57 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id DB8AE52E6C for ; Wed, 24 Aug 2022 13:20:56 -0700 (PDT) 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 7C1F961862 for ; 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 X-Spam-Status: No, score=-7.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,NICE_REPLY_A,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE,URIBL_BLOCKED autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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.