Received: by 2002:a05:7412:bbc7:b0:fc:a2b0:25d7 with SMTP id kh7csp2054301rdb; Sun, 4 Feb 2024 12:51:24 -0800 (PST) X-Google-Smtp-Source: AGHT+IFU+Js1+xKixlERVG89PHS2TDiBZINnIQTCFcEpPAYLp+iqsJvK92r6WgONvNDgK0MtCDFP X-Received: by 2002:a05:6a21:3184:b0:19c:6620:483c with SMTP id za4-20020a056a21318400b0019c6620483cmr5895420pzb.23.1707079884651; Sun, 04 Feb 2024 12:51:24 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1707079884; cv=pass; d=google.com; s=arc-20160816; b=JIm/ZTzh2slV2oBHFL83VYjk3qbdE7xL8pDyrlOBksxGHlgQPOfgeuHa9hNoSEojTm hAACU6jctQX+i6GwJpGMEYFRAAmsdXqOuyT6VSfwi2Obiys6BVcwLx6OU4un2tJ7rPQm w2LV5P/gh+Bx/rTBTM6V3nSfikHoclj0QaWUm+1qkeiW/i+VyShgRjW7RxMf9RHzGjn8 ONj6Q+HlMzBfxv/JTYTACr7pcO3uhH50/A1pvDs1IfmKBMiBptlzJPNeWRAbxp+fHlHH GXzIFW/nmik3IxjkOlmXSfG7OOB2bktoRREs2x0lKY9y8ImOBdldC+oAsH1NdcSmwxGI 0A7Q== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:message-id:date:subject:cc:to :from:dkim-signature; bh=paJfMwDaRpJJ39n/Dl7MgdQ5pk6gnmEdwIcTkVY0JVE=; fh=mdAttly6tR1adzgQIamQZGt/lCL3Z7edBlNRUPSKKy8=; b=n5XLG++J6ykaSpvBmzjV1sICI1P9d7c3xX0NjHyAL4fB6Sh4z5KvFnHDGgfOXJA4K8 N5TflNMPxMH2rQp0sbY4Uf9QYjlUjTJCV9kzeVD26DGHTy8u/+EuE1+tUjPmtDdinxF+ 5RzA8Sz+kx1KW6a1mfTmRkSOLi0i1rA713RMJO0AVp6x8g9qB6+6Ni9IFe/hXhGX0RkH hUbXQpHrWZ1nn2hkT0rvAlNUFS+LsAiP4F291nt+BCjORv9XkgPXWTbeAOeAOaw28mGb mVwyKUq92sYd0ZB0ZoQBDxcr8lYX3wdRQJlWarg65ZKkWAKXXLVjiyMei2I2HKlqyC0O s1NQ==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=KrVlmveh; arc=pass (i=1 dkim=pass dkdomain=kernel.org); spf=pass (google.com: domain of linux-kernel+bounces-51893-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:40f1:3f00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-51893-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org X-Forwarded-Encrypted: i=1; AJvYcCVXiLbFGQcQ98teE2HF7fnUDgFxnNOPeKbjXgbG3nkTyUA83PolUpZgNCKOlPSQvk1ub8jlColt7C4+DINxtcjINU470qF5YgX7o4XOBw== Return-Path: Received: from sy.mirrors.kernel.org (sy.mirrors.kernel.org. [2604:1380:40f1:3f00::1]) by mx.google.com with ESMTPS id p7-20020a63f447000000b005d8b59b8da3si4769298pgk.839.2024.02.04.12.51.24 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 04 Feb 2024 12:51:24 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-51893-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:40f1:3f00::1 as permitted sender) client-ip=2604:1380:40f1:3f00::1; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=KrVlmveh; arc=pass (i=1 dkim=pass dkdomain=kernel.org); spf=pass (google.com: domain of linux-kernel+bounces-51893-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:40f1:3f00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-51893-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by sy.mirrors.kernel.org (Postfix) with ESMTPS id A4A6AB21ECF for ; Sun, 4 Feb 2024 20:49:58 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id DC1B12576E; Sun, 4 Feb 2024 20:49:50 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="KrVlmveh" Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (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 ED5EE286A6; Sun, 4 Feb 2024 20:49:49 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1707079790; cv=none; b=Uezyccpl3FIjoHA/XM7jVytuIgvUi1VtYmHswzBV4yxGBLYQ4k0kk49OWy6gNi4bu7mZWwzVkr6fQ+1vCrsb/ad92Gk2mu1NgS68gNvYOCHsR82MXj6vEOa5BMQHJBmxKxF4OjcZH/0wPTv+PqgvQAAbHEiXb3OP1m/RbQbMsyM= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1707079790; c=relaxed/simple; bh=ojWqsp/aBmsejpkcR12AdCvNFJNKEtttghVnPq6oxmo=; h=From:To:Cc:Subject:Date:Message-Id:MIME-Version; b=PegV9SgRU1+7nEsMY98g+gW2tP2YYqfAAyamoIllnZbI+sLFe6bnzWxUwW1C5aowpNi/E0zcSgrWJrJGca+ld3Xt9bB7B1fsnAEwuqPiWsXTYrJstKL28pbDHL3THymNnZJo+C726fa/oNA4eBTPXAKnJ/WowaQJ4Zt3VEz/x9o= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=KrVlmveh; arc=none smtp.client-ip=10.30.226.201 Received: by smtp.kernel.org (Postfix) with ESMTPSA id ECEA3C433F1; Sun, 4 Feb 2024 20:49:48 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1707079789; bh=ojWqsp/aBmsejpkcR12AdCvNFJNKEtttghVnPq6oxmo=; h=From:To:Cc:Subject:Date:From; b=KrVlmvehk3qAqC+mImzdxev2eaBuCLiF9nGmJQWSJUbYP4cUxdbBXWqtTJ7yJWpgy mdPXBGLldb83ha+ULf1yZBkhZW4ONAWapMVJ6P6uWEp2HryAOamInDXSWiESvcUCXs gPnehXOU0ehnm+e0fYyZZUfUOjCX6wKN8Lq4sMsbHTDsvUlSEMCHvU7tWNdLAeSSLx k0ZEMQR9yk/gau7hzbDCH+uuW8x6KHADGc/66gqc4yl9j6H7JoKShegAoDdgFz8mhO 2P3UMLO9l5xdWM1dhBRiIpRVyUWE2H3XpmmH5zJg0SCkNGRvRs5cr6tRT+7TXO1p5c XdpsR48O2aXyw== From: SeongJae Park To: Andrew Morton Cc: SeongJae Park , damon@lists.linux.dev, linux-mm@kvack.org, stable@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH] mm/damon/core: check apply interval in Date: Sun, 4 Feb 2024 12:49:46 -0800 Message-Id: <20240204204946.87265-1-sj@kernel.org> X-Mailer: git-send-email 2.39.2 Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit kdamond_apply_schemes() checks apply intervals of schemes and avoid further applying any schemes if no scheme passed its apply interval. However, the following schemes applying function, damon_do_apply_schemes() iterates all schemes without the apply interval check. As a result, the shortest apply interval is applied to all schemes. Fix the problem by checking the apply interval in damon_do_apply_schemes(). Fixes: 42f994b71404 ("mm/damon/core: implement scheme-specific apply interval") Cc: # 6.7.x Signed-off-by: SeongJae Park --- mm/damon/core.c | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) diff --git a/mm/damon/core.c b/mm/damon/core.c index 0c144fb466b8..f444734cc613 100644 --- a/mm/damon/core.c +++ b/mm/damon/core.c @@ -1064,6 +1064,9 @@ static void damon_do_apply_schemes(struct damon_ctx *c, damon_for_each_scheme(s, c) { struct damos_quota *quota = &s->quota; + if (c->passed_sample_intervals != s->next_apply_sis) + continue; + if (!s->wmarks.activated) continue; @@ -1216,10 +1219,6 @@ static void kdamond_apply_schemes(struct damon_ctx *c) if (c->passed_sample_intervals != s->next_apply_sis) continue; - s->next_apply_sis += - (s->apply_interval_us ? s->apply_interval_us : - c->attrs.aggr_interval) / sample_interval; - if (!s->wmarks.activated) continue; @@ -1235,6 +1234,14 @@ static void kdamond_apply_schemes(struct damon_ctx *c) damon_for_each_region_safe(r, next_r, t) damon_do_apply_schemes(c, t, r); } + + damon_for_each_scheme(s, c) { + if (c->passed_sample_intervals != s->next_apply_sis) + continue; + s->next_apply_sis += + (s->apply_interval_us ? s->apply_interval_us : + c->attrs.aggr_interval) / sample_interval; + } } /* -- 2.39.2