Received: by 2002:a05:6602:2086:0:0:0:0 with SMTP id a6csp3271216ioa; Mon, 25 Apr 2022 23:31:46 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxeIVAzrfVML0VIKRgawpX59DvB2CfpgyxkJNTxPZlRkQeWhwC7yidhjd9ei3jK+eLn3nze X-Received: by 2002:a17:90b:3b8c:b0:1d4:cd93:ffe7 with SMTP id pc12-20020a17090b3b8c00b001d4cd93ffe7mr25311530pjb.237.1650954706472; Mon, 25 Apr 2022 23:31:46 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1650954706; cv=none; d=google.com; s=arc-20160816; b=Jge2DLg190X8+Xs7tUkHlYrdye3nbST4owRIWcb2k9dtQD/n3FFdS5ccgS0IjDdWYW mXW+sOPuPTIvgTfTxJMcNdVoGGvIcD8maZANAmUX6MWjuChLZQJn2rpb4H4sRXWBquQ5 BtxPeXysNbitjIMrmbq4l12+gqSlBF4qUpVh4o7GKTElN1o4xnHI6mxTB0VICdqWAEYp SDx0vWrGJL212Nqc0TVCDZLGmdmy2F+2+2QNWgydFq7gTXXMqjxdOuiHPEMTCZK+vVUO QVa02nGzhRv/J/CpsXl/tGL9slhXJfGXF4daNZA79DLYBIHd3PX2ukLExpb55wujNrnb jL5w== 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-transfer-encoding :content-disposition:mime-version:references:message-id:subject:cc :to:from:date:dkim-signature; bh=aVm3XyH4Eb2jKqWQvAzp0aH5DM2Lzwo7rp3slkzqeHQ=; b=Ia/6A8HNWTY1zkfV7R/bek3IjV8RediUJR9ovvHQM9s/v18dvFGEj3SLOghKkAPsKx d2vzCx8ZKmfHxG3MvtgpPpwhp3moFDr+Kfwi7L95V13qQXSydvt+Vd41W+BF+OD5ONj/ xxbF5WlmOFHrgAiSH8M4IoBhx2m5V4y4UnZ8EAFpJoAiM95EVDGjVieag0Xqkhh5IrZm 1hJhAWYa7QWcPLYzs6pR7lbv8n6tgGWnVbs+cqFYDC/kHWQixOMq7EylEHaPDmdBioc0 szw7XA0deHg/HywzXl7KydSDEZd0DrBv5eFoZUx00Cy73xbRQfh86ezBTsabKmkV9h0f HDxg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=XRdkXCrN; 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=redhat.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id g17-20020a056a000b9100b004fa3a8dff54si23569968pfj.11.2022.04.25.23.31.32; Mon, 25 Apr 2022 23:31:46 -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=@redhat.com header.s=mimecast20190719 header.b=XRdkXCrN; 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=redhat.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S238132AbiDYPCR (ORCPT + 99 others); Mon, 25 Apr 2022 11:02:17 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:46192 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S242633AbiDYPCP (ORCPT ); Mon, 25 Apr 2022 11:02:15 -0400 Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.124]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id 543DC119ED4 for ; Mon, 25 Apr 2022 07:59:11 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1650898750; 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: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=aVm3XyH4Eb2jKqWQvAzp0aH5DM2Lzwo7rp3slkzqeHQ=; b=XRdkXCrNqkoLHbvVoefR947/QsqR5UJlvBHX85HufYTDNu0UiytWwAENhr4gNTD0wJI2HU ckpAnJJuGk8Xi5ezlUrwjdsF4KUoWiRAjf3dqLv4EGJ/VK4AR9mkYkezExrsLvu5QnwCYe 6PQ8n6f9XK13v9XS4CH8SkXccf1m3Q4= Received: from mimecast-mx02.redhat.com (mx3-rdu2.redhat.com [66.187.233.73]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-675-vKj1gQFrOCGo-ysHu3sa4Q-1; Mon, 25 Apr 2022 10:59:06 -0400 X-MC-Unique: vKj1gQFrOCGo-ysHu3sa4Q-1 Received: from smtp.corp.redhat.com (int-mx08.intmail.prod.int.rdu2.redhat.com [10.11.54.8]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id D93921E13795; Mon, 25 Apr 2022 14:59:05 +0000 (UTC) Received: from fuller.cnet (ovpn-112-4.gru2.redhat.com [10.97.112.4]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 86206C27EBC; Mon, 25 Apr 2022 14:59:05 +0000 (UTC) Received: by fuller.cnet (Postfix, from userid 1000) id 3B9DE416F574; Mon, 25 Apr 2022 11:57:31 -0300 (-03) Date: Mon, 25 Apr 2022 11:57:31 -0300 From: Marcelo Tosatti To: Christoph Lameter Cc: Peter Zijlstra , Aaron Tomlin , frederic@kernel.org, tglx@linutronix.de, mingo@kernel.org, pauld@redhat.com, neelx@redhat.com, oleksandr@natalenko.name, linux-kernel@vger.kernel.org, linux-mm@kvack.org Subject: Re: [RFC PATCH v3] tick/sched: Ensure quiet_vmstat() is called when the idle tick was stopped too Message-ID: References: <20220422193647.3808657-1-atomlin@redhat.com> <20220425113909.u3smtztp66svlw4o@ava.usersys.com> <20220425132700.GK2731@worktop.programming.kicks-ass.net> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: X-Scanned-By: MIMEDefang 2.85 on 10.11.54.8 X-Spam-Status: No, score=-3.4 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_LOW, SPF_HELO_NONE,SPF_NONE 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, Apr 25, 2022 at 04:06:04PM +0200, Christoph Lameter wrote: > On Mon, 25 Apr 2022, Peter Zijlstra wrote: > > > > Folding the vmstat diffs *always* when entering idle prevents unnecessary > > > wakeups and processing in the future and also provides more accurate > > > counters for the VM allowing better decision to be made on reclaim. > > > > I'm thinking you're going to find a ton of regressions if you try it > > though; some workloads go idle *very* shortly, doing all this accounting > > is going to be counter-productive. > > Well there is usually not much to do in terms of accounting. static int refresh_cpu_vm_stats(bool do_pagesets) { struct pglist_data *pgdat; struct zone *zone; int i; int global_zone_diff[NR_VM_ZONE_STAT_ITEMS] = { 0, }; int global_node_diff[NR_VM_NODE_STAT_ITEMS] = { 0, }; int changes = 0; for_each_populated_zone(zone) { struct per_cpu_zonestat __percpu *pzstats = zone->per_cpu_zonestats; #ifdef CONFIG_NUMA struct per_cpu_pages __percpu *pcp = zone->per_cpu_pageset; #endif for (i = 0; i < NR_VM_ZONE_STAT_ITEMS; i++) { int v; v = this_cpu_xchg(pzstats->vm_stat_diff[i], 0); if (v) { This loop is quite heavy. Maybe reducing the data necessary to be read to a couple of cachelines would improve it considerably. > If there are > a lot of updates then it is worthwhile because if the numbers are off too > much then the VM has trouble assessing its own situation. > > It may depend though on how long the idle periods are. Do we have > statistics on the duration? Always folding the vmstat deltas may also > increase the length of the idle periods. "Products such as the IntelĀ® Optaneā„¢ SSD DC P4800X series have a read and write latency of 10 microseconds, compared with a write latency of about 220 microseconds for a typical NAND flash SSD."