Re: [RFC][PATCH] SCHED_EDF scheduling class

From: Raistlin
Date: Wed Sep 30 2009 - 11:59:09 EST


On Tue, 2009-09-29 at 20:15 +0200, roel kluin wrote:
> shouldn't the NULL test be moved upwards, to prevent a dereference of
> a NULL pointer?
I definitely think you _do_ are right, many thanks! :-P

> Also I notice that `timespec_to_ns(&param_ex->sched_period)'
> is called twice, maybe gcc does this but can't we do something like
>
> if (edf_policy(policy)) {
> if (param_ex == NULL || param_ex->sched_priority != 0)
> return -EINVAL;
> s64 psp = timespec_to_ns(&param_ex->sched_period);
> if (psp == 0 || psp < timespec_to_ns(&param_ex->sched_runtime))
> return -EINVAL;
> }
>
Well, don't know... I guess the compiler do _something_ (also since
timespec_to_ns is 'static inline') but, to be sincere, I've not looked
at the assembly yet... But I may check it out, at least for x86, and
then consider this. :)

Thanks very much for your comments and suggestions,
Dario

--
<<This happens because I choose it to happen!>> (Raistlin Majere)
----------------------------------------------------------------------
Dario Faggioli, ReTiS Lab, Scuola Superiore Sant'Anna, Pisa (Italy)

http://blog.linux.it/raistlin / raistlin@xxxxxxxxx /
dario.faggioli@xxxxxxxxxx

Attachment: signature.asc
Description: This is a digitally signed message part