From patchwork Sun Feb 4 20:49:46 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: SeongJae Park X-Patchwork-Id: 13544788 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by smtp.lore.kernel.org (Postfix) with ESMTP id D113BC48286 for ; Sun, 4 Feb 2024 20:49:56 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 0219A6B0071; Sun, 4 Feb 2024 15:49:56 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id EEC596B0072; Sun, 4 Feb 2024 15:49:55 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id DBE286B0074; Sun, 4 Feb 2024 15:49:55 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0014.hostedemail.com [216.40.44.14]) by kanga.kvack.org (Postfix) with ESMTP id C8CDE6B0071 for ; Sun, 4 Feb 2024 15:49:55 -0500 (EST) Received: from smtpin17.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay06.hostedemail.com (Postfix) with ESMTP id 7167DA1C46 for ; Sun, 4 Feb 2024 20:49:55 +0000 (UTC) X-FDA: 81755313150.17.5441B61 Received: from sin.source.kernel.org (sin.source.kernel.org [145.40.73.55]) by imf18.hostedemail.com (Postfix) with ESMTP id A3A731C0014 for ; Sun, 4 Feb 2024 20:49:53 +0000 (UTC) Authentication-Results: imf18.hostedemail.com; dkim=pass header.d=kernel.org header.s=k20201202 header.b=KrVlmveh; spf=pass (imf18.hostedemail.com: domain of sj@kernel.org designates 145.40.73.55 as permitted sender) smtp.mailfrom=sj@kernel.org; dmarc=pass (policy=none) header.from=kernel.org ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1707079794; h=from:from:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-transfer-encoding:content-transfer-encoding: in-reply-to:references:dkim-signature; bh=paJfMwDaRpJJ39n/Dl7MgdQ5pk6gnmEdwIcTkVY0JVE=; b=YDZTN7I3oJs2h7S3yFxteR1RJH9d5XupV0iW3FC2mzdaZPL+wfDP74UnWjJsRKo7S9Cqs6 6/fb6Y8LGkzY9GV+g6ZFqa2Q6Ud+fQeloTb7T41m8p6tXg60pHBiLpOif09wa2gNxSX+vH v/XeWdziLPPVD6EclFxK5xzHFw/yhXw= ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1707079794; a=rsa-sha256; cv=none; b=e4R/si14Tykci5VEmwoneaPvwlRJ5BJZMw3XxxB8cbh4yOkp76qb6//24EFPy/wfAVuTya 2BF/8oEdlhn0wOonm12n3sYT74K1YgvIDIbSqdhpDhGrlIzP0rwWljjho0H58NzvlI3ZTD QaRBvInVKnipR5laE/viCjQkvkYDxx4= ARC-Authentication-Results: i=1; imf18.hostedemail.com; dkim=pass header.d=kernel.org header.s=k20201202 header.b=KrVlmveh; spf=pass (imf18.hostedemail.com: domain of sj@kernel.org designates 145.40.73.55 as permitted sender) smtp.mailfrom=sj@kernel.org; dmarc=pass (policy=none) header.from=kernel.org Received: from smtp.kernel.org (transwarp.subspace.kernel.org [100.75.92.58]) by sin.source.kernel.org (Postfix) with ESMTP id 437E7CE0220; Sun, 4 Feb 2024 20:49:50 +0000 (UTC) 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 MIME-Version: 1.0 X-Rspamd-Queue-Id: A3A731C0014 X-Rspam-User: X-Rspamd-Server: rspam11 X-Stat-Signature: 8o3nucwwzrpocs7uwu4esknzm9p1ria1 X-HE-Tag: 1707079793-17027 X-HE-Meta: U2FsdGVkX19F9Vm1QVtxqbr7KKAmx3C2RPfE7qi3txrMNT4If1CF208lYiQkoj22AeOEmA2UgcksL5d+5MvYvbg+VA/OQYqV2bWDYMzaoUMi9qohFO90dwm2yb6Px7XYi/CqkiEot0jZMUYM4gR94z5mF/qrZHS2AqXfzuBmfBHpqlx0FmI4fERsgjC6UugC8vXyPJoBzb/97yQ4eLHY6T0/80GphVqnDJ0nB72+kocRZcXCxPwzR1p6NKh917fWxzp1suuVFJnMj1Y5RFHwG53DLupJX+5P/hH2DiHiTm7dqVcD8lGvgTm8UEQQuwRndSSlHpUmBeKUU9+Acu0oESxiLcSS+9mdjmo26Vg8AF3SUrjK33BTkHl9QNVFV5kVTmwhfv9iA0NOIsysladgFGO1iQHmMRKe9DHO+XS54KeUzMdXP2dS5N/uvApV9QIjYqLyQyz6b8E5DkfCS+nwR9hO6gd3vLvbe2A7raaM+y0G9Xa6pZotPfeISTohexnoIWmn84+LE3b0tfmfwNukWsLiL2l+xZ+On1xOrKoijqiz1PMcakptz+ZnGO0osKiE453FHeDq+Qc8U4jUOyousY2aqojriBDLoYE/Z/ySq+2e+FBRSudGG1AcXGlSEhNLMzJXl9uWaHvGT881aEJm3T76HAf0Rt7PLZsK/Jb7HAtLMKZadtiEniMfc57piBvrFHi2UvYcvaxY5LVE5se03nGcQAmxZnkxy+AoovoP0Toedb/kCE1jeR7sz7qjpdEBpa9DV2Byj5erlpvalt3ar3gtIvimlqMRt6mIBwPWZGbKBSCBoo/i4TrF5XvmU71wQ3CCMM9vFJa+YLJqHPvtQqtYamqX7i6khTg+pcUPykp/7G6MOG2mvUibOJnPgPf32AtWY0x/VaLnwrdGl42GxzcylKKJ5EmBZlUdyGs09zE= X-Bogosity: Ham, tests=bogofilter, spamicity=0.000000, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: List-Subscribe: List-Unsubscribe: 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; + } } /*