From mboxrd@z Thu Jan 1 00:00:00 1970 Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.remote-ip=100.103.45.18 ARC-Seal: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=none; t=1796384014; b=D8WIxPlCviCoQHdUBUOANgs7/KNJey91w9xD4/JKvu/HSyptM0trL7sAgyfhgwweN1f0 dPT4l0R8pSj+/3Jkih0ScZWItYpnaE3bIm6IaaqXfquIaztB+kK2dr20i53uuBe1AmX5E /HoCaR68w/mY9iDDeNFdfFwGpsdqtSBADrdRQ1oZSXnJe0/EdUgZO+/mPX23qf/PGJt5i 3CCrjvIV5hPjkWdEpvMSrZanqhiL7iswV6cnUummqBb8NryFGGFLfPU8zOAIo3B5BkZxZ ofSJAMWdgkCqdBJi+G2ql9svs6TV7RZmgou7O/Gab/9mlMGT/RnhlLbMM9ipysmpX4w== ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1796384014; h=Received:DKIM-Signature:From:To:Cc:Subject:Date:Message-ID:X-Mailer: In-Reply-To:References:User-Agent:X-stable:X-Patchwork-Hint: MIME-Version:Content-Transfer-Encoding; bh=EgJlwv9j2Reks5d9N+2bhD5aTGpPxnYTvGOVsh75wg0=; b=TpzUiBSV/H6aGgjj5k8b529+ebVFnVrIT4pyUoc/jkUo7l/GXo7tAT98Qd/xlNN2/F6d k8CV7YuElIT0ZTsocsgKDpqFnpo/j9gEohjhc1SALeQK5bCRvZ4va7RIfSgcI+dUGh0Gg UmqVcF8fte5qhS9WpGx1Oo/NVvKunf8sX2I0+NOSzr62flWyra0ACt9liAMmvg8qVFIPL a+gZL7U1UlRaAdn9Kb5u9XP33CuyCcxNy43qM8AOJxvlCYyXHKHpv0agvArmRN/rxR3Me o/Rx6URmuH4D5zQKzkyRR7Nll99/S+r1BxNmHNictb53lPMQJNMXjM85GBhNYEJyPpA== ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass header.d=linuxfoundation.org header.i=@linuxfoundation.org header.a=rsa-sha256 header.s=korg header.b=K2G+252G; arc=none smtp.remote-ip=100.103.45.18 Received: from smtp.kernel.org (quasi.space.kernel.org [100.103.45.18]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (prime256v1)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id A0E11606A322; Fri, 4 Dec 2026 11:33:34 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.a=rsa-sha256 header.s=korg header.b=K2G+252G Received: by smtp.kernel.org (Postfix) with ESMTPSA id 170F71F000C2; Fri, 4 Dec 2026 11:33:33 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linuxfoundation.org; s=korg; t=1796384014; bh=EgJlwv9j2Reks5d9N+2bhD5aTGpPxnYTvGOVsh75wg0=; h=From:To:Cc:Subject:Date:In-Reply-To:References; b=K2G+252GvrsXhy67yYpOBvpiM5+qANDD0AM78zNgE3r7tre4DHgsgLzBTv3jS8K+z rb6v2zWFy6a8ellykfQs7LCYC9m4QvfBhU3cnJsq3CbdXSjMgxiZPvOlvtFBA5TkYA psorwF35LAPZLFgJ4P+0lomg+bBZTwMgKNIQ7d3g= From: Greg Kroah-Hartman To: stable@vger.kernel.org Cc: Greg Kroah-Hartman , patches@lists.linux.dev, Aveline Noir , SJ Park , Andrew Morton , Wang Xiaolei Subject: [PATCH 6.12 419/555] mm/damon/core: reset watermark wait state on each iteration Date: Fri, 4 Dec 2026 19:07:42 +0900 Message-ID: <20261204100625.696352262@linuxfoundation.org> X-Mailer: git-send-email 2.56.1 In-Reply-To: <20261204100603.988357525@linuxfoundation.org> References: <20261204100603.988357525@linuxfoundation.org> User-Agent: quilt/0.69 X-stable: review X-Patchwork-Hint: ignore X-Mailing-List: patches@lists.linux.dev List-Id: List-Post: List-Help: List-Subscribe: List-Unsubscribe: List-Owner: Precedence: list MIME-Version: 1.0 Content-Transfer-Encoding: 8bit 6.12-stable review patch. If anyone has any objections, please let me know. ------------------ From: Aveline Noir commit 5fe092741502770107a0be7b3885ce55f7761f01 upstream. Patch series "mm/damon: fix watermark state, kunit pid leak and selftest fake pass". Three hotfixes for core, kunit and selftest. Fix kdamond deactivation from missed watermark reset with patch 1. Fix pid leak in kunit test with patch 2. Fix a selftest wrongly passing when it should skip, with patch 3. Note for reviewers. This series is a collection of fixes that were initially developed by different people. Changelog is in each patch. This patch (of 3): Found while reviewing the DAMON source code that if an online commit removes all schemes while kdamond is waiting for watermark activation, the scheme loop becomes empty but min_wait_time keeps the previous positive value. kdamond then keeps sleeping instead of resuming monitoring without schemes. The way to wake up the kdamond again without DAMON is bit complicated. Install a scheme having watermarks that can activate the kdamond again, and remove the scheme again. Doable but cumbersome and complicated. Initialize min_wait_time and init_wait_time on each loop iteration so the wait is calculated from the current schemes and an empty scheme list resumes monitoring. Link: https://lore.kernel.org/20261102144627.88843-1-sj@kernel.org Link: https://lore.kernel.org/20261102144627.88843-2-sj@kernel.org Fixes: da87878010e5 ("mm/damon/sysfs: support online inputs update") Signed-off-by: Aveline Noir Signed-off-by: SJ Park Signed-off-by: Andrew Morton Reviewed-by: SJ Park Cc: Wang Xiaolei Cc: # 5.19.x Signed-off-by: Greg Kroah-Hartman --- mm/damon/core.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) --- a/mm/damon/core.c +++ b/mm/damon/core.c @@ -2077,10 +2077,11 @@ static int kdamond_wait_activation(struc { struct damos *s; unsigned long wait_time; - unsigned long min_wait_time = 0; - bool init_wait_time = false; while (!kdamond_need_stop(ctx)) { + unsigned long min_wait_time = 0; + bool init_wait_time = false; + damon_for_each_scheme(s, ctx) { wait_time = damos_wmark_wait_us(s); if (!init_wait_time || wait_time < min_wait_time) {