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 C6728C4332F for ; Fri, 16 Dec 2022 16:37:54 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 542208E0005; Fri, 16 Dec 2022 11:37:54 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id 4F1228E0002; Fri, 16 Dec 2022 11:37:54 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 3B9638E0005; Fri, 16 Dec 2022 11:37:54 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0011.hostedemail.com [216.40.44.11]) by kanga.kvack.org (Postfix) with ESMTP id 2921C8E0002 for ; Fri, 16 Dec 2022 11:37:54 -0500 (EST) Received: from smtpin30.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay05.hostedemail.com (Postfix) with ESMTP id EA0B740603 for ; Fri, 16 Dec 2022 16:37:53 +0000 (UTC) X-FDA: 80248726026.30.891B410 Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) by imf12.hostedemail.com (Postfix) with ESMTP id 5B20B40002 for ; Fri, 16 Dec 2022 16:37:52 +0000 (UTC) Authentication-Results: imf12.hostedemail.com; dkim=pass header.d=redhat.com header.s=mimecast20190719 header.b=VgRAR2jj; spf=pass (imf12.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=1671208672; 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=cWScWAvYep77Gyx4lnGZnuqfT5BE0PC8Gj9tWWazPyU=; b=rNloSKfVdFc+h5aq9XwroviRX5+z2cIubgYQ8gVKvlGWSxnl4yPhlyFY1LRsnBFD39BhDO nv7XwMJ+76gu5xmrH9a4HawoKOBQ4G27se7rttFdHpNWXv1agJy+qqD+XUzNL4cdWxmFqV cY92jdVkJiZR4T0+2gSv9MKWUzKPvOo= ARC-Authentication-Results: i=1; imf12.hostedemail.com; dkim=pass header.d=redhat.com header.s=mimecast20190719 header.b=VgRAR2jj; spf=pass (imf12.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=1671208672; a=rsa-sha256; cv=none; b=g/En1So4yBzd6E2NpVVUvPFutprRugYW1Px7GS5UPUlOBE5/hGBnUCc96IS2w4Wx15NNXt resVtVHlJZn+lAiOxHr4Ef+J9wqqFGjvsuJG6r/JOih4YfeHvMprd5Sq64dHer1RPSVXEl lPEv50J2qAH3Um49Kl+IWbiQp3aQktM= DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1671208671; 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=cWScWAvYep77Gyx4lnGZnuqfT5BE0PC8Gj9tWWazPyU=; b=VgRAR2jjm/SQGhzSlJIbDpnpQzNFiEolFlvWW6TnpC4Rg0KcH7B/yfaJL3dMiMCTTQJnAf V261ZVPv5C+pupxy941z/xTIUY8YPMUn4jCeKSlLVbBV1m8pfP8fQAThRb1vCPGARf1bm5 1kzwRxQOt1GoZ3J+VTVBOpTIWkpkDCY= 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-16-Vl2fRmUEPNytzogjf9AdJQ-1; Fri, 16 Dec 2022 11:37:48 -0500 X-MC-Unique: Vl2fRmUEPNytzogjf9AdJQ-1 Received: from smtp.corp.redhat.com (int-mx10.intmail.prod.int.rdu2.redhat.com [10.11.54.10]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id C93881C09070; Fri, 16 Dec 2022 16:37:47 +0000 (UTC) Received: from tpad.localdomain (ovpn-112-3.gru2.redhat.com [10.97.112.3]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 55632400F5A; Fri, 16 Dec 2022 16:37:47 +0000 (UTC) Received: by tpad.localdomain (Postfix, from userid 1000) id 1E8FF401A0FD8; Fri, 16 Dec 2022 13:16:09 -0300 (-03) Date: Fri, 16 Dec 2022 13:16:09 -0300 From: Marcelo Tosatti To: Frederic Weisbecker Cc: atomlin@redhat.com, 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: Re: [PATCH v9 3/5] mm/vmstat: manage per-CPU stats from CPU context when NOHZ full Message-ID: References: <20221206161826.698593151@redhat.com> <20221206162416.474800121@redhat.com> <20221214133302.GA1931356@lothringen> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20221214133302.GA1931356@lothringen> X-Scanned-By: MIMEDefang 3.1 on 10.11.54.10 X-Rspamd-Server: rspam07 X-Rspamd-Queue-Id: 5B20B40002 X-Rspam-User: X-Stat-Signature: 8j9uj4nyojkw6ec8nnzxsbns61y15har X-HE-Tag: 1671208672-813399 X-HE-Meta: U2FsdGVkX1/fHXmz0LCteyEaf2g/dNIsbyJN2ptnQt/3dKxOeUIQ5jqCq7+xCZQdz9BFC7hGpoWch3LZITSPg8Gwfrv0zw+Lboucou+vqVmy2amY8LnNv7cQ/ZCb3K5T6Zoq66FiKgY7Nb+JFpfKZZqHBxPL+neJmn4eGdQ1zv/nAji6H4H2zXZBMXl9ag44ftxYloOBVasySmC/pKMs3yaA+7Hkc4pf7fnueyl3bnOOMUnceYo1Z3pE9hMAoIiiSpUwdFqX8HaJz0X6YcFaWjlcRsW7M4JH86wP78yDLP4MYuvIvNV7HV+m9Xw35DD4HE5UVTepf8nLwJhiURIcJ/JjfVe9/2+jL8vrxXmZw8w23EdBCtYBvEOPsck1X4EwjGAZb7fDRBruvBvatLYpsZzzF/IjgTYQtd80MZQOgIv7sogXo8zfTqcO1RF3n7NI5NomNBjJpWkJliEigJQ5iib6s5JN/45joCpi5TM1rGWArwOuC+VzWWBhmz70lm1eNHkbeIe5x/cYnsrrozXk8RDHgEpDl+B45epwAQVjkyoWf1Oas+OIJMIRT/WA3xPcmcrRu2B4S7Dq8PPYhobdV+2HmzhWj20g3IExHlbiRgKHOyu7lbYOEGRyo2ZJ9MGK6PxNw3a9w/GulEVqknmY+KT9wPKVlwucSL5IYW+k3vVW5gd4kgPERQEIqOtmwMyH3ioZuiQDtTaw2JgXBbVimGtLx4pnX2qRwopypAocSebof/iHgE5HkwmbeJAlXdQkqSpkXcGyrfNsxVgFo3tdE2zwfns5PO42Z3NdKK/N02501218PlkeyDRcDCmypmuECKeSwCDz0MKFFhzaD0UBzutXhiA4rRLPnCzLhiChex15aC/onTH2Fw== 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: On Wed, Dec 14, 2022 at 02:33:02PM +0100, Frederic Weisbecker wrote: > On Tue, Dec 06, 2022 at 01:18:29PM -0300, Marcelo Tosatti wrote: > > static inline void vmstat_mark_dirty(void) > > { > > + int cpu = smp_processor_id(); > > + > > + if (tick_nohz_full_cpu(cpu) && !this_cpu_read(vmstat_dirty)) { > > + struct delayed_work *dw; > > + > > + dw = &per_cpu(vmstat_work, cpu); > > + if (!delayed_work_pending(dw)) { > > + unsigned long delay; > > + > > + delay = round_jiffies_relative(sysctl_stat_interval); > > + queue_delayed_work_on(cpu, mm_percpu_wq, dw, delay); > > Currently the vmstat_work is flushed on cpu_hotplug (CPUHP_AP_ONLINE_DYN). > vmstat_shepherd makes sure to not rearm it afterward. But now it looks > possible for the above to do that mistake? Don't think the mistake is an issue. In case of a queue_delayed_work_on being called after cancel_delayed_work_sync, either vmstat_update executes on the local CPU, or on a different CPU (after the bound kworkers have been moved). Each case is fine (see vmstat_update). > > + } > > + } > > this_cpu_write(vmstat_dirty, true); > > } > > @@ -2009,6 +2028,10 @@ static void vmstat_shepherd(struct work_ > > for_each_online_cpu(cpu) { > > struct delayed_work *dw = &per_cpu(vmstat_work, cpu); > > > > + /* NOHZ full CPUs manage their own vmstat flushing */ > > + if (tick_nohz_full_cpu(smp_processor_id())) > > It should be the remote CPU instead of the current one. Fixed.