From: Yajun Deng <yajun.deng@linux.dev>
To: mingo@redhat.com, peterz@infradead.org, juri.lelli@redhat.com,
vincent.guittot@linaro.org, dietmar.eggemann@arm.com,
rostedt@goodmis.org, bsegall@google.com, mgorman@suse.de,
bristot@redhat.com, vschneid@redhat.com
Cc: linux-kernel@vger.kernel.org
Subject: Re: [PATCH] sched/rt: Account execution time for cgroup and thread group if rt entity is task
Date: Mon, 23 Oct 2023 16:04:00 +0800 [thread overview]
Message-ID: <744750b3-27f6-a832-af9b-eea4825fcac6@linux.dev> (raw)
In-Reply-To: <20231023065418.1548239-1-yajun.deng@linux.dev>
Please ignore it, it's missing '#endif'.
On 2023/10/23 14:54, Yajun Deng wrote:
> The rt entity can be a task group. Like the fair scheduler class, we don't
> need to account execution time for cgroup and thread group if the rt
> entity isn't a task.
>
> Check the scheduler class of the task and make sure that the rt entity is a
> task.
>
> Signed-off-by: Yajun Deng <yajun.deng@linux.dev>
> ---
> kernel/sched/rt.c | 4 ----
> kernel/sched/sched.h | 12 ++++++++++--
> 2 files changed, 10 insertions(+), 6 deletions(-)
>
> diff --git a/kernel/sched/rt.c b/kernel/sched/rt.c
> index 6aaf0a3d6081..ccded5670b61 100644
> --- a/kernel/sched/rt.c
> +++ b/kernel/sched/rt.c
> @@ -165,8 +165,6 @@ static void destroy_rt_bandwidth(struct rt_bandwidth *rt_b)
> hrtimer_cancel(&rt_b->rt_period_timer);
> }
>
> -#define rt_entity_is_task(rt_se) (!(rt_se)->my_q)
> -
> static inline struct task_struct *rt_task_of(struct sched_rt_entity *rt_se)
> {
> #ifdef CONFIG_SCHED_DEBUG
> @@ -283,8 +281,6 @@ int alloc_rt_sched_group(struct task_group *tg, struct task_group *parent)
>
> #else /* CONFIG_RT_GROUP_SCHED */
>
> -#define rt_entity_is_task(rt_se) (1)
> -
> static inline struct task_struct *rt_task_of(struct sched_rt_entity *rt_se)
> {
> return container_of(rt_se, struct task_struct, rt);
> diff --git a/kernel/sched/sched.h b/kernel/sched/sched.h
> index 65cad0e5729e..c338c24e495d 100644
> --- a/kernel/sched/sched.h
> +++ b/kernel/sched/sched.h
> @@ -779,6 +779,11 @@ static inline long se_runnable(struct sched_entity *se)
> }
> #endif
>
> +#ifdef CONFIG_RT_GROUP_SCHED
> +#define rt_entity_is_task(rt_se) (!(rt_se)->my_q)
> +#else
> +#define rt_entity_is_task(rt_se) (1)
> +
> #ifdef CONFIG_SMP
> /*
> * XXX we want to get rid of these helpers and use the full load resolution.
> @@ -3266,9 +3271,12 @@ static inline void update_current_exec_runtime(struct task_struct *curr,
> u64 now, u64 delta_exec)
> {
> curr->se.sum_exec_runtime += delta_exec;
> - account_group_exec_runtime(curr, delta_exec);
> -
> curr->se.exec_start = now;
> +
> + if (curr->sched_class == &rt_sched_class && !rt_entity_is_task(&curr->rt))
> + return;
> +
> + account_group_exec_runtime(curr, delta_exec);
> cgroup_account_cputime(curr, delta_exec);
> }
>
prev parent reply other threads:[~2023-10-23 8:04 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-10-23 6:54 Yajun Deng
2023-10-23 8:04 ` Yajun Deng [this message]
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=744750b3-27f6-a832-af9b-eea4825fcac6@linux.dev \
--to=yajun.deng@linux.dev \
--cc=bristot@redhat.com \
--cc=bsegall@google.com \
--cc=dietmar.eggemann@arm.com \
--cc=juri.lelli@redhat.com \
--cc=linux-kernel@vger.kernel.org \
--cc=mgorman@suse.de \
--cc=mingo@redhat.com \
--cc=peterz@infradead.org \
--cc=rostedt@goodmis.org \
--cc=vincent.guittot@linaro.org \
--cc=vschneid@redhat.com \
/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
all inboxes | Powered by JetHome®