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=1796382504; b=fPqCoyiywqi13rdg/qIcX1CCrW7TQPfNOp8H2d+OZu4ytWkkMnUJnfyS2VQb21ERAklG f5cGixT2Lu8im1T9rdxiSp1tsYmGxjwXmvGaufzK8v4wbQY1nmORBUavRNlFiRmYJ8NEq IhqB99EHQffcGJ526BJNTtr3SyJbgEHFXKdowQ7jP3Qn99PtopI6w86ARYzfh17NAGkds joOsYb1iHNUN+AAqgQrpWHXlQcYg3heUkEcMKhk1ABnk7xKoNpPGu9Yot1NddV5kL1lkY bU7gdC9HrxJZ45aiK+ubaK1ndm/MAT9SdUcrZ+1elJqiSO8vkPjE3Js7Rv8GDmhvjfA== ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1796382504; 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=CZJ1zs55QPmBlvjjEpV+d+hWCSTOgTm2axy1c/MLpWQ=; b=aAeECTpnZSwUldHh3qKAfi36GV66wdUlZrjU7HwzgOtqMQ7sgNxJEHAIInKe65LyLL8g d+ns8XwbMkukvhvDztN3uAb6j+kHwl6Dt19poOJoJuPYPoxJvd6FICxB1abeUX3GAxwJA cLJ8pcrJoJfqHfzHdcGoHBsSiZBAdKCh5QGRJcpnODOhXvYLHpT6EA2el1KF3uh/3YI6D iR85PnFdxrmSEwL1oTdt6T8apiOG9qjbGf49Z+Yi7A3ClSL8sqOk6rfDF3hBFH2GLxRmX TMMjI698SMASW7WpkMbCKm8J8JgKMx1Rk9AEVr5IyJ5v5NoNvi8pZGxAyiCD48ayJoQ== 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=jovxceX8; 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 36772606A687; Fri, 4 Dec 2026 11:08:24 +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=jovxceX8 Received: by smtp.kernel.org (Postfix) with ESMTPSA id A4C381F00934; Fri, 4 Dec 2026 11:08:23 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linuxfoundation.org; s=korg; t=1796382504; bh=CZJ1zs55QPmBlvjjEpV+d+hWCSTOgTm2axy1c/MLpWQ=; h=From:To:Cc:Subject:Date:In-Reply-To:References; b=jovxceX8v+4LdfCLlz67ONElj/yYVGGWS3tgG5xRMZvdazZSp2i057cGalJ5inB5n 0b+fkbSEbZsMF/Y+Fe5VTJFLmEOMH/yO8s9vxeBkL8h1ki2qlxC+DFZlCLjixMeL2m e1sxy4TxJfRjK36lVmaSHkZUKoyFikwYXAo+AhVo= 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.18 482/703] mm/damon/core: reset watermark wait state on each iteration Date: Fri, 4 Dec 2026 19:06:21 +0900 Message-ID: <20261204100640.625977844@linuxfoundation.org> X-Mailer: git-send-email 2.56.1 In-Reply-To: <20261204100627.522266145@linuxfoundation.org> References: <20261204100627.522266145@linuxfoundation.org> User-Agent: quilt/0.69 X-stable: review X-Patchwork-Hint: ignore X-Mailing-List: stable@vger.kernel.org List-Id: List-Post: List-Help: List-Subscribe: List-Unsubscribe: List-Owner: Precedence: list MIME-Version: 1.0 Content-Transfer-Encoding: 8bit 6.18-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 @@ -2724,10 +2724,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) {