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=1796381138; b=c2dTCAI/yWypphLBtIWwFLCLTkMuC+FQa4Ji+903e25pBOIvxgk0VAH5ZL/VEO5tIsbk USuFYM0CtRbhnAL+AjqgLluojgbVkqpGcXmSVloLSONcljB415GZXsfV3fNoeRCrnNaFC SsLQ4frqAtCUYA6ePlIGFeOwivYKwAh1JABz5+F8kpHOQv3Zu31NsQu4a2nC0JfKvibvo jZZ1mfdCgrJ9zGV9Llk0dS/BdKO3JK/1yqfPgJC264X4pWHWs/jbL56uKizx4i7Cwd6ci VRM44EXNdzz8uObcXw3lFtlalTx6BbRcwvQFOMjqbJmOOHSgX/bX0//p5Tk2C/vVlDQ== ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1796381138; 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=xAuFxraGFUbXvrxxecky5J9fkG3fKshU9MryIFdqmSs=; b=lP0BOKrZBV+ODpOq0RpkcuE5QHml9QB6vB5PCAnZt0vOhQhfAyx/4mZMUfUr6aO1aWf9 1P5qPwNdSZEeKZxjFrgLCbKbGRIgMXHgoN8MUyBlYzLBavM6O+iOBW8vaCccBKCjh2qTC iTURfQfUnfM8AjorFCrASB3BLFs13zLfdTWTmVakoT6bzbzaV7SWnRgzv3T67nBlj+WnB 054WQm/WW0plueakvGAbmF/99sIFnrq++hIvZKnAEweurpfj4VPucBVQ6ZBzI2A9inqrO ENxetyL7waRHghIz62vFji+DtVFSTjoiIwGHkQM7uLlhHcliG/2YrQymnt0NQ4O+2qw== 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=C7ksdTNi; 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 BD1FC606A332; Fri, 4 Dec 2026 10:45:38 +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=C7ksdTNi Received: by smtp.kernel.org (Postfix) with ESMTPSA id 33EC41F00897; Fri, 4 Dec 2026 10:45:38 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linuxfoundation.org; s=korg; t=1796381138; bh=xAuFxraGFUbXvrxxecky5J9fkG3fKshU9MryIFdqmSs=; h=From:To:Cc:Subject:Date:In-Reply-To:References; b=C7ksdTNippKQ6nnVQOQ/eQTKkBcmaRXgb1b38yvMpA6AhbaxB9ELvWMkmW4DcZSd8 Fpd/WzIiZI66tkZ3JcorAEW2hWK++mmFAkIycixIw7YvcmbrMBIgX9J7fBaK0pnM9r qJ9aLdbD9u7YnLdR+eUifoDeZq/kkJ78+KyU8Oac= 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 7.3 535/742] mm/damon/core: reset watermark wait state on each iteration Date: Fri, 4 Dec 2026 19:06:39 +0900 Message-ID: <20261204100649.385765424@linuxfoundation.org> X-Mailer: git-send-email 2.56.1 In-Reply-To: <20261204100635.034361255@linuxfoundation.org> References: <20261204100635.034361255@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 7.3-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 @@ -3797,10 +3797,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) {