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 623C1C433EF for ; Thu, 17 Feb 2022 16:34:22 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id DFA0D6B0074; Thu, 17 Feb 2022 11:34:21 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id DA8E86B0075; Thu, 17 Feb 2022 11:34:21 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id C704E6B0078; Thu, 17 Feb 2022 11:34:21 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0125.hostedemail.com [216.40.44.125]) by kanga.kvack.org (Postfix) with ESMTP id B8FDC6B0074 for ; Thu, 17 Feb 2022 11:34:21 -0500 (EST) Received: from smtpin27.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay02.hostedemail.com (Postfix) with ESMTP id 69C0293D85 for ; Thu, 17 Feb 2022 16:34:21 +0000 (UTC) X-FDA: 79152819522.27.8590BAE Received: from ams.source.kernel.org (ams.source.kernel.org [145.40.68.75]) by imf31.hostedemail.com (Postfix) with ESMTP id 095D620007 for ; Thu, 17 Feb 2022 16:32:10 +0000 (UTC) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id 5EE87B82172; Thu, 17 Feb 2022 16:32:09 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 9C56EC340E8; Thu, 17 Feb 2022 16:32:07 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1645115528; bh=NqMULm1c4evCoSC3Y43MlpFu52DjIZpoMiHrQmzmVgE=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=HQBFigvNbuCaaSAq8YongVPEWhC9BvwTNk+Jc+QNNrBHPxfCyKAXElmXJv12qInKQ JmCPMv5TOMKA7gHM1EJtDlru9KRg4Eebe6+ae/YUAs44A7tFkOxkNNXeZKbyoZFW+r vrFU40lmIi/DvuKhNEuf4zUB/2CJzwPzhPShjhzDccX7gU4Ufqb7zoH+RLMurlWemW tCzQJCpZFxI3TOgtVNt8tX1vsV666Jf9UNIkUwcVZa+qBd7CCvVEAMk9UdwLS+n5/P vgQg04RXal4WmRbOq7s8FyG8DPGAHVWSbiFIcAhVtjig3/rmKqpf2CMqJTiAadMZDw EI8aUcapgfVBA== Date: Thu, 17 Feb 2022 17:32:05 +0100 From: Frederic Weisbecker To: Aaron Tomlin Cc: Aaron Tomlin , Marcelo Tosatti , Christoph Lameter , tglx@linutronix.de, mingo@kernel.org, linux-kernel@vger.kernel.org, linux-mm@kvack.org, Phil Auld Subject: Re: [RFC PATCH] tick/sched: Ensure quiet_vmstat() is called when the idle tick was stopped too Message-ID: <20220217163205.GA748087@lothringen> References: <20220203214339.1889971-1-atomlin@redhat.com> <20220217124729.GA743618@lothringen> <20220217142615.xqtiydixvnumyvei@ava.usersys.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20220217142615.xqtiydixvnumyvei@ava.usersys.com> X-Rspam-User: X-Rspamd-Server: rspam04 X-Rspamd-Queue-Id: 095D620007 X-Stat-Signature: 5p7i5fasi5mudep4yhj1sp74ftws7syw Authentication-Results: imf31.hostedemail.com; dkim=pass header.d=kernel.org header.s=k20201202 header.b=HQBFigvN; dmarc=pass (policy=none) header.from=kernel.org; spf=pass (imf31.hostedemail.com: domain of frederic@kernel.org designates 145.40.68.75 as permitted sender) smtp.mailfrom=frederic@kernel.org X-HE-Tag: 1645115530-386193 X-Bogosity: Ham, tests=bogofilter, spamicity=0.000001, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: On Thu, Feb 17, 2022 at 02:26:15PM +0000, Aaron Tomlin wrote: > On Thu 2022-02-17 13:47 +0100, Frederic Weisbecker wrote: > > So, to make sure I understand, the issue is that with nohz_full, we may > > well enter into the idle loop with the tick already stopped. We may also > > exit from idle without restarting the tick (again only with nohz_full). And > > so this can cause the vmstat to not be flushed upon idle entry. Right? > > Hi Frederic, > > Yes - this is exactly it. > > > > A customer provided some evidence which indicates that the idle tick was > > > stopped; albeit, CPU-specific vmstat counters still remained populated. > > > Thus one can only assume quiet_vmstat() was not invoked on return to the > > > idle loop. > > > > > > Unfortunately, I suspect this divergence might erroneously prevent a > > > reclaim attempt by kswapd. If the number of zone specific free pages are > > > below their per-cpu drift value then zone_page_state_snapshot() is used to > > > compute a more accurate view of the aforementioned statistic. > > > Thus any task blocked on the NUMA node specific pfmemalloc_wait queue will > > > be unable to make significant progress via direct reclaim unless it is > > > killed after being woken up by kswapd (see throttle_direct_reclaim()). > > > That being said, eventually reclaim should give up if the conditions are > > > correct, no? > > > Now if quiet_vmstat() isn't called, the vmstat_work should fix this later, > > right? Or does that happen too late perhaps? > > If I understand correctly, in the context of nohz_full, since such work is > deferred, it will only be handled in a scenario when the periodic/or > scheduling-clock tick is enabled i.e. the timer was reprogrammed on exit > from idle. Oh I see, it's a deferrable delayed work... Then I can see two other issues: 1) Can an interrupt in idle modify the vmstat and thus trigger the need to flush it? I believe it's the case and then the problem goes beyond nohz_full because if the idle interrupt fired while the tick is stopped and didn't set TIF_RESCHED, we go back to sleep without calling quiet_vmstat(). 2) What if we are running task A in kernel mode while the tick is stopped (nohz_full). Task A modifies the vmstat and goes to userspace for a long while. Your patch fixes case 1) but not case 2). The problem is that TIMER_DEFERRABLE should really be about dynticks-idle only and not dynticks-full. I've always been afraid about enforcing that rule though because that would break old noise-free setups. But perhaps I should...