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 318F6C02198 for ; Mon, 10 Feb 2025 10:52:33 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 7F9CC6B007B; Mon, 10 Feb 2025 05:52:32 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id 7A8B76B0083; Mon, 10 Feb 2025 05:52:32 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 698446B0085; Mon, 10 Feb 2025 05:52:32 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0010.hostedemail.com [216.40.44.10]) by kanga.kvack.org (Postfix) with ESMTP id 4B81A6B007B for ; Mon, 10 Feb 2025 05:52:32 -0500 (EST) Received: from smtpin06.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay09.hostedemail.com (Postfix) with ESMTP id 713B680C42 for ; Mon, 10 Feb 2025 10:50:49 +0000 (UTC) X-FDA: 83103717060.06.A00B5FF Received: from mail115-95.sinamail.sina.com.cn (mail115-95.sinamail.sina.com.cn [218.30.115.95]) by imf10.hostedemail.com (Postfix) with ESMTP id 78A39C0006 for ; Mon, 10 Feb 2025 10:50:45 +0000 (UTC) Authentication-Results: imf10.hostedemail.com; dkim=none; dmarc=none; spf=pass (imf10.hostedemail.com: domain of hdanton@sina.com designates 218.30.115.95 as permitted sender) smtp.mailfrom=hdanton@sina.com ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1739184646; a=rsa-sha256; cv=none; b=BFWez1YYVLi7ul3ObpjL7rofuNaic958qXLz4dDxcKPVlLAMTN3ibZxjwyw6SxsdRUWqBe meDCfjq2ZnGu6hvsyPEhkTr3ZieQAYbIkxY3tBwE+lUStkE0qd86NZYAnqBzh7YluMFX07 CVmZF1VBGOOoZ/LhauNCBDKwooalsOs= ARC-Authentication-Results: i=1; imf10.hostedemail.com; dkim=none; dmarc=none; spf=pass (imf10.hostedemail.com: domain of hdanton@sina.com designates 218.30.115.95 as permitted sender) smtp.mailfrom=hdanton@sina.com ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1739184646; 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-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=RE2CLBd5FWvt9TF8X/ZNossbgGrm4fdYKzFDOotSHzY=; b=HH1JJtOwT4Z+H4COTrwndWHC4KgPRxsZUlM5n3JGaIuLAG7mefO1zW2u6zid0doAUSNhG6 g6XiH1LlmqSSST3oh/1GBo41u3taq3qO9frksNd7hBNqPXUJ0Pb6e1UAiMyD/lDyDFKuv9 EwUU+vrbfd/FCBM/sTs54pA8uJCMZN8= X-SMAIL-HELO: localhost.localdomain Received: from unknown (HELO localhost.localdomain)([113.88.48.71]) by sina.com (10.185.250.23) with ESMTP id 67A9D9FD00005AAF; Mon, 10 Feb 2025 18:50:39 +0800 (CST) X-Sender: hdanton@sina.com X-Auth-ID: hdanton@sina.com X-SMAIL-MID: 767478913065 X-SMAIL-UIID: E840C1D2B535480A879B6F2B8A5037B5-20250210-185039-1 From: Hillf Danton To: Frederic Weisbecker Cc: Marcelo Tosatti , Andrew Morton , Michal Hocko , linux-mm@kvack.org, LKML Subject: Re: [PATCH 6/6 v2] mm: Drain LRUs upon resume to userspace on nohz_full CPUs Date: Mon, 10 Feb 2025 18:50:26 +0800 Message-ID: <20250210105028.2134-1-hdanton@sina.com> In-Reply-To: <20250209223005.11519-7-frederic@kernel.org> References: <20250209223005.11519-1-frederic@kernel.org> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Rspamd-Server: rspam02 X-Rspamd-Queue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RQNl2YTIlxFN9T3H+l7cIGhFvydCEhlpM7vg9jaICry5kg1O1jFB3DuALGWLRuQnASnMqgTbtnuvu7mYUKNeOLYt8iLoPv/cRp+c+MzR6Zl5tMLIsatH8itSm21aV6yLhV8lP5JPFNXPM4bIBMDonjHzLoCHA4pfrSUGiziASWtoYGuTUFSh+tT9/mu3N60yo9tewIs6KkxwRr/Y3FrdCXtFCrhCMU+6EGI 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: List-Subscribe: List-Unsubscribe: On Sun, 9 Feb 2025 23:30:04 +0100 Frederic Weisbecker > @@ -769,6 +772,9 @@ static bool cpu_needs_drain(unsigned int cpu) > { > struct cpu_fbatches *fbatches = &per_cpu(cpu_fbatches, cpu); > > + if (!housekeeping_cpu(cpu, HK_TYPE_KERNEL_NOISE)) > + return false; > + > /* Check these in order of likelihood that they're not zero */ > return folio_batch_count(&fbatches->lru_add) || > folio_batch_count(&fbatches->lru_move_tail) || > -- > 2.46.0 Nit, I'd like to add a debug line to test your assumption that isolated tasks are pinned to a single nohz_full CPU. --- x/mm/swap.c +++ y/mm/swap.c @@ -767,9 +767,10 @@ static void lru_add_drain_per_cpu(struct static bool cpu_needs_drain(unsigned int cpu) { struct cpu_fbatches *fbatches = &per_cpu(cpu_fbatches, cpu); + bool yes; /* Check these in order of likelihood that they're not zero */ - return folio_batch_count(&fbatches->lru_add) || + yes = folio_batch_count(&fbatches->lru_add) || folio_batch_count(&fbatches->lru_move_tail) || folio_batch_count(&fbatches->lru_deactivate_file) || folio_batch_count(&fbatches->lru_deactivate) || @@ -777,6 +778,12 @@ static bool cpu_needs_drain(unsigned int folio_batch_count(&fbatches->lru_activate) || need_mlock_drain(cpu) || has_bh_in_lru(cpu, NULL); + + if (!housekeeping_cpu(cpu, HK_TYPE_KERNEL_NOISE)) { + VM_BUG_ON(yes); + return false; + } + return yes; } /*