linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Steven Rostedt <rostedt@goodmis.org>
To: Hui Su <sh_def@163.com>
Cc: mingo@redhat.com, peterz@infradead.org, juri.lelli@redhat.com,
	vincent.guittot@linaro.org, dietmar.eggemann@arm.com,
	bsegall@google.com, mgorman@suse.de, bristot@redhat.com,
	linux-kernel@vger.kernel.org
Subject: Re: [PATCH] sched/rt.c: use list_is_singular() instead of '->prev != ->next'
Date: Mon, 26 Oct 2020 14:29:56 -0400	[thread overview]
Message-ID: <20201026142956.0a429137@gandalf.local.home> (raw)
In-Reply-To: <20201026174152.GA10163@rlk>

On Tue, 27 Oct 2020 01:41:52 +0800
Hui Su <sh_def@163.com> wrote:

> Use the list_is_singular(&rt_se->run_list) api instead of
> 'rt_se->run_list.prev != rt_se->run_list.next'.
> Fix a comment by the way, and make the comment more clearly.
> 
> Signed-off-by: Hui Su <sh_def@163.com>
> ---
>  kernel/sched/rt.c | 8 ++++----
>  1 file changed, 4 insertions(+), 4 deletions(-)
> 
> diff --git a/kernel/sched/rt.c b/kernel/sched/rt.c
> index 49ec096a8aa1..1479d00656b4 100644
> --- a/kernel/sched/rt.c
> +++ b/kernel/sched/rt.c
> @@ -2381,7 +2381,7 @@ static inline void watchdog(struct rq *rq, struct task_struct *p) { }
>   *
>   * NOTE: This function can be called remotely by the tick offload that
>   * goes along full dynticks. Therefore no local assumption can be made
> - * and everything must be accessed through the @rq and @curr passed in
> + * and everything must be accessed through the @rq and @p passed in
>   * parameters.
>   */
>  static void task_tick_rt(struct rq *rq, struct task_struct *p, int queued)
> @@ -2406,11 +2406,11 @@ static void task_tick_rt(struct rq *rq, struct task_struct *p, int queued)
>  	p->rt.time_slice = sched_rr_timeslice;
>  
>  	/*
> -	 * Requeue to the end of queue if we (and all of our ancestors) are not
> -	 * the only element on the queue
> +	 * Requeue to the end of rt_prio_array queue if we (and all of our
> +	 * ancestors) are not the only element on the rt_prio_array queue.
>  	 */
>  	for_each_sched_rt_entity(rt_se) {
> -		if (rt_se->run_list.prev != rt_se->run_list.next) {
> +		if (!list_is_singular(&rt_se->run_list)) {

Perhaps there should be a list_has_more_than_one() API, as list_is_singular
requires two checks, and the "more_than_one" only requires a single check.

list_is_singular() is:

		return !list_empty(list) && (list->next == list->prev);


which is more work than what you are replacing.

-- Steve


>  			requeue_task_rt(rq, p, 0);
>  			resched_curr(rq);
>  			return;


  reply	other threads:[~2020-10-26 18:30 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-10-26 17:41 [PATCH] sched/rt.c: use list_is_singular() instead of '->prev != ->next' Hui Su
2020-10-26 18:29 ` Steven Rostedt [this message]
2020-10-27  2:07   ` 苏辉

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=20201026142956.0a429137@gandalf.local.home \
    --to=rostedt@goodmis.org \
    --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=sh_def@163.com \
    --cc=vincent.guittot@linaro.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;
as well as URLs for NNTP newsgroup(s).