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 2EB84C433F5 for ; Mon, 25 Apr 2022 14:59:10 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 9929D6B0074; Mon, 25 Apr 2022 10:59:09 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 940736B0075; Mon, 25 Apr 2022 10:59:09 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 7E2346B0078; Mon, 25 Apr 2022 10:59:09 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (relay.hostedemail.com [64.99.140.27]) by kanga.kvack.org (Postfix) with ESMTP id 6E93E6B0074 for ; Mon, 25 Apr 2022 10:59:09 -0400 (EDT) Received: from smtpin25.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay01.hostedemail.com (Postfix) with ESMTP id 45960620AC for ; Mon, 25 Apr 2022 14:59:09 +0000 (UTC) X-FDA: 79395709218.25.55E93CB Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.124]) by imf27.hostedemail.com (Postfix) with ESMTP id 766D640041 for ; Mon, 25 Apr 2022 14:59:07 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1650898748; 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=XjG90WgaAe38sSkHHb+3LvsVBQx5Y2V9Brg+m4vLOISm1h/yWMMvNBwEraJCOPXU/tksOG MyhAkI76p36dL4kFteJMl031m83kjK5xYwCVP8sObTRKeRHJt45X2qgDIkBRQ4k7ndcDN3 CBHuDUOaxAeokdIM/+vWjlg4vMMc5x8= 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-Rspamd-Queue-Id: 766D640041 X-Stat-Signature: z96zpx7zonxg6r8369xqjhgtg9ir1t34 X-Rspam-User: Authentication-Results: imf27.hostedemail.com; dkim=pass header.d=redhat.com header.s=mimecast20190719 header.b=XjG90Wga; spf=none (imf27.hostedemail.com: domain of mtosatti@redhat.com has no SPF policy when checking 170.10.129.124) smtp.mailfrom=mtosatti@redhat.com; dmarc=pass (policy=none) header.from=redhat.com X-Rspamd-Server: rspam09 X-HE-Tag: 1650898747-309457 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 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."