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 A84A6C61DA4 for ; Thu, 23 Feb 2023 16:00:27 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 2823D6B0071; Thu, 23 Feb 2023 11:00:27 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id 232596B0072; Thu, 23 Feb 2023 11:00:27 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 0FA6C6B0073; Thu, 23 Feb 2023 11:00:27 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0017.hostedemail.com [216.40.44.17]) by kanga.kvack.org (Postfix) with ESMTP id 014176B0071 for ; Thu, 23 Feb 2023 11:00:26 -0500 (EST) Received: from smtpin07.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay02.hostedemail.com (Postfix) with ESMTP id 959CC120BDB for ; Thu, 23 Feb 2023 16:00:26 +0000 (UTC) X-FDA: 80499018852.07.C9038AC Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) by imf01.hostedemail.com (Postfix) with ESMTP id 9C2F44002F for ; Thu, 23 Feb 2023 16:00:24 +0000 (UTC) Authentication-Results: imf01.hostedemail.com; dkim=pass header.d=redhat.com header.s=mimecast20190719 header.b=JOX6EGUv; spf=pass (imf01.hostedemail.com: domain of mtosatti@redhat.com designates 170.10.133.124 as permitted sender) smtp.mailfrom=mtosatti@redhat.com; dmarc=pass (policy=none) header.from=redhat.com ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1677168024; h=from:from:sender: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: in-reply-to:in-reply-to:references:references:dkim-signature; bh=GgcvtHnEOWjGtnQ2Rt3eSpStNGTeNOXLjTLKJm7KuKI=; b=rB+3E69KJiHIYdc4XHFdhZagqOhg1qm7Qewt/2zvaXMoLL+aN8QI0XG0qARsBEpd4VdVlR AfCgRW/cY5ZcoD9XgNUyMvuV5J/9ZQPNslkhRMCYd/MdNMRsLWELKCUwvxhXRSSew82+vL QHqI/w3ubjTDNvvX17RKASJVvnl1Pd8= ARC-Authentication-Results: i=1; imf01.hostedemail.com; dkim=pass header.d=redhat.com header.s=mimecast20190719 header.b=JOX6EGUv; spf=pass (imf01.hostedemail.com: domain of mtosatti@redhat.com designates 170.10.133.124 as permitted sender) smtp.mailfrom=mtosatti@redhat.com; dmarc=pass (policy=none) header.from=redhat.com ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1677168024; a=rsa-sha256; cv=none; b=43YVkELz3TJxNkmEyHXBlwj/kH66c4clYvB/SXBiEQhgZoxuI5qqk5Yh83irAxqo6E7b5c jsWYHp2QMQ/rSBlYfWfczPeghp4j/9bgphyLc5aTlq/4HPqHRR7I6ppHxNNgakzdqVQvg6 /YYrAAoXzGHVSaWruAyr/iOhO7LZ/NQ= DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1677168023; 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: in-reply-to:in-reply-to:references:references; bh=GgcvtHnEOWjGtnQ2Rt3eSpStNGTeNOXLjTLKJm7KuKI=; b=JOX6EGUv4ygCjr7kHc/Q/ZGNttU1OF7mHG5EurgwkA5nRam4hqDHNs53ExKD7HWJLjTo2L C6DtrDWJCgnWIbJo0RRXFd42sAbFmFze9bxpGEhADZmlF1dmgKKv0rj4Gg+h/C+f8N2RgY xR4PSQJ4l7V6BpVyXm4r5UJMIOEGZzo= 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-668-S2kTqbv0Oli32z3bynY_9g-1; Thu, 23 Feb 2023 11:00:19 -0500 X-MC-Unique: S2kTqbv0Oli32z3bynY_9g-1 Received: from smtp.corp.redhat.com (int-mx01.intmail.prod.int.rdu2.redhat.com [10.11.54.1]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id C9A9F38041CA; Thu, 23 Feb 2023 16:00:12 +0000 (UTC) Received: from tpad.localdomain (ovpn-112-3.gru2.redhat.com [10.97.112.3]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 985FD404BEC1; Thu, 23 Feb 2023 16:00:12 +0000 (UTC) Received: by tpad.localdomain (Postfix, from userid 1000) id AFF64400E065E; Thu, 23 Feb 2023 11:54:53 -0300 (-03) Date: Thu, 23 Feb 2023 11:54:53 -0300 From: Marcelo Tosatti To: Christoph Lameter , Andrew Morton Cc: Aaron Tomlin , Frederic Weisbecker , Andrew Morton , linux-kernel@vger.kernel.org, linux-mm@kvack.org Subject: Re: [PATCH v2 00/11] fold per-CPU vmstats remotely Message-ID: References: <20230209150150.380060673@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20230209150150.380060673@redhat.com> X-Scanned-By: MIMEDefang 3.1 on 10.11.54.1 X-Rspamd-Queue-Id: 9C2F44002F X-Stat-Signature: 86qu88sseow8ge7wxdfa9ihqagdgughf X-Rspam-User: X-Rspamd-Server: rspam08 X-HE-Tag: 1677168024-495367 X-HE-Meta: U2FsdGVkX1/CBeMo5i8LftgDJ3S/DBLHceJ0jSjHK/3XsrgLDoCrEB0npDUnO34IWxC/h0AEIFcUkdjKiDeRbn6EA4OFs2/VJ2pxbsSjVq+9TNDOeAePU1JGqkaNerq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 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: On Thu, Feb 09, 2023 at 12:01:50PM -0300, Marcelo Tosatti wrote: > This patch series addresses the following two problems: > > 1. A customer provided some evidence which indicates that > the idle tick was stopped; albeit, CPU-specific vmstat > counters still remained populated. > > Thus one can only assume quiet_vmstat() was not > invoked on return to the idle loop. If I understand > correctly, I suspect this divergence might erroneously > prevent a reclaim attempt by kswapd. If the number of > zone specific free pages are below their per-cpu drift > value then zone_page_state_snapshot() is used to > compute a more accurate view of the aforementioned > statistic. Thus any task blocked on the NUMA node > specific pfmemalloc_wait queue will be unable to make > significant progress via direct reclaim unless it is > killed after being woken up by kswapd > (see throttle_direct_reclaim()) > > 2. With a SCHED_FIFO task that busy loops on a given CPU, > and kworker for that CPU at SCHED_OTHER priority, > queuing work to sync per-vmstats will either cause that > work to never execute, or stalld (i.e. stall daemon) > boosts kworker priority which causes a latency > violation > > By having vmstat_shepherd flush the per-CPU counters to the > global counters from remote CPUs. > > This is done using cmpxchg to manipulate the counters, > both CPU locally (via the account functions), > and remotely (via cpu_vm_stats_fold). > > Thanks to Aaron Tomlin for diagnosing issue 1 and writing > the initial patch series. > > v2: > - actually use LOCK CMPXCHG on counter mod/inc/dec functions > (Christoph Lameter) > - use try_cmpxchg for cmpxchg loops > (Uros Bizjak / Matthew Wilcox) > > > arch/arm64/include/asm/percpu.h | 16 ++- > arch/loongarch/include/asm/percpu.h | 23 ++++ > arch/s390/include/asm/percpu.h | 5 + > arch/x86/include/asm/percpu.h | 39 ++++---- > include/asm-generic/percpu.h | 17 +++ > include/linux/mmzone.h | 3 > kernel/fork.c | 2 > kernel/scs.c | 2 > mm/vmstat.c | 424 ++++++++++++++++++++++++++++++++++++++++++++++++------------------------------------------ > 9 files changed, 308 insertions(+), 223 deletions(-) Friendly ping, any other concern with this series? If not, ACKed-by or Reviewed-by's would be welcome.