public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Juri Lelli <juri.lelli@gmail.com>
To: Hillf Danton <dhillf@gmail.com>
Cc: Dario Faggioli <raistlin@linux.it>, LKML <linux-kernel@vger.kernel.org>
Subject: Re: [PATCH] DLS: add dl_time_equal helper in deadline scheduler
Date: Mon, 09 Apr 2012 09:34:16 +0200	[thread overview]
Message-ID: <4F8290F8.90706@gmail.com> (raw)
In-Reply-To: <CAJd=RBDKe_fX0ROdbs8sqeqJmjWtUmtSTtF1kMLbdOvt0a6UHQ@mail.gmail.com>

Hi,

On 04/07/2012 09:49 AM, Hillf Danton wrote:
> Hi all
>
> A tiny helper, dl_time_equal, is added for easing readers.
>
> And dl_entity_preempt is redefined to be bool, and its comment is also changed.
>
> Signed-off-by: Hillf Danton<dhillf@gmail.com>
> ---
>
> --- a/kernel/sched_dl.c	Sat Apr  7 15:00:28 2012
> +++ b/kernel/sched_dl.c	Sat Apr  7 15:20:10 2012
> @@ -16,16 +16,21 @@
>    */
>   static const struct sched_class dl_sched_class;
>
> -static inline int dl_time_before(u64 a, u64 b)
> +static inline bool dl_time_equal(u64 a, u64 b)
> +{
> +	return a == b;
> +}
> +
> +static inline bool dl_time_before(u64 a, u64 b)
>   {
>   	return (s64)(a - b)<  0;
>   }
>
>   /*
> - * Tells if entity @a should preempt entity @b.
> + * Return true if entity @a could preempt entity @b in term of deadline
>    */
> -static inline
> -int dl_entity_preempt(struct sched_dl_entity *a, struct sched_dl_entity *b)
> +static inline bool
> +dl_entity_preempt(struct sched_dl_entity *a, struct sched_dl_entity *b)
>   {
>   	return dl_time_before(a->deadline, b->deadline);
>   }
> @@ -885,7 +890,7 @@ static void check_preempt_curr_dl(struct
>   	 * In the unlikely case current and p have the same deadline
>   	 * let us try to decide what's the best thing to do...
>   	 */
> -	if ((s64)(p->dl.deadline - rq->curr->dl.deadline) == 0&&
> +	if (dl_time_equal(p->dl.deadline, rq->curr->dl.deadline)&&
>   	!need_resched())
>   		check_preempt_equal_dl(rq, p);
>   #endif /* CONFIG_SMP */
> --

I'll change the comparison to be deadline_a == deadline_b, but I don't see the
need for a special helper function. It is used only once, better to have the
comparison really inline (a very special case).

Thanks and Regards,

- Juri

  reply	other threads:[~2012-04-09  7:34 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-04-07  7:49 [PATCH] DLS: add dl_time_equal helper in deadline scheduler Hillf Danton
2012-04-09  7:34 ` Juri Lelli [this message]
2012-04-09 12:29   ` Hillf Danton

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=4F8290F8.90706@gmail.com \
    --to=juri.lelli@gmail.com \
    --cc=dhillf@gmail.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=raistlin@linux.it \
    /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