Received: by 2002:a05:6358:16cc:b0:ea:6187:17c9 with SMTP id r12csp3163900rwl; Tue, 27 Dec 2022 05:22:37 -0800 (PST) X-Google-Smtp-Source: AMrXdXtswSp1KHNjbZO31ttYbBwn+jnYQ4JJeOw0MRYa0q2ACZVTMbk6s1tfdififkXyDpwqc8zR X-Received: by 2002:a17:90b:2412:b0:212:de1a:3559 with SMTP id nr18-20020a17090b241200b00212de1a3559mr28391288pjb.8.1672147356772; Tue, 27 Dec 2022 05:22:36 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1672147356; cv=none; d=google.com; s=arc-20160816; b=Bl4oMorQR9IMbCTizwe5h1VXoE+ojY3xhgKzoGDPne38PM05P8txeZWIuoyNBqNEoF kEw5yHnjiWsNhcsbqiKetLc9VTQQfk2tViTYvfKZIbaY2zCOVPgW2fMiZi8ZUC1QH9tA 3XXmJ6MND5zj/QaseTPeG9rk3qtgWNEEkIrs0z8jg+vp2tm6wbGDD5JqGQ7Sdyo2GhE4 3QLIC6DW4WdiseHSV7htJvMo7ywdT2YiHT/2dwf2CHu73c9G7oFyOGBphSyN8oP4FWWz jvcbml7cOPh0G5/K41pj1vujoaNDb6GdTt5Kc8PdYjDc1eEmX25cBwyLzaHskndUma0r 2oIQ== 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=P2lTa3Es7tRW3Ukk99fzE0c9lNfhJ9xT5tujn8gx3Kj/+1PRvR6n+FRBeZhZwDmzd1 ypawngZe4eQLfPra4gUzJxfQr/RGUYwAIQ66Qwkc+M45LYCS5qpJOm+Qr6HGM+nDg1LA EQ1KU3Jf5uCc6fr9P5gi2lmLJpmjTN41Yx6I/4/YSCkfoXnNQMsW+Hauj6/ZClG1Svls wja+hF0nAd9iygOeqXWM7yhOdu4xNXstHH8DvCaBKNtXPjNkk0BgYsgnVkur87B3bWAX fktLhct8hJllVkuP1myr6m6ialq1T0gVrE2S73le8VqGD+AnQf3axthLSjyT/dNNqsOr wJGQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=P1lucjZq; 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 pw10-20020a17090b278a00b00225f3e34336si5723676pjb.89.2022.12.27.05.22.26; Tue, 27 Dec 2022 05:22:36 -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=P1lucjZq; 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 S231448AbiL0Mha (ORCPT + 66 others); Tue, 27 Dec 2022 07:37:30 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:43224 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229987AbiL0MhX (ORCPT ); Tue, 27 Dec 2022 07:37:23 -0500 Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 8575410B for ; Tue, 27 Dec 2022 04:36:36 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1672144595; 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=P1lucjZqSHng4BMKDHfWovm2puO7XSK2+wHkKHb4502oxWDmLCL+VnWZD3V+KNJRUScVrn WQpYfAwUzRuwquLpTpp4smql/R5LCu/A48vblaeUCB1wZ6j/EsmOCPXAOpNg3dpcz98/Uh o2ggPNwrR063i3WAdt3KMRAs99K5DKc= 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-434-dM8Hsox4PtyMTRv7NbIZzw-1; Tue, 27 Dec 2022 07:36:32 -0500 X-MC-Unique: dM8Hsox4PtyMTRv7NbIZzw-1 Received: from smtp.corp.redhat.com (int-mx03.intmail.prod.int.rdu2.redhat.com [10.11.54.3]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id ED6432803D61; Tue, 27 Dec 2022 12:36:31 +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 7AA29111F3BB; Tue, 27 Dec 2022 12:36:31 +0000 (UTC) Received: by tpad.localdomain (Postfix, from userid 1000) id B6A704052AA30; Tue, 27 Dec 2022 09:14:52 -0300 (-03) Message-ID: <20221227121341.940831921@redhat.com> User-Agent: quilt/0.66 Date: Tue, 27 Dec 2022 09:11:38 -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 v12 1/6] mm/vmstat: Add CPU-specific variable to track a vmstat discrepancy References: <20221227121137.102497574@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 X-Scanned-By: MIMEDefang 3.1 on 10.11.54.3 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) {