Received: by 2002:a05:6358:d09b:b0:dc:cd0c:909e with SMTP id jc27csp7777122rwb; Tue, 6 Dec 2022 09:41:52 -0800 (PST) X-Google-Smtp-Source: AA0mqf74YC8jza6iw998koYwgUz0WUIX/s4XOHFtqMEygJrtD4EoEn+6jQG79oMSRpd022s+7t8R X-Received: by 2002:a17:906:fa11:b0:7c0:d94c:f9f with SMTP id lo17-20020a170906fa1100b007c0d94c0f9fmr11687245ejb.542.1670348512208; Tue, 06 Dec 2022 09:41:52 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1670348512; cv=none; d=google.com; s=arc-20160816; b=EsUbwk5+Ns6WQofWUXK5e3eILJlGxvjccfXZHXWmV44vHDoXqlWJC9fjSiuU0v6xQ7 VH3CVjhB/FLywSgE2ofv1wZpfcBQLilfGCtgvdygHhba5CkWFSHs4k1A9oE/vqNEuArW OgA1skxYIZex4/4qwTi5B/Gkx282AV+CiGvA0zZoZiYs8Vz/S543d/Rfjig8tV+EX4aA SEYoNJNTjW6EccB/G+/RwVEuAJFNrse8jp7m+qxiy2BTKcf+k1kXAXPM3HcGX/O9jSu6 G7bYgiCyt5F/vMoEF134bmPvX5szv2nye1zxfbn0RRwbMOXLbBMmv9s2iCOIiSSJkM9B LX5Q== 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=AOGSNl4F+a3U3QMjdXFvMaoAelsGXf+7OuteK4kgbOQ=; b=SOFvOW6paeTXETfkdLPxUPkQRZxR5VrymqNaCS+MGUhARpISTKWzQdukWbjyMuiVk2 LD+uZq0p8rzd21aAIV9d+GM/ziSwVcBkIK5OI/nRjGxEK3mjGUMEiGuZUi2mtX5uqxdS qrwypa6LDnrtm993jzMcpCUVaQ01lBSgER+2l8MKNrMYw0PyL4FV7Szi7sUUJ/I1KBBA +KuRs1JIJXvA6bQhPVfazs7nWgzGzQ3DEA1yBsSVmDA1CyZHP65/QBNDk1RzmfXvjzys 7APBcGW3T9qFFjYgJsowoARX7jv7UvX9g905FZ970MpA3+8EWJoBlNKOtvI6iZ24HR2C xTeg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=apmSbAnu; 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 Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id hg4-20020a1709072cc400b007aeec2bf18fsi15784228ejc.543.2022.12.06.09.41.34; Tue, 06 Dec 2022 09:41:52 -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=apmSbAnu; 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 S233864AbiLFRUx (ORCPT + 77 others); Tue, 6 Dec 2022 12:20:53 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:54106 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234959AbiLFRUn (ORCPT ); Tue, 6 Dec 2022 12:20:43 -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 1312932B97 for ; Tue, 6 Dec 2022 09:19:46 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1670347186; 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=AOGSNl4F+a3U3QMjdXFvMaoAelsGXf+7OuteK4kgbOQ=; b=apmSbAnuaIRWRpASA6QfIAM7ldu1LizDoN0a6DdmAymU4cyL+T9919zH6ogNmc5LuOozp/ 1LqzIHBjjB7FhiIB1vMgUcTMbBLEraPBzfvY3QQFNH7xcK88VYnHAEhNMuncZAtebXrtEL lE2d3h+hU4s/T0JsR9PKNfIVMOcNpZk= 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-77-72YglCZgPLy4WsvxS_4UwQ-1; Tue, 06 Dec 2022 12:19:43 -0500 X-MC-Unique: 72YglCZgPLy4WsvxS_4UwQ-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 0959D886469; Tue, 6 Dec 2022 17:19: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 7885149BB60; Tue, 6 Dec 2022 17:19:41 +0000 (UTC) Received: by tpad.localdomain (Postfix, from userid 1000) id C26B1409005D6; Tue, 6 Dec 2022 13:31:40 -0300 (-03) Message-ID: <20221206162416.404740300@redhat.com> User-Agent: quilt/0.66 Date: Tue, 06 Dec 2022 13:18:27 -0300 From: Marcelo Tosatti To: atomlin@redhat.com, frederic@kernel.org Cc: cl@linux.com, tglx@linutronix.de, mingo@kernel.org, peterz@infradead.org, pauld@redhat.com, neelx@redhat.com, oleksandr@natalenko.name, linux-kernel@vger.kernel.org, linux-mm@kvack.org Subject: [PATCH v9 1/5] mm/vmstat: Add CPU-specific variable to track a vmstat discrepancy References: <20221206161826.698593151@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 X-Scanned-By: MIMEDefang 3.1 on 10.11.54.9 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: X-Mailing-List: linux-kernel@vger.kernel.org From: Aaron Tomlin 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(+) Index: linux-2.6/mm/vmstat.c =================================================================== --- linux-2.6.orig/mm/vmstat.c +++ linux-2.6/mm/vmstat.c @@ -194,6 +194,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) {