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: 203250 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:693c:2685:b0:108:e6aa:91d0 with SMTP id mn5csp7361dyc; Mon, 19 Feb 2024 11:50:48 -0800 (PST) X-Forwarded-Encrypted: i=3; AJvYcCVYpj0Ya3s6M9Yd8pzuqc/Zh+soUThQAfijaoe3sLBwY5+X7951cryg0OGIhbmkTUj12YjiIFY/CdowrOl9B9Uod8L6rA== X-Google-Smtp-Source: AGHT+IEbnOlgqayyM7bRAnTwnH/Xr488aeocAE6XiBhS72tyOgPaBdJC6e0evqFf/dNU6BMtpRl2 X-Received: by 2002:a17:903:2b07:b0:1dc:14d:4a0e with SMTP id mc7-20020a1709032b0700b001dc014d4a0emr3147442plb.69.1708372248658; Mon, 19 Feb 2024 11:50:48 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1708372248; cv=pass; d=google.com; s=arc-20160816; b=TPJhWcAdit+MdFBGzQoggd2vcKN4Fa4lwi0NWcIYv7skccsuOi4glRMHDN91G7TASN O/Eszmn8VMgUG87Lvj4TNxNEGWOQAEcZFL9T3EjgfJGfaAW9VJiIL2+evE72fCmIa8cT 195ns1sHfiAuUti0FOBAKALM74Dd3/8uN3BpEWXfIWL+BzmDqGXDB5IuF2BNgnwx9QZy arGvpKMhjV0ZR8xm28r1syBcxa1/grskUMMC03HyufQiLJRTW+YMZA8HfJbjlz40qX27 fFAZwGtUIizjhmG1VOGXLM8lGEjabVzn2wpSdBYrD8Ibox88X/bQWQhikp4Kx7T6avqL IcSA== 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:references:in-reply-to:message-id :date:subject:cc:to:from:dkim-signature; bh=Ik7g0pmo/rQPmaWjcBRzeMKt20ZGklsmFHY/Az/CDHo=; fh=BzdeVYqZhG5iuwuKJRNLP969rvCput73lx0iwx2zu7A=; b=G6ImBRm/+7GS0SDheZTKh67xpH27wI6t6670jAoNCPgAYlqn+keLtTE/dIQQt57yp8 wXwnoUzjdYa9ZV5OBkan+LAqhheRTJ/7qcNekJAsU38aCcJTIYYgEuQIXyrI+o2uhd+0 vb9ej337KAz4fa0IAYl5HpftW179M420spWodZtwkGX3fwPVJpoTudzeyuViJ+Az88l2 fRVQ5rwEIc8TUaA3ZGn+rbWhAiHN7pg/0LZwUfQ86jGN/DKqYkYaG+A30KP8MxYiAz/w KNmfskisgkij2kgnySbSeWul8ip5NlRJ+YMqijCVnP/sjcB7iWWjObWA3f6v1W+zpCHX ZTJg==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=Ab+A5Sfs; arc=pass (i=1 dkim=pass dkdomain=kernel.org); spf=pass (google.com: domain of linux-kernel+bounces-71891-ouuuleilei=gmail.com@vger.kernel.org designates 147.75.48.161 as permitted sender) smtp.mailfrom="linux-kernel+bounces-71891-ouuuleilei=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: from sy.mirrors.kernel.org (sy.mirrors.kernel.org. [147.75.48.161]) by mx.google.com with ESMTPS id n17-20020a170902e55100b001db5b2535ecsi4849496plf.553.2024.02.19.11.50.48 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 19 Feb 2024 11:50:48 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-71891-ouuuleilei=gmail.com@vger.kernel.org designates 147.75.48.161 as permitted sender) client-ip=147.75.48.161; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=Ab+A5Sfs; arc=pass (i=1 dkim=pass dkdomain=kernel.org); spf=pass (google.com: domain of linux-kernel+bounces-71891-ouuuleilei=gmail.com@vger.kernel.org designates 147.75.48.161 as permitted sender) smtp.mailfrom="linux-kernel+bounces-71891-ouuuleilei=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 9AA0CB245CD for ; Mon, 19 Feb 2024 19:47:49 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 3687F58AA6; Mon, 19 Feb 2024 19:44:48 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="Ab+A5Sfs" 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 3462556475; Mon, 19 Feb 2024 19:44:44 +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=1708371885; cv=none; b=WuC+8LWrBPRK9J9rJULINnPnd0lpEIBT9x3bXmpsmnH/TourbUey2ZMZgI9eJZQ1a1IqnQFzWh2qMSoly6MeLgO/PI8irwZwzsROPsdVP0Ycd2BwKv5Rm3N8W/kAoG2NhEYSxa3/KdZxXGrA3KMBvrPwEfMsRnupe1xDRhnln5E= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1708371885; c=relaxed/simple; bh=QeU5c/dwATJidBlGHBdNGbMWliRdhvFFFKPfbT81FqU=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=U0oDU2folcMvyRD4Lbhdx03aYmK8m+p2a8MdjNe5pP5/peu5lO/63DRza7UzJ951tqhUz68fBPW6VtQQZ+vDnw3QACMo03ck80Nvb/pBHHrnVSWdjG0eVFEfXQmQft8UbTUWoM54H+VPLJ9LhDaVLQvWeD8MtKkH7h+o65Eqmgo= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=Ab+A5Sfs; arc=none smtp.client-ip=10.30.226.201 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> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1791358139415220903 X-GMAIL-MSGID: 1791358139415220903 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 */