Message ID | 20230303195909.003776725@redhat.com |
---|---|
State | New |
Headers |
Return-Path: <linux-kernel-owner@vger.kernel.org> Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:5915:0:0:0:0:0 with SMTP id v21csp601784wrd; Fri, 3 Mar 2023 12:02:15 -0800 (PST) X-Google-Smtp-Source: AK7set/vvUgr2F10lC+KA7gk02S/eDB8gAOI5pnXBcSW8aPGFdEOKUqPxQekUZuKkmUMbJnT0XEx X-Received: by 2002:a17:90b:1a84:b0:237:d2d8:3256 with SMTP id ng4-20020a17090b1a8400b00237d2d83256mr2794147pjb.20.1677873735631; Fri, 03 Mar 2023 12:02:15 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1677873735; cv=none; d=google.com; s=arc-20160816; b=ZlLW3n1A/t8t4CjzBQ16P1cYYuLRaDus+a7BKFhAmZ5YrnNkbza5pW6PLKvZcl1PMK Lid6OOURIN8UgORZjb8KOvnHPTY11Y65V1au1uyRVz9hRXYPBDV7kIvPYdi4Xfwkps1M I8gpzdasiEv2/qAXD94Kd4ws95aH4xSu8k0NAu+Rp74tPps5mfwaTkO00ZBCkwqM+bON llcdcujFlyctPxPhTPVHfdm3z+dPBIhHYVxdi/1Kag7nohRyWxNQg3ZDLOxtSugy9BO6 iIrKLBrPoOHdcqVdqf3rCQdwsz0db+xlM+MwkF8P3wRHAN1eGZ4QPcQYonfDsw8Bh+LX 2Xpw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:mime-version:references:subject:cc:to:from:date :user-agent:message-id:dkim-signature; bh=tHAQYo4aXRrl160KH7pJqqqPegg14fiAPRCJhIKS8fE=; b=wercT0j7OQzJSBPGJaOzScHPNFZ2ytqJu3lYubY9zKeWL8mX+2K/IWVaInGK9/SHpS dnDk5dj2PS0twa97uBxsaNm0ByntQUn5hmGZ0eDd0b9K+uOQJOMbfNRMdzE01pI/4LMq 4134xDRDM0Hc3nTqx2xXZWbq7BmX1uY8HkxZg/D6N+6FNrTw49l7W0tISPd4B1ORotUw p2fHBC6lsDdfSsradDNwajVyl/KKySc16y6GZS7LrpchUDqi5qFvIbAByWVzd2oKfkf/ Xk+SUEQfZQdElpKQrQHpi+TI89SQr/aiEc5lI3gslXI2iONn2M6CipcOGxqDFLwjthHU vmsA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=amJWYAbX; 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: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id 6-20020a17090a08c600b00234ba2fe34bsi2809495pjn.102.2023.03.03.12.02.02; Fri, 03 Mar 2023 12:02:15 -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=@redhat.com header.s=mimecast20190719 header.b=amJWYAbX; 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 S231578AbjCCUBn (ORCPT <rfc822;davidbtadokoro@gmail.com> + 99 others); Fri, 3 Mar 2023 15:01:43 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:56112 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231150AbjCCUBa (ORCPT <rfc822;linux-kernel@vger.kernel.org>); Fri, 3 Mar 2023 15:01:30 -0500 Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 28C736153E for <linux-kernel@vger.kernel.org>; Fri, 3 Mar 2023 12:00:36 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1677873635; 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: references:references; bh=tHAQYo4aXRrl160KH7pJqqqPegg14fiAPRCJhIKS8fE=; b=amJWYAbXDqM2W/gUg/nTITXsXKHGKFk523FOEukKdQvP9cs1nibQGukMk3/20rL8K5G40U Tjf0CoZGrzAkzNoYwbuyBSUqFAnfMR6sgpiJsECd2iIDEmAeGJ4P99ZOxyLEwZfa2NUF+l QRYjlpyipw+BKp1Fzg8VP8Tcij+C23s= Received: from mimecast-mx02.redhat.com (mimecast-mx02.redhat.com [66.187.233.88]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-294-29M75UO_NkSSiK0Vpi9pvg-1; Fri, 03 Mar 2023 15:00:31 -0500 X-MC-Unique: 29M75UO_NkSSiK0Vpi9pvg-1 Received: from smtp.corp.redhat.com (int-mx10.intmail.prod.int.rdu2.redhat.com [10.11.54.10]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 55C1A803491; Fri, 3 Mar 2023 20:00:30 +0000 (UTC) Received: from tpad.localdomain (ovpn-112-2.gru2.redhat.com [10.97.112.2]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 2861A492B00; Fri, 3 Mar 2023 20:00:30 +0000 (UTC) Received: by tpad.localdomain (Postfix, from userid 1000) id AFB1442919633; Fri, 3 Mar 2023 17:00:12 -0300 (-03) Message-ID: <20230303195909.003776725@redhat.com> User-Agent: quilt/0.67 Date: Fri, 03 Mar 2023 16:58:51 -0300 From: Marcelo Tosatti <mtosatti@redhat.com> To: Christoph Lameter <cl@linux.com> Cc: Aaron Tomlin <atomlin@atomlin.com>, Frederic Weisbecker <frederic@kernel.org>, Andrew Morton <akpm@linux-foundation.org>, linux-kernel@vger.kernel.org, linux-mm@kvack.org, Russell King <linux@armlinux.org.uk>, Huacai Chen <chenhuacai@kernel.org>, Heiko Carstens <hca@linux.ibm.com>, x86@kernel.org, Marcelo Tosatti <mtosatti@redhat.com> Subject: [PATCH v3 10/11] mm/vmstat: switch vmstat shepherd to flush per-CPU counters remotely References: <20230303195841.310844446@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 X-Scanned-By: MIMEDefang 3.1 on 10.11.54.10 X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_NONE, RCVD_IN_MSPIKE_H2,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: <linux-kernel.vger.kernel.org> X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1759378130243161700?= X-GMAIL-MSGID: =?utf-8?q?1759378130243161700?= |
Series |
fold per-CPU vmstats remotely
|
|
Commit Message
Marcelo Tosatti
March 3, 2023, 7:58 p.m. UTC
Now that the counters are modified via cmpxchg both CPU locally
(via the account functions), and remotely (via cpu_vm_stats_fold),
its possible to switch vmstat_shepherd to perform the per-CPU
vmstats folding remotely.
This fixes 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
Signed-off-by: Marcelo Tosatti <mtosatti@redhat.com>
Index: linux-vmstat-remote/mm/vmstat.c =================================================================== --- linux-vmstat-remote.orig/mm/vmstat.c +++ linux-vmstat-remote/mm/vmstat.c @@ -2004,6 +2004,23 @@ static void vmstat_shepherd(struct work_ static DECLARE_DEFERRABLE_WORK(shepherd, vmstat_shepherd); +#ifdef CONFIG_HAVE_CMPXCHG_LOCAL +/* Flush counters remotely if CPU uses cmpxchg to update its per-CPU counters */ +static void vmstat_shepherd(struct work_struct *w) +{ + int cpu; + + cpus_read_lock(); + for_each_online_cpu(cpu) { + cpu_vm_stats_fold(cpu); + cond_resched(); + } + cpus_read_unlock(); + + schedule_delayed_work(&shepherd, + round_jiffies_relative(sysctl_stat_interval)); +} +#else static void vmstat_shepherd(struct work_struct *w) { int cpu; @@ -2023,6 +2040,7 @@ static void vmstat_shepherd(struct work_ schedule_delayed_work(&shepherd, round_jiffies_relative(sysctl_stat_interval)); } +#endif static void __init start_shepherd_timer(void) {