Received: by 2002:a05:6358:a55:b0:ec:fcf4:3ecf with SMTP id 21csp4762202rwb; Tue, 17 Jan 2023 05:19:01 -0800 (PST) X-Google-Smtp-Source: AMrXdXvU0fQ61YZYm/IHjKpvghLU7JHw921ZLxrBSW4U+135OX5Hal8PEm/hjLJAKIgB6wRBGsW5 X-Received: by 2002:a05:6402:2289:b0:498:f82c:7068 with SMTP id cw9-20020a056402228900b00498f82c7068mr2199373edb.35.1673961540920; Tue, 17 Jan 2023 05:19:00 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1673961540; cv=none; d=google.com; s=arc-20160816; b=xlynpZEcR88RpT2yLoTz7G4/V/gW9tuwObI3qfAdfyJFvAuT23itUECJqnV7PNGsQI zrWksS7HmFxUx28Eg7Bcrn+Uu71eD8Q0Z2zcGjlieVOEWZoOVgUUyGUTbdmxDRE22EH7 bCqU1UyoSxIS48JxShE2GKIImYLWfZuQ18vBK4Pu4wHArSGA/FZKzLDSO0VRyPrFB1iS BStobPjijz18G8e+rrrV2ujOzt1Tn2cY+sGTlYJ0kh6ClJ1Q1cj9azcIIBoywSHN0dji 0eArbuSZ/+eFPZtSQsLo9fffxviwgkx6YfWH0iXA4ZBpi3TXs5gzKlk22f9MOdyVld9W 02+A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:mime-version:references:message-id:in-reply-to :subject:cc:to:from:date:dkim-signature; bh=4MtLJkkrXsyIiXO9P2qd65mct+kptfukKvKG/JQ7WaE=; b=PnZCKu3UII4FK/ryV+faGl5CM8AZ/FOExCNkmT2qPGZA24JxMKT0rGiVJ265sHj/gl 4zxan+n3ZjG5XAdFdMaKw2NfeB9gLBzH2KecneQm/uBzNaQv0Js61g/v13TpydWgZXco 9ALC7vHBgEGR33mQmhl85mZqNr2fa4bJbumi8KnxFm5aNQgM7zRDrRAS3PWPctuxQFM9 j5KG9cUaB9I+Knxs2/Py4H6hiWrGO4qVdvhRinRCPdoQ88OtM4GPPb0stTAaJBGmnU5J agMHFAdbXnrvtHcBKvkDSQpOenT49EeRUv+cVjemJEGzy6ZGXgsPXWshqqkBcQkjfVdA lJuA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gentwo.de header.s=default header.b=UWEiNtKG; 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=gentwo.de Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id eg24-20020a056402289800b00475a6378758si30058820edb.554.2023.01.17.05.18.47; Tue, 17 Jan 2023 05:19:00 -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=@gentwo.de header.s=default header.b=UWEiNtKG; 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=gentwo.de Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S236787AbjAQMx6 (ORCPT + 50 others); Tue, 17 Jan 2023 07:53:58 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:38296 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S237053AbjAQMxJ (ORCPT ); Tue, 17 Jan 2023 07:53:09 -0500 Received: from gentwo.de (gentwo.de [161.97.139.209]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 700B7302AF for ; Tue, 17 Jan 2023 04:52:21 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=gentwo.de; s=default; t=1673959938; bh=eyH74BJ/7IIhmnPK8RsGXK4MMB69Q2QKmBRINALqzMY=; h=Date:From:To:cc:Subject:In-Reply-To:References:From; b=UWEiNtKGqkIkX65IVF64nS/tHSIZ8csoAumnpxSMXk+x2SORolGIWPGf4CtdeHGW8 HTpgLOvKHTMhdicuvoG4bCT5Y6RRUAp4VkpNYTyeMVJMCXXJHsmDcafWPfqryT5Qip PG+wi1odCf/m17w1HSEHKrYBlvdj/ipk3XggrRAQJThC6c3reiAcTOQv36S7iT0H4O VKR9Lp8jmeOSNi/ZfJvoTkCuHt0puTSfjv/Cj8x13xUiG/UhT+drCzs89lyrb05WkH MhL9tYO3w/OLBADl0pB9G+lGwZ/UBc0rn5EcshX9eOKmamU5inxzERgHWzUj47FSln leGVVBTwIFYqA== Received: by gentwo.de (Postfix, from userid 1001) id 2B777B0023C; Tue, 17 Jan 2023 13:52:18 +0100 (CET) Received: from localhost (localhost [127.0.0.1]) by gentwo.de (Postfix) with ESMTP id 286F0B000FF; Tue, 17 Jan 2023 13:52:18 +0100 (CET) Date: Tue, 17 Jan 2023 13:52:18 +0100 (CET) From: Christoph Lameter To: Marcelo Tosatti cc: Frederic Weisbecker , 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 In-Reply-To: Message-ID: <74e4afd4-5695-90fb-e66e-25d2bc2e2f53@gentwo.de> References: <20230105125218.031928326@redhat.com> <20230105125248.813825852@redhat.com> <7c2af941-42a9-a59b-6a20-b331a4934a3@gentwo.de> <60183179-3a28-6bf9-a6ab-8a8976f283d@gentwo.de> <24ca2aad-54b2-2c3a-70b5-49a33c9a33@gentwo.de> MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,SPF_HELO_PASS,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 Mon, 16 Jan 2023, Marcelo Tosatti wrote: > Honestly, to me, there is no dilemma: > > * There is a requirement from applications to be uninterrupted > by operating system activities. Examples include radio access > network software, software defined PLCs for industrial automation (1). > > * There exists vm-statistics counters (which count > the number of pages on different states, for example, number of > free pages, locked pages, pages under writeback, pagetable pages, > file pages, etc). > To reduce number of accesses to the global counters, each CPU maintains > its own delta relative to the global VM counters > (which can be cached in the local processor cache, therefore fast). The counters only count accurately as a global sum. A counter may be specific to a zone and at which time it counts uses of that zone of from all processors. > Now you are objecting to this patchset because: > > It increases the number of cycles to execute the function to modify > the counters by 6. Can you mention any benchmark where this > increase is significant? I am objecting because of a fundamental misunderstanding of how these counters work and because the patchset is incorrect in the way it handles these counters. Come up with a correct approach and then we can consider regressions and/or improvements in performance. > Alternatives: > 1) Disable periodic synchronization for nohz_full CPUs. > 2) Processor instructions which can modify more than > one address in memory. > 3) Synchronize the per-CPU stats remotely (which > increases per-CPU and per-node accesses). Or remove the assumptions that may exist in current code that a delta on a specific cpu counter means that something occurred on that cpu? If there is a delta then that *does not* mean that there is something to do on that processor. The delta could be folded by another processor into the global counter if that processor is idle or not entering the Kernel and stays that way throughout the operation. So I guess that would be #3. The function cpu_vm_stats_fold() already does this for offline cpus. Can something similar be made to work for idle cpus or those continually running in user space?