Re: [PATCH] cyclictest: Use symbolic names for scheduling policy

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Mon, Mar 8, 2010 at 9:35 AM, Carsten Emde <Carsten.Emde@xxxxxxxxx> wrote:
> On 03/08/2010 02:18 AM, John Kacur wrote:
>> - Use symbolic names for scheduling policies, that is, don't assume
>>       SCHED_RR is 2, use SCHED_RR instead, and so on.
>>
>> - Fix the logic in handlepolicy(char *polname)
>>       - remove the test with the unreachable line,
>>       - make the default SCHED_FIFO if we don't recognize the
>>       requested policy.
>>
>> Signed-off-by: John Kacur <jkacur@xxxxxxxxxx>
>> ---
>>  src/cyclictest/cyclictest.c |   15 +++++----------
>>  1 files changed, 5 insertions(+), 10 deletions(-)
>>
>> diff --git a/src/cyclictest/cyclictest.c b/src/cyclictest/cyclictest.c
>> index d38c0a7..066ca79 100644
>> --- a/src/cyclictest/cyclictest.c
>> +++ b/src/cyclictest/cyclictest.c
>> @@ -826,13 +826,8 @@ static void handlepolicy(char *polname)
>>               policy = SCHED_FIFO;
>>       else if (strncasecmp(polname, "rr", 2) == 0)
>>               policy = SCHED_RR;
>> -
>> -     if (policy == SCHED_FIFO || policy == SCHED_RR) {
>> -             if (policy == 0)
>> -                     policy = 1;
>> -     }
>> -     else
>> -             policy = 0;
>> +     else    /* default policy if we don't recognize the request */
>> +             policy = SCHED_FIFO;
>>  }
>>
>>  static char *policyname(int policy)
>> @@ -1303,9 +1298,9 @@ int main(int argc, char **argv)
>>               par->prio = priority;
>>               if (priority && !histogram && !smp && !numa)
>>                       priority--;
>> -                if      (priority && policy <= 1) par->policy = SCHED_FIFO;
>> -                else if (priority && policy == 2) par->policy = SCHED_RR;
>> -                else                              par->policy = SCHED_OTHER;
>> +                if (priority && policy == SCHED_FIFO) par->policy = SCHED_FIFO;
>> +                else if (priority && policy == SCHED_RR) par->policy = SCHED_RR;
>> +                else  par->policy = SCHED_OTHER;
>>               par->clock = clocksources[clocksel];
>>               par->mode = mode;
>>               par->timermode = timermode;
> We need to adapt the help message accordingly.
>
> Signed-off-by: Carsten Emde <C.Emde@xxxxxxxxx>
>
>

Hmnn, not sure if I like this one. The message is not perfect as it
stands, but I don't think this is an improvement.
The code seems to parse, fifo, rr, and other.
Internally the numbers are as specified, but we're not parsing them anyway.

Thanks
--
To unsubscribe from this list: send the line "unsubscribe linux-rt-users" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html

[Index of Archives]     [RT Stable]     [Kernel Newbies]     [IDE]     [Security]     [Git]     [Netfilter]     [Bugtraq]     [Yosemite]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux ATA RAID]     [Samba]     [Video 4 Linux]     [Device Mapper]

  Powered by Linux