Received: by 2002:a05:6358:16cc:b0:ea:6187:17c9 with SMTP id r12csp7713193rwl; Tue, 10 Jan 2023 04:35:26 -0800 (PST) X-Google-Smtp-Source: AMrXdXtCqmK68kp1vfBDkdR6RDJ06i5sKO5pTDSu5QgCAwYr4Evm48nB7LL9mBH0YXkZBc1XQrik X-Received: by 2002:a17:906:9e06:b0:84d:35e1:2781 with SMTP id fp6-20020a1709069e0600b0084d35e12781mr8239888ejc.46.1673354126073; Tue, 10 Jan 2023 04:35:26 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1673354126; cv=none; d=google.com; s=arc-20160816; b=Q7IwnT2pnahYFUi3F1TdO05xejuW5ZsG1XVjQcJjDj4UOGgT9ni+K4x91jN1fRqZpX BFqBxVrFL6SK/xu76LNyVEcTAYKUVgNQJgUqOjbzs4Xe/cAEvGyJQ48OFNAfL/laex99 sfIhhU1NzrkR3FR+jFtQ3CAZKc1Epoij3wRqMZTiA6IX3LBcxHdm5bai6jd8lbhQmcm9 YDp490beZhYgIxveuBq5UZOko94ciFf7axCewWfBiGP8Pusf43s1BnXCmvn3IJlpyFTc 3hqTEDtc5J0Tp5NBzMBnnTDKu4tRDW7Iv9qGEInOkEkrc2Yf+UVcsiyCQrDIUP9HQCu9 37hA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :references:message-id:subject:cc:to:from:date:dkim-signature; bh=S5rLEm/iSFWZMf0cOzTuRm3aRPBnflEb3xO2/AKC2+E=; b=WUE22c71LqQ4wdQpO1DCVpHvkl4dwyk79tMh5SeUGyJ4j6jYR5MzRJlNCRKhx1IObg caiGC6YMClExzs0ZA6EvR6+QZgG2ICeXPX9pTu9NmsBSbUnTHYumPGVg2WBI+1nZZ1Ss up9y9hqqQCQaZw27NktKEoPFsvv+9gmHpPeri6HnreLFvR9Fe9mhOkeY2OuLqcUGmmiv E0Rk4qEg3AScWQRTy4rNzSsqbEo5yEDL7G7aywrBGL4o8pqGbHGScDy9D4RwRSENe0dy rqvkSwQDgVTdnav5ciWkJSAocQcVA3zXUjS+azNOXHofAl/O+iIoi1I35ngsHPQFyqXj TrFA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=IwOAzfPk; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id i8-20020a1709064fc800b007c6be268253si10930243ejw.608.2023.01.10.04.35.13; Tue, 10 Jan 2023 04:35:26 -0800 (PST) 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=@kernel.org header.s=k20201202 header.b=IwOAzfPk; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232715AbjAJMUw (ORCPT + 53 others); Tue, 10 Jan 2023 07:20:52 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:36904 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S238474AbjAJMUV (ORCPT ); Tue, 10 Jan 2023 07:20:21 -0500 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 448E315F2C for ; Tue, 10 Jan 2023 04:18:55 -0800 (PST) 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 ams.source.kernel.org (Postfix) with ESMTPS id 12BE7B811D8 for ; Tue, 10 Jan 2023 12:18:53 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 8F47BC433EF; Tue, 10 Jan 2023 12:18:49 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1673353130; bh=aOUMcDhi1pc8g5lJzrCltSW1fWp7f/dto21aYxlxTAI=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=IwOAzfPkv07dfecMpIx84BMk7joW+fAJ/GVeNKwJEczUQW4ZMC1CBF4z21IYr9rk4 EX9SneWAhsUx+EJ8RPEH86x4J7PdmHUz35fpyI5BoPuRMNP3HzK0U+7P15AVwZNKVD eGVJQXpFlyP0wr7Dw8f99iHKLpb2kIb25V11fN9mDhE9gQJg74xufGYa0ZE7UbGkj7 U5SYh7veZyzOBHZHDUmo678xz8NE56Ser749qdKJCAyLY+T/FjU/nwWq1/6rKVYZ07 o514SRRqbi61EA9955tiOmmyq/vHZRN3RtchkHRywuOl97agtO1xzNyzGrrej+uPoj e9W8820uIqc5g== Date: Tue, 10 Jan 2023 13:18:46 +0100 From: Frederic Weisbecker To: Christoph Lameter Cc: Marcelo Tosatti , atomlin@atomlin.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 v13 2/6] mm/vmstat: Use vmstat_dirty to track CPU-specific vmstat discrepancies Message-ID: References: <20230105125218.031928326@redhat.com> <20230105125248.813825852@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: X-Spam-Status: No, score=-7.1 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS 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 Tue, Jan 10, 2023 at 01:06:37PM +0100, Christoph Lameter wrote: > On Thu, 5 Jan 2023, Marcelo Tosatti wrote: > > @@ -577,6 +579,9 @@ static inline void mod_zone_state(struct > > s8 __percpu *p = pcp->vm_stat_diff + item; > > long o, n, t, z; > > > > + /* cmpxchg and vmstat_mark_dirty should happen on the same CPU */ > > + preempt_disable(); > > If you are disabling preemption then why do we still need cmpxchg? > Same again below. Note I'm absolutely clueless with vmstat. But I was wondering about it as well while reviewing Marcelo's series, so git blame pointed me to: 7c83912062c801738d7d19acaf8f7fec25ea663c ("vmstat: User per cpu atomics to avoid interrupt disable / enable") And this seem to mention that this can race with IRQs as well, hence the local cmpxchg operation.