From: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
To: Gabriele Monaco <gmonaco@redhat.com>,
linux-kernel@vger.kernel.org, Ingo Molnar <mingo@redhat.com>,
Peter Zijlstra <peterz@infradead.org>
Cc: Ingo Molnar <mingo@redhat.org>,
"Paul E. McKenney" <paulmck@kernel.org>,
Shuah Khan <shuah@kernel.org>
Subject: Re: [PATCH v9 1/3] sched: Add prev_sum_exec_runtime support for RT, DL and SCX classes
Date: Mon, 24 Feb 2025 15:39:22 -0500 [thread overview]
Message-ID: <08b48d52-fb1e-4d8f-8586-06280a798331@efficios.com> (raw)
In-Reply-To: <20250224132836.383041-2-gmonaco@redhat.com>
On 2025-02-24 08:28, Gabriele Monaco wrote:
> The fair scheduling class relies on prev_sum_exec_runtime to compute the
> duration of the task's runtime since it was last scheduled. This value
> is currently not required by other scheduling classes but can be useful
> to understand long running tasks and take certain actions (e.g. during a
> scheduler tick).
>
> Add support for prev_sum_exec_runtime to the RT, deadline and sched_ext
> classes by simply assigning the sum_exec_runtime at each set_next_task.
>
> Cc: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
Reviewed-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
> Signed-off-by: Gabriele Monaco <gmonaco@redhat.com>
> ---
> kernel/sched/deadline.c | 1 +
> kernel/sched/ext.c | 1 +
> kernel/sched/rt.c | 1 +
> 3 files changed, 3 insertions(+)
>
> diff --git a/kernel/sched/deadline.c b/kernel/sched/deadline.c
> index 38e4537790af7..438b3a953d6c7 100644
> --- a/kernel/sched/deadline.c
> +++ b/kernel/sched/deadline.c
> @@ -2391,6 +2391,7 @@ static void set_next_task_dl(struct rq *rq, struct task_struct *p, bool first)
> p->se.exec_start = rq_clock_task(rq);
> if (on_dl_rq(&p->dl))
> update_stats_wait_end_dl(dl_rq, dl_se);
> + p->se.prev_sum_exec_runtime = p->se.sum_exec_runtime;
>
> /* You can't push away the running task */
> dequeue_pushable_dl_task(rq, p);
> diff --git a/kernel/sched/ext.c b/kernel/sched/ext.c
> index 5a81d9a1e31f2..feaed0459eb92 100644
> --- a/kernel/sched/ext.c
> +++ b/kernel/sched/ext.c
> @@ -2974,6 +2974,7 @@ static void set_next_task_scx(struct rq *rq, struct task_struct *p, bool first)
> }
>
> p->se.exec_start = rq_clock_task(rq);
> + p->se.prev_sum_exec_runtime = p->se.sum_exec_runtime;
>
> /* see dequeue_task_scx() on why we skip when !QUEUED */
> if (SCX_HAS_OP(running) && (p->scx.flags & SCX_TASK_QUEUED))
> diff --git a/kernel/sched/rt.c b/kernel/sched/rt.c
> index 4b8e33c615b12..1ea272e4dae71 100644
> --- a/kernel/sched/rt.c
> +++ b/kernel/sched/rt.c
> @@ -1684,6 +1684,7 @@ static inline void set_next_task_rt(struct rq *rq, struct task_struct *p, bool f
> p->se.exec_start = rq_clock_task(rq);
> if (on_rt_rq(&p->rt))
> update_stats_wait_end_rt(rt_rq, rt_se);
> + p->se.prev_sum_exec_runtime = p->se.sum_exec_runtime;
>
> /* The running task is never eligible for pushing */
> dequeue_pushable_task(rq, p);
--
Mathieu Desnoyers
EfficiOS Inc.
https://www.efficios.com
next prev parent reply other threads:[~2025-02-24 20:39 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-02-24 13:28 [PATCH v9 0/3] sched: Restructure task_mm_cid_work for predictability Gabriele Monaco
2025-02-24 13:28 ` [PATCH v9 1/3] sched: Add prev_sum_exec_runtime support for RT, DL and SCX classes Gabriele Monaco
2025-02-24 20:39 ` Mathieu Desnoyers [this message]
2025-02-24 13:28 ` [PATCH v9 2/3] sched: Move task_mm_cid_work to mm work_struct Gabriele Monaco
2025-02-24 20:50 ` Mathieu Desnoyers
2025-02-25 7:05 ` Gabriele Monaco
2025-02-24 13:28 ` [PATCH v9 3/3] selftests/rseq: Add test for mm_cid compaction Gabriele Monaco
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=08b48d52-fb1e-4d8f-8586-06280a798331@efficios.com \
--to=mathieu.desnoyers@efficios.com \
--cc=gmonaco@redhat.com \
--cc=linux-kernel@vger.kernel.org \
--cc=mingo@redhat.com \
--cc=mingo@redhat.org \
--cc=paulmck@kernel.org \
--cc=peterz@infradead.org \
--cc=shuah@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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox