From patchwork Mon Feb 19 19:44:21 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: SeongJae Park X-Patchwork-Id: 13563011 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 68CC0C54766 for ; Mon, 19 Feb 2024 19:45:02 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 64AE96B0098; Mon, 19 Feb 2024 14:44:47 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id 58B1E6B0095; Mon, 19 Feb 2024 14:44:47 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 367F16B0096; Mon, 19 Feb 2024 14:44:47 -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 E30526B0092 for ; Mon, 19 Feb 2024 14:44:46 -0500 (EST) Received: from smtpin22.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay03.hostedemail.com (Postfix) with ESMTP id BB1D4A03B3 for ; Mon, 19 Feb 2024 19:44:46 +0000 (UTC) X-FDA: 81809580972.22.18BD01A Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by imf25.hostedemail.com (Postfix) with ESMTP id 41293A001E for ; Mon, 19 Feb 2024 19:44:45 +0000 (UTC) Authentication-Results: imf25.hostedemail.com; dkim=pass header.d=kernel.org header.s=k20201202 header.b=Ab+A5Sfs; dmarc=pass (policy=none) header.from=kernel.org; spf=pass (imf25.hostedemail.com: domain of sj@kernel.org designates 139.178.84.217 as permitted sender) smtp.mailfrom=sj@kernel.org ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1708371885; 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:in-reply-to:references:references:dkim-signature; bh=Ik7g0pmo/rQPmaWjcBRzeMKt20ZGklsmFHY/Az/CDHo=; b=FI32iCFg2QLPLJ2aYryi8MHilQJO3EaNDEbyJP/p9SDQ0NkDr8NVdWjCY46SEd+5c5eBVk rRPw+Y6JDFSGpMF88LWhjs5ZUrPkaA5lwEJAXk8FktQGgxvSarho6YAzgmx3+l8iv9t8b0 Z2xcPN2YCaqhRnToNLS2mB70idIweNE= ARC-Authentication-Results: i=1; imf25.hostedemail.com; dkim=pass header.d=kernel.org header.s=k20201202 header.b=Ab+A5Sfs; dmarc=pass (policy=none) header.from=kernel.org; spf=pass (imf25.hostedemail.com: domain of sj@kernel.org designates 139.178.84.217 as permitted sender) smtp.mailfrom=sj@kernel.org ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1708371885; a=rsa-sha256; cv=none; b=SZBhmmWJK5k1n0WmatpEkpsKMuHfLqYPJgzlUiZ4DRXfNTZBS9Nm9GYS+amsZlg8v/ELaH FQA9Zc7JYBsRfxqbpg0JrZCv/HMV/DS5Yt0+oAhno0GY7L3wOgrW1REMqwJ1SY6uM0GIgo SM8886WKK0/B0+HlZTXRaFeqBmC1jZM= Received: from smtp.kernel.org (transwarp.subspace.kernel.org [100.75.92.58]) by dfw.source.kernel.org (Postfix) with ESMTP id 0658660F56; Mon, 19 Feb 2024 19:44:45 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 6CDE9C43142; Mon, 19 Feb 2024 19:44:44 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1708371884; bh=QeU5c/dwATJidBlGHBdNGbMWliRdhvFFFKPfbT81FqU=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=Ab+A5SfsaBxGqQ9J4X3fZQnWF7spadZC+lmESnnYLCSADToO6/m5SSUsThlK0cWsb Ub9tDmvaeUhGcdOx4/HVC+x3lj3WvVEXvZcMfjNG9q2vVe7KwHvZDofEd9umrUN7aC o6LYXNdE07D+b5Lnsb72tj2JsQkbSo9wWxPnHnmIO7oQpjBZX4WJx1cj7gcFqevQg7 EiXZMnxtLt+M94kbNS1Biw/13mEtXV8JpNz5EXGh14tD4Z8im3Lom2Y/QZXI0KbVG6 rleAwT/68jIKL4wV544A45Cehx5TLoPG8K0zYPQQtut1lypcWsN40nynj7IHzPZU8/ pNYJL4G6rXXXA== From: SeongJae Park To: Andrew Morton Cc: SeongJae Park , damon@lists.linux.dev, linux-mm@kvack.org, linux-kernel@vger.kernel.org Subject: [PATCH 10/20] mm/damon/core: remove ->goal field of damos_quota Date: Mon, 19 Feb 2024 11:44:21 -0800 Message-Id: <20240219194431.159606-11-sj@kernel.org> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20240219194431.159606-1-sj@kernel.org> References: <20240219194431.159606-1-sj@kernel.org> MIME-Version: 1.0 X-Rspamd-Queue-Id: 41293A001E X-Rspam-User: X-Rspamd-Server: rspam05 X-Stat-Signature: cgtf1ww1n7epr7sye7c8ypnueyskc9b9 X-HE-Tag: 1708371885-309267 X-HE-Meta: U2FsdGVkX19eZ2KJAW0sfiezhmgb0/gzbCVens50mwAY5D/Xj1/X4re6UKh6iaOwZ/dDjIWaiS10j5EvkJ3k/fPNzG+/zFNWRa4JbAVHm3v9rHBIhnGh0VmgoCbUrhxsGRMzS+gyOyce/mDDCoHVw29qTjkEFnSS8NbF1xHYAtcUJJ5DbfvFksphTlg4UHPeepeGct+9FXk40CRUmHyGGUG4LHu6nyULRC79Hw2anf3MOblxMP5L2PYGT1qpaxtg5i0EAFkBAHlX72MOtOtDyIGaWhZJqIniG5dVopXl7E/g8zQfQDDTvTcE/oZlpRltSAIiIYi0BG1wobE+DOcOV81guQWD0X75bQX8dHXce5jR9XNWAORksqq40oNLdxsDEOLbdFKdA2ppn+MULjvLqf1el5/wLmzrwebqxLLERDjLGmWfGYInXg1NBNKRPhfdK/p/rmzZGlVE5ONbiB4p8l35bg+pyGi9tIdhh6isdvSSxmuHm0APN5O4HFdbRpBb16ZML6ZGij3DsQ7DTE8MdthyHQSOFnY/ShwFrOz2idRFVoyKDtWUr+/dGilAYqzQD8H7mJ61o+SQzZEM1Bk+5OvoV43YLWGbaTjqwUe0KcYZeYK0WRX19jpERK6jnTPXBss6E5n06If7tU/aX9DLlO5CX8vxyyx0cHnOZCwRIDLn/yad3Bk5mUnbSMRU5h9kXODIEclPy7Reyz+m9kCykSRKzHZGdDbppumCk4fUyfNLRrw2KwfN3ROmYbQ7jx8xvLKu2EUymh28jUSUm+yPa5vgAN7U9DECZeDtkd6XvbJNPHWLPSf7CWmgXGLqbrzMmUwInJIR6kRRNCwI1BGj/8bV/mIB8CUDwcmqceJc7QqPAZ3DjtsRnY/6b26tmrJyU5pdChNwNJj35ZLuFz/rZ9M0riwpQioHQJjd/iH5/5uAX49XAmNwbVpj3i3hD7Ugk8ijAgK1cyLhjH9UuUB 5gb6mVIX xddHS 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: DAMOS quota auto-tuning feature supports static signle goal and dynamic multiple goals via DAMON kernel API, specifically via ->goal and ->goals fields of damos_quota struct, respectively. All in-tree DAMOS kernel API users are using only the dynamic multiple goals now. Remove the unsued static single goal interface. Signed-off-by: SeongJae Park --- include/linux/damon.h | 12 ++++-------- mm/damon/core.c | 17 +++++------------ 2 files changed, 9 insertions(+), 20 deletions(-) diff --git a/include/linux/damon.h b/include/linux/damon.h index 4bd898eaf80e..76c965c1eea3 100644 --- a/include/linux/damon.h +++ b/include/linux/damon.h @@ -149,7 +149,6 @@ struct damos_quota_goal { * @reset_interval: Charge reset interval in milliseconds. * @ms: Maximum milliseconds that the scheme can use. * @sz: Maximum bytes of memory that the action can be applied. - * @goal: Quota auto-tuning goal. * @goals: Head of quota tuning goals (&damos_quota_goal) list. * @esz: Effective size quota in bytes. * @@ -169,12 +168,10 @@ struct damos_quota_goal { * throughput of the scheme's action. DAMON then compares it against &sz and * uses smaller one as the effective quota. * - * If ->get_score field of @goal is set, DAMON calculates yet another size - * quota based on the goal using its internal feedback loop algorithm, for - * every @reset_interval. Then, if the new size quota is smaller than the - * effective quota, it uses the new size quota as the effective quota. - * - * If @goals is not empty, same action is taken for each goal of the list. + * If @goals is not empt, DAMON calculates yet another size quota based on the + * goals using its internal feedback loop algorithm, for every @reset_interval. + * Then, if the new size quota is smaller than the effective quota, it uses the + * new size quota as the effective quota. * * The resulting effective size quota in bytes is set to @esz. * @@ -188,7 +185,6 @@ struct damos_quota { unsigned long reset_interval; unsigned long ms; unsigned long sz; - struct damos_quota_goal goal; struct list_head goals; unsigned long esz; diff --git a/mm/damon/core.c b/mm/damon/core.c index b6cd99b64e85..7b06d926c552 100644 --- a/mm/damon/core.c +++ b/mm/damon/core.c @@ -1130,10 +1130,6 @@ static unsigned long damos_quota_score(struct damos_quota *quota) struct damos_quota_goal *goal; unsigned long highest_score = 0; - if (quota->goal.get_score) - highest_score = quota->goal.get_score( - quota->goal.get_score_arg); - damos_for_each_quota_goal(goal, quota) highest_score = max(highest_score, goal->get_score(goal->get_score_arg)); @@ -1142,21 +1138,19 @@ static unsigned long damos_quota_score(struct damos_quota *quota) } /* - * Called only if quota->ms, quota->sz, or quota->goal.get_score are set, or - * quota->goals is not empty + * Called only if quota->ms, or quota->sz are set, or quota->goals is not empty */ static void damos_set_effective_quota(struct damos_quota *quota) { unsigned long throughput; unsigned long esz; - if (!quota->ms && !quota->goal.get_score && - list_empty("a->goals)) { + if (!quota->ms && list_empty("a->goals)) { quota->esz = quota->sz; return; } - if (quota->goal.get_score || !list_empty("a->goals)) { + if (!list_empty("a->goals)) { unsigned long score = damos_quota_score(quota); quota->esz_bp = damon_feed_loop_next_input( @@ -1171,7 +1165,7 @@ static void damos_set_effective_quota(struct damos_quota *quota) quota->total_charged_ns; else throughput = PAGE_SIZE * 1024; - if (quota->goal.get_score || !list_empty("a->goals)) + if (!list_empty("a->goals)) esz = min(throughput * quota->ms, esz); else esz = throughput * quota->ms; @@ -1191,8 +1185,7 @@ static void damos_adjust_quota(struct damon_ctx *c, struct damos *s) unsigned long cumulated_sz; unsigned int score, max_score = 0; - if (!quota->ms && !quota->sz && !quota->goal.get_score && - list_empty("a->goals)) + if (!quota->ms && !quota->sz && list_empty("a->goals)) return; /* New charge window starts */