mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Shijie Huang <shijie@amperemail.onmicrosoft.com>
To: Peter Zijlstra <peterz@infradead.org>,
	Juri Lelli <juri.lelli@redhat.com>
Cc: Huang Shijie <shijie@os.amperecomputing.com>,
	mingo@redhat.com, patches@amperecomputing.com,
	vincent.guittot@linaro.org, dietmar.eggemann@arm.com,
	rostedt@goodmis.org, bsegall@google.com, mgorman@suse.de,
	vschneid@redhat.com, vineeth@bitbyteword.org, bristot@kernel.org,
	linux-kernel@vger.kernel.org, hongyan.xia2@arm.com
Subject: Re: [PATCH v3] sched/deadline: fix the hang in dl_task_of
Date: Tue, 3 Sep 2024 09:48:47 +0800	[thread overview]
Message-ID: <13da5b3f-938f-4536-86e2-7073f781f26a@amperemail.onmicrosoft.com> (raw)
In-Reply-To: <20240902111446.GG4723@noisy.programming.kicks-ass.net>


On 2024/9/2 19:14, Peter Zijlstra wrote:
> Subject: sched/deadline: Fix schedstats vs deadline servers
> From: Huang Shijie<shijie@os.amperecomputing.com>
> Date: Thu, 29 Aug 2024 11:11:11 +0800
>
> From: Huang Shijie<shijie@os.amperecomputing.com>
>
> In dl_server_start(), when schedstats is enabled, the following
> happens:
>
>    dl_server_start()
>      dl_se->dl_server = 1;
>      enqueue_dl_entity()
>        update_stats_enqueue_dl()
>          __schedstats_from_dl_se()
>            dl_task_of()
>              BUG_ON(dl_server(dl_se));
>
> Since only tasks have schedstats and internal entries do not, avoid
> trying to update stats in this case.
>
> Fixes: 63ba8422f876 ("sched/deadline: Introduce deadline servers")
> Signed-off-by: Huang Shijie<shijie@os.amperecomputing.com>
> Signed-off-by: Peter Zijlstra (Intel)<peterz@infradead.org>
> Link:https://lkml.kernel.org/r/20240829031111.12142-1-shijie@os.amperecomputing.com
> ---
>   kernel/sched/deadline.c |   38 ++++++++++++++++----------------------
>   1 file changed, 16 insertions(+), 22 deletions(-)
>
> --- a/kernel/sched/deadline.c
> +++ b/kernel/sched/deadline.c
> @@ -1896,46 +1896,40 @@ static inline bool __dl_less(struct rb_n
>   	return dl_time_before(__node_2_dle(a)->deadline, __node_2_dle(b)->deadline);
>   }
>   
> -static inline struct sched_statistics *
> +static __always_inline struct sched_statistics *
>   __schedstats_from_dl_se(struct sched_dl_entity *dl_se)
>   {
> +	if (!schedstat_enabled())
> +		return NULL;
> +
> +	if (dl_server(dl_se))
> +		return NULL;
> +
>   	return &dl_task_of(dl_se)->stats;
>   }
>   
>   static inline void
>   update_stats_wait_start_dl(struct dl_rq *dl_rq, struct sched_dl_entity *dl_se)
>   {
> -	struct sched_statistics *stats;
> -
> -	if (!schedstat_enabled())
> -		return;
> -
> -	stats = __schedstats_from_dl_se(dl_se);
> -	__update_stats_wait_start(rq_of_dl_rq(dl_rq), dl_task_of(dl_se), stats);
> +	struct sched_statistics *stats = __schedstats_from_dl_se(dl_se);
> +	if (stats)
> +		__update_stats_wait_start(rq_of_dl_rq(dl_rq), dl_task_of(dl_se), stats);
>   }
>   
>   static inline void
>   update_stats_wait_end_dl(struct dl_rq *dl_rq, struct sched_dl_entity *dl_se)
>   {
> -	struct sched_statistics *stats;
> -
> -	if (!schedstat_enabled())
> -		return;
> -
> -	stats = __schedstats_from_dl_se(dl_se);
> -	__update_stats_wait_end(rq_of_dl_rq(dl_rq), dl_task_of(dl_se), stats);
> +	struct sched_statistics *stats = __schedstats_from_dl_se(dl_se);
> +	if (stats)
> +		__update_stats_wait_end(rq_of_dl_rq(dl_rq), dl_task_of(dl_se), stats);
>   }
>   
>   static inline void
>   update_stats_enqueue_sleeper_dl(struct dl_rq *dl_rq, struct sched_dl_entity *dl_se)
>   {
> -	struct sched_statistics *stats;
> -
> -	if (!schedstat_enabled())
> -		return;
> -
> -	stats = __schedstats_from_dl_se(dl_se);
> -	__update_stats_enqueue_sleeper(rq_of_dl_rq(dl_rq), dl_task_of(dl_se), stats);
> +	struct sched_statistics *stats = __schedstats_from_dl_se(dl_se);
> +	if (stats)
> +		__update_stats_enqueue_sleeper(rq_of_dl_rq(dl_rq), dl_task_of(dl_se), stats);
>   }
>   
>   static inline void

Thanks Peter,

I am okay with this one.


Thanks

Huang Shijie


  parent reply	other threads:[~2024-09-03  1:49 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-08-29  3:11 Huang Shijie
2024-08-29  8:14 ` Juri Lelli
2024-09-02 11:14   ` Peter Zijlstra
2024-09-02 12:49     ` Juri Lelli
2024-09-03  1:48     ` Shijie Huang [this message]
2024-09-03 13:38 ` [tip: sched/core] sched/deadline: Fix schedstats vs deadline servers tip-bot2 for Huang Shijie

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=13da5b3f-938f-4536-86e2-7073f781f26a@amperemail.onmicrosoft.com \
    --to=shijie@amperemail.onmicrosoft.com \
    --cc=bristot@kernel.org \
    --cc=bsegall@google.com \
    --cc=dietmar.eggemann@arm.com \
    --cc=hongyan.xia2@arm.com \
    --cc=juri.lelli@redhat.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mgorman@suse.de \
    --cc=mingo@redhat.com \
    --cc=patches@amperecomputing.com \
    --cc=peterz@infradead.org \
    --cc=rostedt@goodmis.org \
    --cc=shijie@os.amperecomputing.com \
    --cc=vincent.guittot@linaro.org \
    --cc=vineeth@bitbyteword.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®