Received: by 2002:a05:6358:16cc:b0:ea:6187:17c9 with SMTP id r12csp6431235rwl; Mon, 9 Jan 2023 08:14:57 -0800 (PST) X-Google-Smtp-Source: AMrXdXvflxe5yK5RMy4mgbznaEfEDuCTCVE/29cRhDWqiszCJ0u7ACm/w/0H7RqsnPetYlUtQVaR X-Received: by 2002:a17:903:482:b0:192:f961:c391 with SMTP id jj2-20020a170903048200b00192f961c391mr19707031plb.53.1673280896825; Mon, 09 Jan 2023 08:14:56 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1673280896; cv=none; d=google.com; s=arc-20160816; b=M8DNqGcdX4tY2leo/zmAcI9jDtAuSY9SpR+qO8xsf5nSMDRmwFt+IsWs9NyGfCAIQl NQVkC3CMMxzqhNGy2hgG01WXOTZKjC3evQgdC49bVtUesuI2SsWOd0VvStIAWZEaS34p O3TfZ0bfkIe+i1x44otqFHIivqnUM0hZEJnJf5h5WYV5Ae/65ug9GriMJPmL2TkqEJbJ eNmeXPyXYLjUqE4wQN2XfRO54atjnzI+NJI6Sr8a1XJgue0CWtwozZtk3HJVrbQA8z5l k/AxNj1awITh7SGeBmu+gTvQzjpIUuEQT1CX6EFSqvW4dnP5cy72Yb7D/geQil8ClQ15 P1AQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :references:message-id:subject:cc:to:from:date:dkim-signature; bh=2SQ2EfGPkJFKwdsmUYnmI+8rY4vbT4v8q8/Oih2chZ8=; b=orejjRSgHVjvOr0pp2EmPJY4FK4DLWdXZ2RaZqPU46z4l5o+Pegtd8pVsVQvHqIH4Z YpWgdqVAhs6/A9Y76ljLMMvDI9k3HhffAGYfgvfCgDB6t8VIi088MLoHNrBFPz1u5qDA lJUUOizFLtMdUXmvvzHtNHlLBXLDkP+s8xfBdPbPcVBV4Ycx/irICqX+PPF5aYN8z8B7 1qYg3jtC5LMsrVc4rBFmVsk4M9gIBVEshvyx8zpzjBYyeYoCMoiVGk9eU6VUlpgeEo4i 2yGyoxrnyHh3XsX2oVpLlyJ48Apo4KIi1o7/aCYdVuKNW9idvDIvb3Spj2q9dsFqs8CS QqBg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=D7h1pVkB; 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 e3-20020a170902cf4300b0019269969d09si9060431plg.319.2023.01.09.08.14.50; Mon, 09 Jan 2023 08:14:56 -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=D7h1pVkB; 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 S237191AbjAIQI4 (ORCPT + 53 others); Mon, 9 Jan 2023 11:08:56 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:44980 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229537AbjAIQIl (ORCPT ); Mon, 9 Jan 2023 11:08:41 -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 BF3DD392CF for ; Mon, 9 Jan 2023 08:07:56 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1673280475; 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: in-reply-to:in-reply-to:references:references; bh=2SQ2EfGPkJFKwdsmUYnmI+8rY4vbT4v8q8/Oih2chZ8=; b=D7h1pVkBlRaW46I5D6xUCAjhdLecOVP/cKct/NVMW2n+kCRSZeCVOtlkWAIuX1nzK8MTR/ Nc8JqSzU/mnj2tdgJgw5Z7x+sxg8iO9n9GZUNB9xOvJILPeSh8cSlaEMx8Hf4GJl7Ix8lk pFmNaXeAQL46PyxKJZ/SkucVFj52oAI= 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-100-KiewLg1IP5COvWNbRixStg-1; Mon, 09 Jan 2023 11:07:52 -0500 X-MC-Unique: KiewLg1IP5COvWNbRixStg-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 E37BE3C02B74; Mon, 9 Jan 2023 16:07:51 +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 82B5D1121314; Mon, 9 Jan 2023 16:07:51 +0000 (UTC) Received: by tpad.localdomain (Postfix, from userid 1000) id 42B0A4050992C; Mon, 9 Jan 2023 11:12:49 -0300 (-03) Date: Mon, 9 Jan 2023 11:12:49 -0300 From: Marcelo Tosatti To: Hillf Danton Cc: atomlin@atomlin.com, frederic@kernel.org, linux-kernel@vger.kernel.org, linux-mm@kvack.org Subject: Re: [PATCH v13 3/6] mm/vmstat: manage per-CPU stats from CPU context when NOHZ full Message-ID: References: <20230105125218.031928326@redhat.com> <20230106001244.4463-1-hdanton@sina.com> <20230106150154.4560-1-hdanton@sina.com> <20230107001529.4617-1-hdanton@sina.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20230107001529.4617-1-hdanton@sina.com> 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 Hi Hillf, On Sat, Jan 07, 2023 at 08:15:29AM +0800, Hillf Danton wrote: > On 6 Jan 2023 15:16:23 -0300 Marcelo Tosatti > > On Fri, Jan 06, 2023 at 11:01:54PM +0800, Hillf Danton wrote: > > > On 6 Jan 2023 09:51:00 -0300 Marcelo Tosatti > > > > On Fri, Jan 06, 2023 at 08:12:44AM +0800, Hillf Danton wrote: > > > > > > > > > > Regression wrt V12 if timer is added on the CPU that is not doing HK_TYPE_TIMER? > > > > > > > > Before this change, the timer was managed (and queued on an isolated > > > > CPU) by vmstat_shepherd. Now it is managed (and queued) by the local > > > > CPU, so there is no regression. > > > > > > Given vm stats folded when returning to userspace, queuing the delayed work > > > barely makes sense in the first place. If it can be canceled, queuing it burns > > > cycles with nothing earned. Otherwise vm stats got folded already. > > > > Agree, but you can't know whether return to userspace will occur > > before the timer is fired. > > No way to predict a random timer expiration, no? Right. > > > > So queueing the timer is to _ensure_ that eventually vmstats will be > > synced (which maintains the current timing behaviour wrt vmstat syncs). > > After this change, > > > > > > > @@ -1988,13 +2022,19 @@ void quiet_vmstat(void) > > > > > > if (!is_vmstat_dirty()) > > > > > > return; > > > > > > > > it is only ensured eventually by this check instead. Yes, but if you do not return to userspace, then the per-CPU vm statistics can be dirty indefinitely. > > > > > > + refresh_cpu_vm_stats(false); > > > > > > + > > > > > > + if (!IS_ENABLED(CONFIG_FLUSH_WORK_ON_RESUME_USER)) > > > > > > + return; > > > > > > + > > > > > > + if (!user) > > > > > > + return; > > > > Also don't think the queueing cost is significant: it only happens > > for the first vmstat dirty item. > > Cost is considered only if it is needed. Not sure i understand what you mean (or whether there is any alternative to the timer).