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 A262CC5479D for ; Mon, 9 Jan 2023 16:08:01 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id BCE308E0002; Mon, 9 Jan 2023 11:08:00 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id B7E898E0001; Mon, 9 Jan 2023 11:08:00 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id A460A8E0002; Mon, 9 Jan 2023 11:08:00 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0012.hostedemail.com [216.40.44.12]) by kanga.kvack.org (Postfix) with ESMTP id 946A68E0001 for ; Mon, 9 Jan 2023 11:08:00 -0500 (EST) Received: from smtpin29.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay06.hostedemail.com (Postfix) with ESMTP id 5C9AFA419F for ; Mon, 9 Jan 2023 16:08:00 +0000 (UTC) X-FDA: 80335741920.29.9BFB4F2 Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) by imf15.hostedemail.com (Postfix) with ESMTP id 87541A0027 for ; Mon, 9 Jan 2023 16:07:58 +0000 (UTC) Authentication-Results: imf15.hostedemail.com; dkim=pass header.d=redhat.com header.s=mimecast20190719 header.b=X5z4BZy0; spf=pass (imf15.hostedemail.com: domain of mtosatti@redhat.com designates 170.10.133.124 as permitted sender) smtp.mailfrom=mtosatti@redhat.com; dmarc=pass (policy=none) header.from=redhat.com ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1673280478; 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: in-reply-to:in-reply-to:references:references:dkim-signature; bh=2SQ2EfGPkJFKwdsmUYnmI+8rY4vbT4v8q8/Oih2chZ8=; b=jVUqHzSQM2eYhY8wJs8BKywxiwUazhb/TGYSv3D+oMaT2phX6btKyaXZPojryU7PtoTx1e WdMJJRIgRUu5eA/SE45VW823BsBZ0RRhtqSh9bjJvluuLVyoicEK607h2Ms2dKsQbpMt43 VD3LrJLEovzir8m2zIVjBH5ytNLONac= ARC-Authentication-Results: i=1; imf15.hostedemail.com; dkim=pass header.d=redhat.com header.s=mimecast20190719 header.b=X5z4BZy0; spf=pass (imf15.hostedemail.com: domain of mtosatti@redhat.com designates 170.10.133.124 as permitted sender) smtp.mailfrom=mtosatti@redhat.com; dmarc=pass (policy=none) header.from=redhat.com ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1673280478; a=rsa-sha256; cv=none; b=vk54Njk8VqgDq49iqAHkWdtxBT+f43oCiMh5cfkMFuRgGqXmZn5GzQFQ3YcrsIT3KVdslq HS7XN6OqvNDc1fvWz9e8YazlvsoJtU9FV/AspcTJ/VeFAi7a7qjsab/8uq+R61ovLZgSWj 1LhCOnBUQq3jDujJxdvPXOqFD/4Z+nI= DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1673280477; 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=X5z4BZy0Zr0tugmuKPwvFTjOoGN852MXI+s432woCzatFJcHWGus/zp/WawFbsePGuNMyT 5Pz6LFb4KuISrusDfxU6Mgn9BLLwMv9QvkCBhnEsYCtWHNmXpLRad3Xkoy32PqLfpVb5Oh tNiVcrI5LHLRj/iqLJJzylAsTIqUW5k= 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-Rspam-User: X-Rspamd-Server: rspam04 X-Rspamd-Queue-Id: 87541A0027 X-Stat-Signature: r66fzhnrew1xq9wmgz57xoeb54aeyrgs X-HE-Tag: 1673280478-649920 X-HE-Meta: U2FsdGVkX18wISY99Hf1R0Z9e1hH/0JtNKJf8LPmzY765w5PPRE7iNR+no0KaB/o3k2cCNNmOpAMUIBerf1Y3MrFmzvHe/Vu4SpdBeMoiX26tJDnN9VyYn4f7LrzknN95/0XBVIjUMU9ZkmYLgeJbuPBZ3PkFu/9A92EN1Nq15T5Ogc1M4iRuPtK3sTdLHuwoaHNOfeEDjpNLZV0jL3xL/T01RMDto8T6CTVY4DCF8gLUdX3fFXTskaMfZqd0Q6K5vd9j/ccFtGijdfCjXu2avSuam3YbIwVMTa2L6UpJCheN2EacMCOsiz/uNm+P0d2lIWssho0aAoDmgb3rMHff828PLoI0o0ROThDNHJBATqge0pZK7u8AarJ03gDFuzostt/z+v6u3fPXJNWuWvVK/7cLX5P2/LT4rjJoX+gtYMRTr1wtotFTwV7gMCXL8sNKPX11yykbssS/+nvmRxZyPCDa59anYvs0u0hfpXXg/FzVXRKLz1lfX2ydxarGJuBSvHHOCKZWfI5/6/Ub+Us/ELCNHXCpeR0XSpm5F/N+A9GDu92T/75hEMuLI24PGy7Jhi2lpxTOgxYM1sezoqS+EaAwnQ7hsBXcT4HxCr6ogqWPZ4NS+pOb+DYQIB+ieL54jObhNFBca21FRquet6BVxTnTbz3zKIggtWrUgJh9JCpzuIHAZWGdR99EsJkTVyuIOcZPWsz44YVAZHc3ujd5ch8HQ3Mt0u7wJQun5L9ERmUcgTsoh1tHU/teJRqT0FMTlFwG9fhnsTtC2AlFvm3VyBUkfbczeLJx2uqILlTtV97G8pYjq+QxOBuz0ZhcKKHMzE/7EW5xuYvNr71Le5UsIa2+UFGovjSs6R3HmQu0sykrdHYxelrwg== 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: 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).