From: Andrew Morton <akpm@linux-foundation.org>
To: mm-commits@vger.kernel.org,sj@kernel.org,akpm@linux-foundation.org
Subject: [merged mm-stable] mm-damon-core-implement-psi-metric-damos-quota-goal.patch removed from -mm tree
Date: Fri, 23 Feb 2024 17:50:22 -0800 [thread overview]
Message-ID: <20240224015022.EC5EFC43390@smtp.kernel.org> (raw)
The quilt patch titled
Subject: mm/damon/core: implement PSI metric DAMOS quota goal
has been removed from the -mm tree. Its filename was
mm-damon-core-implement-psi-metric-damos-quota-goal.patch
This patch was dropped because it was merged into the mm-stable branch
of git://git.kernel.org/pub/scm/linux/kernel/git/akpm/mm
------------------------------------------------------
From: SeongJae Park <sj@kernel.org>
Subject: mm/damon/core: implement PSI metric DAMOS quota goal
Date: Mon, 19 Feb 2024 11:44:24 -0800
Extend DAMOS quota goal metric with system wide memory pressure stall
time. Specifically, the system level 'some' PSI for memory is used. The
target value can be set in microseconds. DAMOS measures the increased
amount of the PSI metric in last quota_reset_interval and use the ratio of
it versus the user-specified target PSI value as the score for the
auto-tuning feedback loop.
Link: https://lkml.kernel.org/r/20240219194431.159606-14-sj@kernel.org
Signed-off-by: SeongJae Park <sj@kernel.org>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
---
include/linux/damon.h | 7 +++++++
mm/damon/core.c | 25 +++++++++++++++++++++++++
2 files changed, 32 insertions(+)
--- a/include/linux/damon.h~mm-damon-core-implement-psi-metric-damos-quota-goal
+++ a/include/linux/damon.h
@@ -130,12 +130,14 @@ enum damos_action {
* enum damos_quota_goal_metric - Represents the metric to be used as the goal
*
* @DAMOS_QUOTA_USER_INPUT: User-input value.
+ * @DAMOS_QUOTA_SOME_MEM_PSI_US: System level some memory PSI in us.
* @NR_DAMOS_QUOTA_GOAL_METRICS: Number of DAMOS quota goal metrics.
*
* Metrics equal to larger than @NR_DAMOS_QUOTA_GOAL_METRICS are unsupported.
*/
enum damos_quota_goal_metric {
DAMOS_QUOTA_USER_INPUT,
+ DAMOS_QUOTA_SOME_MEM_PSI_US,
NR_DAMOS_QUOTA_GOAL_METRICS,
};
@@ -144,6 +146,7 @@ enum damos_quota_goal_metric {
* @metric: Metric to be used for representing the goal.
* @target_value: Target value of @metric to achieve with the tuning.
* @current_value: Current value of @metric.
+ * @last_psi_total: Last measured total PSI
* @list: List head for siblings.
*
* Data structure for getting the current score of the quota tuning goal. The
@@ -159,6 +162,10 @@ struct damos_quota_goal {
enum damos_quota_goal_metric metric;
unsigned long target_value;
unsigned long current_value;
+ /* metric-dependent fields */
+ union {
+ u64 last_psi_total;
+ };
struct list_head list;
};
--- a/mm/damon/core.c~mm-damon-core-implement-psi-metric-damos-quota-goal
+++ a/mm/damon/core.c
@@ -11,6 +11,7 @@
#include <linux/delay.h>
#include <linux/kthread.h>
#include <linux/mm.h>
+#include <linux/psi.h>
#include <linux/slab.h>
#include <linux/string.h>
@@ -1125,6 +1126,25 @@ static unsigned long damon_feed_loop_nex
return min_input;
}
+#ifdef CONFIG_PSI
+
+static u64 damos_get_some_mem_psi_total(void)
+{
+ if (static_branch_likely(&psi_disabled))
+ return 0;
+ return div_u64(psi_system.total[PSI_AVGS][PSI_MEM * 2],
+ NSEC_PER_USEC);
+}
+
+#else /* CONFIG_PSI */
+
+static inline u64 damos_get_some_mem_psi_total(void)
+{
+ return 0;
+};
+
+#endif /* CONFIG_PSI */
+
static void damos_set_quota_goal_current_value(struct damos_quota_goal *goal)
{
u64 now_psi_total;
@@ -1133,6 +1153,11 @@ static void damos_set_quota_goal_current
case DAMOS_QUOTA_USER_INPUT:
/* User should already set goal->current_value */
break;
+ case DAMOS_QUOTA_SOME_MEM_PSI_US:
+ now_psi_total = damos_get_some_mem_psi_total();
+ goal->current_value = now_psi_total - goal->last_psi_total;
+ goal->last_psi_total = now_psi_total;
+ break;
default:
break;
}
_
Patches currently in -mm which might be from sj@kernel.org are
reply other threads:[~2024-02-24 1:50 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20240224015022.EC5EFC43390@smtp.kernel.org \
--to=akpm@linux-foundation.org \
--cc=mm-commits@vger.kernel.org \
--cc=sj@kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.