Received: by 2002:a05:6358:f14:b0:e5:3b68:ec04 with SMTP id b20csp5997956rwj; Wed, 21 Dec 2022 09:29:08 -0800 (PST) X-Google-Smtp-Source: AMrXdXs4ks+EPlrDc8Bf2L8DYQgatmmmBFn9ZifPNej6ep8MI2gnvrzqe8Z8mBJJe706U+/Z/f70 X-Received: by 2002:a17:90a:d0c5:b0:219:ba3d:7ee2 with SMTP id y5-20020a17090ad0c500b00219ba3d7ee2mr2462891pjw.30.1671643748498; Wed, 21 Dec 2022 09:29:08 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1671643748; cv=none; d=google.com; s=arc-20160816; b=gf1OJQkkPFCF8qsUwkRTGpfb773i4FZbTGpfv47MwfcLvNOHRUKtmA7VlXGfJz1la9 hvAH5GFcjZ4nNJ8I/y3b2sN4wppAlfejQ8nfYTXON0hzBNN66PVsSs/PJh433lpmYoy3 yuA2Ye0u4zh5T0TZjkkETYy1YL73UWrUeg+mHisK1agA+U4ky+wq2m0WGoKQWiFEtU2q MAcL/8k7VgyJ1A6U8t/e6gA++RmHfjWWy+oKBZZXWJUWpT3U91AfpVX06rLenTIh/F5k /TYHXR9T/1eRh9W0yqdTwVebeQ9YVjWdPj4OGn8MdoJhV7UAh/HdAtR06/0RElF+BtCn 9daA== 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=A8ptA+mtJpfx4WDFilLLKvFD1fvtEmfC0YGkopBqCFA=; b=zgzT+0paPAiwL4OArJhGyTKvGGkhPvQyv9o8J8JFLC1XXmwkWh+Ptga4Autorc1Riq hsNR/RtaM8f2hjsRI1JpukN8cpdc1E5UWjzqQcxN37I+61s0AGJ7SHPctHQjjHEGDRAN KulCznBILNfWrpkauw7JRd8kbdQCeA0zX4zqb6nZJOiALMNRy9T4Rbj+3dMMBEfiwP9f WH3KtQ0CMZ4h5SCxpYm59fD8XuHaOspg7j/VfHTEvH3DF/NVAdvzdbzHSa0MLNnxQeNF ttJefdtvHjLKwuhm9dyqO1sYOvYr4PbqctzgaYVbqulWvjt7Bthc9YtPBNK0E0ugW5HL Qe5w== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=hIXCUIHH; 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 cx3-20020a17090afd8300b002193e1a906esi2094610pjb.133.2022.12.21.09.28.59; Wed, 21 Dec 2022 09:29:08 -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=hIXCUIHH; 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 S234672AbiLURMX (ORCPT + 67 others); Wed, 21 Dec 2022 12:12:23 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:52580 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234757AbiLURLk (ORCPT ); Wed, 21 Dec 2022 12:11:40 -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 D2FA1DAE for ; Wed, 21 Dec 2022 09:10:51 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1671642651; 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=A8ptA+mtJpfx4WDFilLLKvFD1fvtEmfC0YGkopBqCFA=; b=hIXCUIHHzGe+MD85x6MH7egkv0pTriE1bsa+PbJQ98slfmBirjcq1dNYlTdFB3vckdu95h v1u4I+1teHDkgOI/7sRxXBoOqiYqj4vydI9BjRChqvKhM/wg8Td7UYerx/3sLk1XIwmQAK yXY5kG81S68iKoeu2OECmtepKTMsRNM= 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-591-yibgqVRuNwCx0j0WJvOmOg-1; Wed, 21 Dec 2022 12:10:47 -0500 X-MC-Unique: yibgqVRuNwCx0j0WJvOmOg-1 Received: from smtp.corp.redhat.com (int-mx02.intmail.prod.int.rdu2.redhat.com [10.11.54.2]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id C9029882821; Wed, 21 Dec 2022 17:10:46 +0000 (UTC) Received: from tpad.localdomain (ovpn-112-4.gru2.redhat.com [10.97.112.4]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 9824B40C945A; Wed, 21 Dec 2022 17:10:46 +0000 (UTC) Received: by tpad.localdomain (Postfix, from userid 1000) id 9FC4340408D42; Wed, 21 Dec 2022 14:09:34 -0300 (-03) Message-ID: <20221221170436.252896271@redhat.com> User-Agent: quilt/0.66 Date: Wed, 21 Dec 2022 13:58:02 -0300 From: Marcelo Tosatti To: atomlin@atomlin.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, Marcelo Tosatti Subject: [PATCH v11 1/6] mm/vmstat: Add CPU-specific variable to track a vmstat discrepancy References: <20221221165801.362118576@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 X-Scanned-By: MIMEDefang 3.1 on 10.11.54.2 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 Signed-off-by: Marcelo Tosatti --- 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) {