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=1796389371; b=zyY8doSM70fzSti3JE+9ojZsRxx+cSiar3OO9OPHt0Cs1eWZXYRvuKgIdILEu/idjf+0 g4oX85QwaTkiWBcxuvFaoGD8tjCAOTYfCZxQbzCFWVRpFjvKSvmUQOXolzu8o1Puhw/yk HasRC+T5FboFfCXr9yoEvg6pu+Aw9YCUPGa91/9nWGPtAS7k42my+XkumbZgXEbB/6Vpe 52JtK91Hn6O6uwwtvqO6TP7KxpUFgLZ+y+g1FTSjzKFA7D+hw3IpuCOWkWoS3jBWA2a7P vIrAtHDMn/LNYLGsnMRbHap7eRGSqdU+5ibSM3y/iKHqIuTiGW5ImXxUFvVGMhfzCNA== ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1796389371; 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=NCtVB4PAqVqQ2ifhEVUVETqLO0qQmM/eeKlDc0I5Xh4=; b=s40Z/O40JPcBJXTc2bPiwCjWC3/r4xmzJl8U/Ym8Q4ezVsucVb+Z8/BrFzcWfFqpNmXL 9A/hPQeh4gV3/ITFHp74wgGGf+QlP2+n7aJDgpW2qd4Ly4oLsMtpBsGLXU94yPwvBv7oK lAuBynzaU0waeob1uBSrESm6KP/I1H5jT8MP8aYr09/54B8Mycvcx9Yr9N1EZATeeylIC qBzgt1jXgSIXwAFpFhjS4q2pVxs1dDCHE3Z7e8TRNdIW+9dukWcf2RfSUPFSIuA7IaAzS mxKpScXiyEFK86peRUdyx71aqn4TbT2Kkzb/5UW9yIz6Gi+hGeaOmJZkPGR3yAZknFQ== 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=KoMdoLtS; 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 9C4B0606A335; Fri, 4 Dec 2026 13:02:51 +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=KoMdoLtS Received: by smtp.kernel.org (Postfix) with ESMTPSA id 94C681F00935; Fri, 4 Dec 2026 13:02:50 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linuxfoundation.org; s=korg; t=1796389371; bh=NCtVB4PAqVqQ2ifhEVUVETqLO0qQmM/eeKlDc0I5Xh4=; h=From:To:Cc:Subject:Date:In-Reply-To:References; b=KoMdoLtSb1TbswAfu+ZcMprlFAiY3umrfZJ9Lh9qA5CqEjsp1M0LmtUOynWpgryDi BhQThDaUIKu7l87kBXqKCMSmRoJnHPK7PoWK/AW8dKz4LQI1Ic86R4O8XFZkTu77LI 3z3DyHJ7UBoq0NWDAKaLHUGHpKvTjaqFWDRLo3Fs= 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.1 0966/1059] mm/damon/core: reset watermark wait state on each iteration Date: Fri, 4 Dec 2026 19:08:17 +0900 Message-ID: <20261204100709.042134102@linuxfoundation.org> X-Mailer: git-send-email 2.56.1 In-Reply-To: <20261204100643.980430235@linuxfoundation.org> References: <20261204100643.980430235@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.1-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 @@ -1220,10 +1220,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) {