lkml.org 
[lkml]   [2004]   [Aug]   [4]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: SCHED_BATCH and SCHED_BATCH numbering
Nick Piggin wrote:
> Peter Williams wrote:
>
>> Albert Cahalan wrote:
>>
>>> Are these going to be numbered consecutively, or might
>>> they better be done like the task state? SCHED_FIFO is
>>> in fact already treated this way in one place. One might
>>> want to test values this way:
>>>
>>> if(foo & (SCHED_ISO|SCHED_RR|SCHED_FIFO)) ...
>>>
>>> (leaving aside SCHED_OTHER==0, or just translate
>>> that single value for the ABI)
>>>
>>> I'd like to see these get permenant allocations
>>> soon, even if the code doesn't go into the kernel.
>>> This is because user-space needs to know the values.
>>
>>
>>
>> Excellent idea. The definition of rt_task() could become:
>>
>> #define rt_task(p) ((p)->policy & (SCHED_RR|SCHED_FIFO))
>>
>> instead of the highly dodgy:

I probably should have said "slightly" instead of "highly" here but I
got carried away. :-)

>>
>> #define rt_task(p) ((p)->prio < MAX_RT_PRIO)
>>
>
> Nothing wrong with that, is there?

It's sloppy logic in that "prio" being less than MAX_RT_PRIO is a
consequence of the task being real time not the definition of it. At
the moment it is a sufficient condition for identifying a task as real
time but that may not always be the case. But, the real issue is,
what's the point of having a field, "policy", that IS the definitive
indicator of the task's scheduling policy if you don't use it? An
rt_task() function/macro defined in terms of the policy field with this
suggested numbering scheme should always be correct.

At the moment rt_task(p) could be defined as ((p)->policy !=
SCHED_OTHER) but the addition of SCHED_ISO and SCHED_BATCH would break
that. Another option would be (((p)->policy == SCHED_FIFO) ||
((p)->policy == SCHED_RR)) but that's a little long winded and (avoiding
it) is probably the reason for the current definition. So I stand by my
comment that Albert's numbering scheme is an excellent idea.
Peter
--
Peter Williams pwil3058@bigpond.net.au

"Learning, n. The kind of ignorance distinguishing the studious."
-- Ambrose Bierce

-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/

\
 
 \ /
  Last update: 2005-03-22 14:04    [from the cache]
©2003-2011 Jasper Spaans