From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-alma10-1.taild15c8.ts.net [100.103.45.18]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 8A060594807; Wed, 9 Sep 2026 14:41:01 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=100.103.45.18 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1788964862; cv=none; b=u+DQg3GJT6T/oK7+Qj9KvfO69PmazsOEXmgqhNcA+soAW5gJp0/bU2AtCNWaWp7YpxytX0l5TlOjCgp4O7vIGFSIQHFPlZHmvAAigbu0KrUFQBJCTdNrolekLO0RBiN/B8T8MtTuwPQWoZqt9kmd/hsF8KmU8zmZnik0LqlfjLY= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1788964862; c=relaxed/simple; bh=JxIz4BRAQuWMxmYND/NHBymPyUgcJ+CVPv//fxyBeuM=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=TzGy1GfeFDc5mNmIx/Ix1edsvsK1X5s2QTEnF/XBkeylgPXqEdAuujK4+vE7zv6t90cfVxQUoAtslVH7k5kCCV/cp6TB7F9/+TzFvh6j8HDuq4i/4pTjRoLyo7Sm2Ha9jzxoZbxBobCGkz4TLFnl0v0CMShr85BviVPkfpHWSE0= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b=nXkeWVRa; arc=none smtp.client-ip=100.103.45.18 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b="nXkeWVRa" Received: by smtp.kernel.org (Postfix) with ESMTPSA id D7A181F00A3E; Wed, 9 Sep 2026 14:41:00 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linuxfoundation.org; s=korg; t=1788964861; bh=Nztf/dOz8WAOwKAVyudi+rGGNxFJ1EwsCH2s/a0Zs6E=; h=From:To:Cc:Subject:Date:In-Reply-To:References; b=nXkeWVRa7FvGDDcEgh9qcDGtcCLx0/aprYeA2EB6c9gRl747DWjF+uIzW0rQ2ddDD LSmLJtzhq0oF95HazjpLo6n9LR4zV1tAo+4Nz/oV8XsYRU2CELJG3bVX/tW7RA6vzG HHI/66j1MwwhJvpbubrYMbGfwJuw9k6nlxKSjhJM= From: Greg Kroah-Hartman To: stable@vger.kernel.org Cc: Greg Kroah-Hartman , patches@lists.linux.dev, SJ Park , Andrew Morton Subject: [PATCH 6.18 570/583] mm/damon/ops-common: use nr_accesses moving sum for quota score Date: Wed, 9 Sep 2026 15:44:15 +0200 Message-ID: <20260909134257.584319894@linuxfoundation.org> X-Mailer: git-send-email 2.55.0 In-Reply-To: <20260909134237.773280130@linuxfoundation.org> References: <20260909134237.773280130@linuxfoundation.org> User-Agent: quilt/0.69 X-stable: review X-Patchwork-Hint: ignore Precedence: bulk X-Mailing-List: stable@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit 6.18-stable review patch. If anyone has any objections, please let me know. ------------------ From: SJ Park commit 6c25083f7ae7e2660d766169e5b4d3e96010503f upstream. Since commit 42f994b71404 ("mm/damon/core: implement scheme-specific apply interval"), DAMOS scheme can be applied at any time. At that time, nr_accesses may not be fully aggregated. But the quota prioritization score is calculated using the not fully aggregated count. As a result, the performance of DAMOS could be degraded. Fix by using damon_nr_accesses_mvsum() instead. The user impact of the issue is suboptimum DAMOS performance under certain setups. Nonetheless, the bug was there from the beginning of the setup availability. In other words, the suboptimum performance is the baseline of the setup and hence it didn't cause regression. Also the extent of the suboptimality was not big enough to be found from users and testers. Still, this is a clear bug that is better to be fixed, and can be easily fixed. Link: https://lore.kernel.org/20260719161136.90191-1-sj@kernel.org Fixes: 42f994b71404 ("mm/damon/core: implement scheme-specific apply interval") Signed-off-by: SJ Park Cc: # 6.7.x Signed-off-by: Andrew Morton Signed-off-by: SJ Park Signed-off-by: Greg Kroah-Hartman --- mm/damon/ops-common.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) --- a/mm/damon/ops-common.c +++ b/mm/damon/ops-common.c @@ -101,8 +101,9 @@ int damon_hot_score(struct damon_ctx *c, unsigned int age_weight = s->quota.weight_age; int hotness; - freq_subscore = r->nr_accesses * DAMON_MAX_SUBSCORE / - damon_max_nr_accesses(&c->attrs); + freq_subscore = mult_frac(r->nr_accesses_bp / 10000, + DAMON_MAX_SUBSCORE, + damon_max_nr_accesses(&c->attrs)); age_in_sec = (unsigned long)r->age * c->attrs.aggr_interval / 1000000; for (age_in_log = 0; age_in_log < DAMON_MAX_AGE_IN_LOG && age_in_sec;