From mboxrd@z Thu Jan 1 00:00:00 1970 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 3D4463090CD; Tue, 10 Mar 2026 01:05:39 +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=1773104739; cv=none; b=rUnADUit39eXvn9cwERiIyG/wDnxRnmpcQYPpu9zKungNHwdMBIhKYxH1mQ86sWi7nOKYDa06L8EAPdQlYIImm/UIpIcfD3y/H5TZPDoa/MwyGRqRTMDegriIN8dTFIuzWqKkpXBNU6Bd77+Ua8KmuHZYkf4471XnYgtWzfhvaw= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1773104739; c=relaxed/simple; bh=W0GRV5F589US37sVLvkk1Bm1kqbNZSMw9lB8rWD8J94=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=JTSzomxkbGnOdQE4IwgprhARcGIkxxPWm2JPhyYinU97YXwIJVQgYCOLXGAWf5/TwDeUVdYFz4wxbQpSxE+DeVrxqcqpe7/7a9jAS6BNEy0AIq2lqgskTl/ZD4uxljrwUamOE8pxG0JY9FQIgkpemslNo3zIMtjouOkwj95OA2I= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=iORzpayA; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="iORzpayA" Received: by smtp.kernel.org (Postfix) with ESMTPSA id CA37BC2BCB1; Tue, 10 Mar 2026 01:05:38 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1773104738; bh=W0GRV5F589US37sVLvkk1Bm1kqbNZSMw9lB8rWD8J94=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=iORzpayA5JVsAcGY6WLC+PT/svxnei6p5HhGfHcPGw2BhBI8aRven308Howf2gxTx URE7TlvcPeHjA++/hfqHSWDDDW2YwvTVUoNbwa13buAr5ipqS/AIJ48DnoSHqN5fPI 5eGUn1zxw/Ujzi7ZmxLDf3NZiz/1WckzC/mfJDVxnJhnfzRWb1xdqFor/mpcYQh52+ Yi2w3oRRiijnlbtEcwvkxcMYIjNNdSbibjD5ET6bBpXsZpRlZ9zzVENzQm1kbZ+wiE wvI4D0gZp8eZuqWs4Dq36qAfdEIoHS/4LCzxpXrsNMGghYLk5i4Cmpn24+GHk7Y/lB +9zH0gkGjEX2g== From: SeongJae Park To: Andrew Morton Cc: SeongJae Park , damon@lists.linux.dev, linux-kernel@vger.kernel.org, linux-mm@kvack.org Subject: [PATCH 01/11] mm/damon/core: introduce damos_quota_goal_tuner Date: Mon, 9 Mar 2026 18:05:17 -0700 Message-ID: <20260310010529.91162-2-sj@kernel.org> X-Mailer: git-send-email 2.47.3 In-Reply-To: <20260310010529.91162-1-sj@kernel.org> References: <20260310010529.91162-1-sj@kernel.org> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit DAMOS quota goal feature utilizes a single feedback loop based algorithm for automatic tuning of the effective quota. It is useful in dynamic environments that operate systems with only kernels in the long term. But, no one fits all. It is not very easy to control in environments having more controlled characteristics and user-space control towers. We actually got multiple reports [1,2] of use cases that the algorithm is not optimal. Introduce a new field of 'struct damos_quotas', namely 'goal_tuner'. It specifies what tuning algorithm the given scheme should use, and allows DAMON API callers to set it as they want. Nonetheless, this commit introduces no new tuning algorithm but only the interface. This commit hence makes no behavioral change. A new algorithm will be added by the following commit. [1] https://lore.kernel.org/CALa+Y17__d=ZsM1yX+MXx0ozVdsXnFqF4p0g+kATEitrWyZFfg@mail.gmail.com [2] https://lore.kernel.org/20260204022537.814-1-yunjeong.mun@sk.com Signed-off-by: SeongJae Park --- include/linux/damon.h | 10 ++++++++++ mm/damon/core.c | 1 + 2 files changed, 11 insertions(+) diff --git a/include/linux/damon.h b/include/linux/damon.h index 6bd71546f7b20..0824b953492e8 100644 --- a/include/linux/damon.h +++ b/include/linux/damon.h @@ -215,12 +215,21 @@ struct damos_quota_goal { struct list_head list; }; +/** + * enum damos_quota_goal_tuner - Goal-based quota tuning logic. + * @DAMOS_QUOTA_GOAL_TUNER_CONSIST: Aim long term consistent quota. + */ +enum damos_quota_goal_tuner { + DAMOS_QUOTA_GOAL_TUNER_CONSIST, +}; + /** * struct damos_quota - Controls the aggressiveness of the given scheme. * @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. * @goals: Head of quota tuning goals (&damos_quota_goal) list. + * @goal_tuner: Goal-based @esz tuning algorithm to use. * @esz: Effective size quota in bytes. * * @weight_sz: Weight of the region's size for prioritization. @@ -262,6 +271,7 @@ struct damos_quota { unsigned long ms; unsigned long sz; struct list_head goals; + enum damos_quota_goal_tuner goal_tuner; unsigned long esz; unsigned int weight_sz; diff --git a/mm/damon/core.c b/mm/damon/core.c index 7f74982535aca..c16a390152790 100644 --- a/mm/damon/core.c +++ b/mm/damon/core.c @@ -912,6 +912,7 @@ static int damos_commit_quota(struct damos_quota *dst, struct damos_quota *src) err = damos_commit_quota_goals(dst, src); if (err) return err; + dst->goal_tuner = src->goal_tuner; dst->weight_sz = src->weight_sz; dst->weight_nr_accesses = src->weight_nr_accesses; dst->weight_age = src->weight_age; -- 2.47.3