From patchwork Wed Feb 1 19:50:13 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Marcelo Tosatti X-Patchwork-Id: 13124918 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 72429C636D4 for ; Wed, 1 Feb 2023 19:52:42 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 81D826B0080; Wed, 1 Feb 2023 14:52:40 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id 757DB6B007E; Wed, 1 Feb 2023 14:52:40 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 5D4F46B0080; Wed, 1 Feb 2023 14:52:40 -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 448B26B007B for ; Wed, 1 Feb 2023 14:52:40 -0500 (EST) Received: from smtpin23.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay02.hostedemail.com (Postfix) with ESMTP id B8753120FF6 for ; Wed, 1 Feb 2023 19:52:39 +0000 (UTC) X-FDA: 80419770438.23.86F5415 Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) by imf25.hostedemail.com (Postfix) with ESMTP id 6DFC1A0011 for ; Wed, 1 Feb 2023 19:52:37 +0000 (UTC) Authentication-Results: imf25.hostedemail.com; dkim=pass header.d=redhat.com header.s=mimecast20190719 header.b=Hexjjick; spf=pass (imf25.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=1675281157; h=from:from:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:content-type: content-transfer-encoding:in-reply-to:references:dkim-signature; bh=sTvWe2kfUoGBfAaCSxydSPRezZXDlplO8iSUUltKQvQ=; b=4djqWFIDqQR9CNF7QeZ1JQyGyh2qY/ZfymzdTylJMZqXMNcjJqP8IPVhxZHZqKlWqwYzcX 5F5N8WqLYe2fspm0eaZT0Z5nBmOBS7kJPWa7yHjtEmmdpEUh8Gh8h2m5CLlo3vSo8Sp5PZ w5uC0mo2Cc1uwQMh17IngsKWpFpORe8= ARC-Authentication-Results: i=1; imf25.hostedemail.com; dkim=pass header.d=redhat.com header.s=mimecast20190719 header.b=Hexjjick; spf=pass (imf25.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=1675281157; a=rsa-sha256; cv=none; b=LMqIijBQQRY7cYxLi6k5UhWn9aOFrWm2YzSfEULCSA59o5/qiqEw75g2uiBu9XeDF9n43m CJNSM8ttnOr8DI1FRGkxWGDULJh+4lNlwH3Q9vEqlqacCZZEI7ACFje+B6mKN6jDaJ19Tu XH9cTZMa+UgPICJCKh7wqWw/E8B0/CU= DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1675281156; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc; bh=sTvWe2kfUoGBfAaCSxydSPRezZXDlplO8iSUUltKQvQ=; b=HexjjickBLqSiiLFNqjd58OwbBcmMi1Bb/cBcTJo7gJVMBs04khcG6VHPVuXvSC5a4K7BO E69k28XdYMLVY+8ww4KDg6++7IQw2OHSGIujnKlU/tqI7eGcVsL2Y+YnRUhiLps/JrdP0W 1/ManAhdxqNi/Ei8rMvO/3lNEnYiDr4= 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-664-FlzSg14TO-WC0NOa6ALVgw-1; Wed, 01 Feb 2023 14:52:30 -0500 X-MC-Unique: FlzSg14TO-WC0NOa6ALVgw-1 Received: from smtp.corp.redhat.com (int-mx09.intmail.prod.int.rdu2.redhat.com [10.11.54.9]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 4975A2806051; Wed, 1 Feb 2023 19:52: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 F40FD492B06; Wed, 1 Feb 2023 19:52:29 +0000 (UTC) Received: by tpad.localdomain (Postfix, from userid 1000) id 0A274403C1B83; Wed, 1 Feb 2023 16:51:49 -0300 (-03) Message-ID: <20230201195013.881721887@redhat.com> User-Agent: quilt/0.67 Date: Wed, 01 Feb 2023 16:50:13 -0300 From: Marcelo Tosatti To: Christoph Lameter Cc: Aaron Tomlin , Frederic Weisbecker , Andrew Morton , linux-kernel@vger.kernel.org, linux-mm@kvack.org Subject: [PATCH 0/5] fold per-CPU vmstats remotely X-Scanned-By: MIMEDefang 3.1 on 10.11.54.9 X-Rspam-User: X-Rspamd-Server: rspam03 X-Stat-Signature: hmxmhxz96c7idnh9ftk7g5drj33sz5t4 X-Rspamd-Queue-Id: 6DFC1A0011 X-HE-Tag: 1675281157-787319 X-HE-Meta: U2FsdGVkX1+yVwdL0ERQKzRfJQGoY5K5nzwYlFjd6jiXxgQxkH43Wz/Djqebx9yQOB8Ftw3bEvOkiLBM02B/omNoqGSXv0eDkuegKdVY/i+pmhsUw5EpAPz0tQCsSbkYueD3xERlqyeN3FFQqgISwQC/E9czbIlbjQbYclw93Te0Dl01YAH1vecmTtGNLgg2I4fFbCBcW5M1De8KwjEf9PTt88BI+M6jmZXJN81TZdND0YrCLoxjAz7kloX/RMJVV3IiCrIQ7EcU3534W5Ub+CJaNjS3rKtx08jMtgQSeqUZP4AaQDyXYsZU/wFTUzIkFEtj1SFdWLvs09cphYouwaEafarnXxQE9vGuEaAe3KLdoxeL4FKTAKFXg1n1a48Sa/Eu0EQ4QHFhP1F84+MRQEL+IkYGJiJ+zKXgyp3APvK3kDnm3/+sg8VJrp1sQIhVUBnoOMwiDupSVKONSFejlKGyNKChEt8BYBCOXnYxWm2MzkMZkcmtQoU812fJsQRda9Fy9tJML7JVcinwQGdPOEBHm0JO/qsfPcsGLNXVK4SUo56lrfn2cYwkzfuDREB+BAKcMt0CSHyAqk05TDD1IWRFQcTlwSin8+O/CPzOwWsV9I7FpiN57uut5HbJ6R7BahRVR2E9oWUuGpCjwTdBkBQfv+z5ov6ZXS3/WKfjAjZCSkBtdbvq2CbO4gKXTAuvbsAereGiEZN4Mhpb3v3/7IjmzkQl3aVNqwHYo7e/w/ngY5riKMuE6y79JmX19YIcAg8RVOw8AQk/loq+v/JWvuc34dZvZeyTC3aG37LdM4SdQTRfBcccw4tuluCUYXgy+vy1aDMwnjuksFAjlGwRxG5K6l6fjDpCUe9dPq4w/vvW8/GtyCqzoJU/hvC4+pKBNg0PsfdN6eOPANGg/UuDSiGKfuAtAxTpcViEWpYfK3i7+rRgIs5j8l9dgTb/yitqYouyoLb7+6wxAjjfSC6 fXM6mDsR EN30RsfCz1zbSnnR5lmWLAGXKi7+24lqhqCn9n2n2nhtHvMseEmlvDHUzWNfsAPu7EdnvijXa0iVjDV+HqyVCgBhZcpiF0Te93fjHLJ5wvG11kOxjxUhC7k3F2w== 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: 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. include/linux/mmzone.h | 3 mm/vmstat.c | 424 ++++++++++++++++++++++++++++++++++++++++++++++++------------------------------------------ 2 files changed, 230 insertions(+), 197 deletions(-)