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 07DFAC07E9D for ; Sat, 24 Sep 2022 15:22:40 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 554C08E0009; Sat, 24 Sep 2022 11:22:40 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 502CB8E0007; Sat, 24 Sep 2022 11:22:40 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 3567A8E0009; Sat, 24 Sep 2022 11:22:40 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0014.hostedemail.com [216.40.44.14]) by kanga.kvack.org (Postfix) with ESMTP id 219A48E0007 for ; Sat, 24 Sep 2022 11:22:40 -0400 (EDT) Received: from smtpin20.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay07.hostedemail.com (Postfix) with ESMTP id F20CD160EE8 for ; Sat, 24 Sep 2022 15:22:39 +0000 (UTC) X-FDA: 79947346038.20.1078604 Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) by imf13.hostedemail.com (Postfix) with ESMTP id 6E52F2000E for ; Sat, 24 Sep 2022 15:22:39 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1664032958; 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=TJy6J71aJA3IuazPVpZvOJ+o0HTfRS9wHinNTI5//yw=; b=LKhyTp7KeZbz1zbj1VPQo27peVVbEbBMgUUxhtdEatQm0oEMt+ooaQ1maomwp5xOewi5i0 z5g8cmmOhPvupqS9iwiOS/mV/BHrF9HRJETqX3joIeyB8KKyxo4QovU4Eu8/cFvfVrdT/1 i89aCGVJIfYRycI6PFroh7+O0AYuEIw= Received: from mail-wm1-f69.google.com (mail-wm1-f69.google.com [209.85.128.69]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_128_GCM_SHA256) id us-mta-282-eYzHn1zlOcKITVqMQXxLQQ-1; Sat, 24 Sep 2022 11:22:36 -0400 X-MC-Unique: eYzHn1zlOcKITVqMQXxLQQ-1 Received: by mail-wm1-f69.google.com with SMTP id p36-20020a05600c1da400b003b4faefa2b9so1629249wms.6 for ; Sat, 24 Sep 2022 08:22:35 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date; bh=TJy6J71aJA3IuazPVpZvOJ+o0HTfRS9wHinNTI5//yw=; b=B6Q+dreccql9k7pHINyoND27sMqAZ5EeXkdtKTW9WrVlUTijtPBEoV2kkmxe/7w7BH GdyKE1j+nQbTPAyYqewrDHz5fOzGzbEJTJ1PrlT2RE1lgaNsdgz6BGMVBMfJWwFF4GUQ DRmqyu902NZ0f2KNA9QJL+Bx2+Rxo+ZysjgIDWfzht2sY6hWSh7s8qLGt4/PrH5sMxXH 2iaeMWcpEOQOEHNk1sB9VjkmdVnIBikRyWsIYVfOO8tBLZnCo/myeONaQDrZqOn1b4M+ ofUAO7uog3qVHelwTBZrcaprdskYgnDf/GSLOZSCdoHK1RUoxDPXgsnRoCnlStGUIvb2 3xPw== X-Gm-Message-State: ACrzQf0xNPh8fjYZf794LXsYdI6PP4F5z/HIHJYoMAORcQlyyW+MNVcn Y1CXk39XKCm+ykw1yveICiMvMBXyWYq/dZBNwkQThGnSNaS+dmq1FX+wDl43MR43STgqZamCYjd 5rMQb6lLVkw== X-Received: by 2002:adf:fd47:0:b0:228:dbab:8f5d with SMTP id h7-20020adffd47000000b00228dbab8f5dmr8180137wrs.524.1664032954966; Sat, 24 Sep 2022 08:22:34 -0700 (PDT) X-Google-Smtp-Source: AMsMyM6sU8DZqkudooT7dcV2k2CxDwD6Eg+x8I5ijbDfegC963F4VJd1EaU/hhsShwvAdgEZ3nK3Sg== X-Received: by 2002:adf:fd47:0:b0:228:dbab:8f5d with SMTP id h7-20020adffd47000000b00228dbab8f5dmr8180125wrs.524.1664032954760; Sat, 24 Sep 2022 08:22:34 -0700 (PDT) Received: from localhost (cpc111743-lutn13-2-0-cust979.9-3.cable.virginm.net. [82.17.115.212]) by smtp.gmail.com with ESMTPSA id p21-20020a1c5455000000b003b27f644488sm5396182wmi.29.2022.09.24.08.22.29 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 24 Sep 2022 08:22:29 -0700 (PDT) From: Aaron Tomlin To: frederic@kernel.org, mtosatti@redhat.com Cc: cl@linux.com, tglx@linutronix.de, mingo@kernel.org, peterz@infradead.org, pauld@redhat.com, neelx@redhat.com, oleksandr@natalenko.name, atomlin@atomlin.com, akpm@linux-foundation.org, linux-kernel@vger.kernel.org, linux-mm@kvack.org Subject: [PATCH v8 1/5] mm/vmstat: Add CPU-specific variable to track a vmstat discrepancy Date: Sat, 24 Sep 2022 16:22:23 +0100 Message-Id: <20220924152227.819815-2-atomlin@redhat.com> X-Mailer: git-send-email 2.37.1 In-Reply-To: <20220924152227.819815-1-atomlin@redhat.com> References: <20220924152227.819815-1-atomlin@redhat.com> MIME-Version: 1.0 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: 8bit Content-Type: text/plain; charset="US-ASCII"; x-default=true ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1664032959; a=rsa-sha256; cv=none; b=rAOsk7AfwSreMo3ys/0gpHYZV6hwEQWLJKFMjqoBtcHAv2aE1VFq5q0CWrg/2eoLhf5Wgk mC3HShbwIjQytSvHjlO/uYKWHA6Fu4/aZPeWxBlJ+eUXODWbAxzqC0oZzpGKQ8rQh9hqkQ OowrWDo3jWwrQKMbDyVwcloCbZO1oKA= ARC-Authentication-Results: i=1; imf13.hostedemail.com; dkim=pass header.d=redhat.com header.s=mimecast20190719 header.b=LKhyTp7K; dmarc=pass (policy=none) header.from=redhat.com; spf=pass (imf13.hostedemail.com: domain of atomlin@redhat.com designates 170.10.133.124 as permitted sender) smtp.mailfrom=atomlin@redhat.com ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1664032959; 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:content-transfer-encoding: in-reply-to:in-reply-to:references:references:dkim-signature; bh=TJy6J71aJA3IuazPVpZvOJ+o0HTfRS9wHinNTI5//yw=; b=PxJ+35+Rav5iZVMeuxNC5UsvslWbM/ZCCyqD/12kcb5OJEu2MPFiPHsCp2GhJvqK7pgLWP kt8KxABB8EyuHkUEtZNiAnIS5dlXx1eBPtI2IqLGDGLcFPkOE9lDhFXPeKWuMaF+uH2aKT 8YKu6h4ZvIQCek4S/nL/XnjisaF7Je4= X-Rspam-User: X-Rspamd-Queue-Id: 6E52F2000E X-Rspamd-Server: rspam08 X-Stat-Signature: gisogsfd6ykzw4p7y6x6ne8sw7mgcsck Authentication-Results: imf13.hostedemail.com; dkim=pass header.d=redhat.com header.s=mimecast20190719 header.b=LKhyTp7K; dmarc=pass (policy=none) header.from=redhat.com; spf=pass (imf13.hostedemail.com: domain of atomlin@redhat.com designates 170.10.133.124 as permitted sender) smtp.mailfrom=atomlin@redhat.com X-HE-Tag: 1664032959-477343 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: Introduce a CPU-specific variable namely vmstat_dirty to indicate if a vmstat imbalance is present for a given CPU. Therefore, at the appropriate time, we can fold all the remaining differentials. This patch also provides trivial helpers for modification and testing. Signed-off-by: Aaron Tomlin --- mm/vmstat.c | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/mm/vmstat.c b/mm/vmstat.c index 90af9a8572f5..24c67b2e58fd 100644 --- a/mm/vmstat.c +++ b/mm/vmstat.c @@ -195,6 +195,22 @@ void fold_vm_numa_events(void) #endif #ifdef CONFIG_SMP +static DEFINE_PER_CPU_ALIGNED(bool, vmstat_dirty); + +static inline void vmstat_mark_dirty(void) +{ + this_cpu_write(vmstat_dirty, true); +} + +static inline void vmstat_clear_dirty(void) +{ + this_cpu_write(vmstat_dirty, false); +} + +static inline bool is_vmstat_dirty(void) +{ + return this_cpu_read(vmstat_dirty); +} int calculate_pressure_threshold(struct zone *zone) { -- 2.37.1