Message ID | 20230305134053.687304254@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 v21csp1376793wrd; Sun, 5 Mar 2023 05:43:55 -0800 (PST) X-Google-Smtp-Source: AK7set+yHkiCkoI2zeYKcW9NlC9huNtZmxCPrtWsLILfNOo5BfUGUpbs+x7k6Nn3ABnyXT5o6vUs X-Received: by 2002:a17:902:da8d:b0:19b:33c0:409e with SMTP id j13-20020a170902da8d00b0019b33c0409emr10106372plx.50.1678023835105; Sun, 05 Mar 2023 05:43:55 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1678023835; cv=none; d=google.com; s=arc-20160816; b=IFw8CMhoULI6fbHJCQMNorL+ucXO51SsOmjBq02aLXDF9PdxwmzILV77irLrzUe5Ld k3qYEcrsxHg8gv0zrupW4PK/M52yew2kzZhHSSgO3fApNIQaFyVi7geCMH6WyKMQQUoU tdacp7A9ZCqlt+Z7y0T+gPwtxiLGjvj3ymt16rgKi22C2vAy7JBpWh9/1KaUdW1NUYQj Oi9av0AnvM+3q45lBK4IsbUMWNxpVi2W/MyuLgKLJYG0OadEBZDSS1h6ip83JZXUGV1i NI13NRJkO2Z0RPErbLErLDeIYL0eLoahEA4/7j/R7ZPtG2OFhW6J30lPyaNlFGFwsGcR JXxw== 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=rXMb8P9mvaOdCYM/DfipZFPeqXJiK7cqGAbZr72bWt66axdUgQL58zTcWXfO1BHAya TCzINcbAHrbISpbX/57Bwry0Yk3EldZLK9ZdvkuiM0Oc351bBxTeDIc+2GUKK+Chqr2o dTTRpUMxM25L6//Qvmv1b2oS041FIyTULsHmIGGblx+VvFaREJo1vh5fZpgoEKgJHe9I TIhKxxbS9T4j4vUG9p1gHqgzqqVnoVgVVpVBltjhmacK6Y+fOsEA9jMa3I7eePHhe7YF qF10ZpCYy1r3WednfPa0sSDTVJUM4N7g5alxcfa9vbjDbxCGT6ID0oTqP83oxeHcJhfC r6Vw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=QpTVle9S; 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 kp3-20020a170903280300b0019e2eb4922esi6779787plb.639.2023.03.05.05.43.43; Sun, 05 Mar 2023 05:43:55 -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=QpTVle9S; 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 S229794AbjCENmg (ORCPT <rfc822;carlos.wei.hk@gmail.com> + 99 others); Sun, 5 Mar 2023 08:42:36 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:53950 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229565AbjCENme (ORCPT <rfc822;linux-kernel@vger.kernel.org>); Sun, 5 Mar 2023 08:42:34 -0500 Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.124]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id C6D2112F0D for <linux-kernel@vger.kernel.org>; Sun, 5 Mar 2023 05:41:47 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1678023706; 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=QpTVle9SrLz4POGEVXKlpLN2mvO9zyMIQPJUKy2hx/nZV9mKd6zbWZNrGCCoedvANO9faY +JVQdS8Q6ZigJqYs0XQECxSIMMVPlX0FTSmxVjg5ty+xAwZiWW3arAZbzy09pRpjeOt2eb ftM1IjxahlKk/QBafn8f7OXykmbRV8Y= 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-117-Aba2Ptl8N9iKTrjZggZs1g-1; Sun, 05 Mar 2023 08:41:43 -0500 X-MC-Unique: Aba2Ptl8N9iKTrjZggZs1g-1 Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.rdu2.redhat.com [10.11.54.5]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id ECE0885A588; Sun, 5 Mar 2023 13:41:42 +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 A78F618EC2; Sun, 5 Mar 2023 13:41:42 +0000 (UTC) Received: by tpad.localdomain (Postfix, from userid 1000) id 434A7401A193C; Sun, 5 Mar 2023 10:41:23 -0300 (-03) Message-ID: <20230305134053.687304254@redhat.com> User-Agent: quilt/0.67 Date: Sun, 05 Mar 2023 10:37:08 -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 v4 11/12] mm/vmstat: switch vmstat shepherd to flush per-CPU counters remotely References: <20230305133657.255737580@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 X-Scanned-By: MIMEDefang 3.1 on 10.11.54.5 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?1759535520621278027?= X-GMAIL-MSGID: =?utf-8?q?1759535520621278027?= |
Series |
fold per-CPU vmstats remotely
|
|
Commit Message
Marcelo Tosatti
March 5, 2023, 1:37 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) {