public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Peter Williams <pwil3058@bigpond.net.au>
To: Nick Piggin <nickpiggin@yahoo.com.au>
Cc: Albert Cahalan <albert@users.sf.net>,
	linux-kernel mailing list <linux-kernel@vger.kernel.org>,
	kernel@kolivas.org, Andrew Morton OSDL <akpm@osdl.org>
Subject: Re: SCHED_BATCH and SCHED_BATCH numbering
Date: Thu, 05 Aug 2004 12:09:50 +1000	[thread overview]
Message-ID: <411196EE.9050408@bigpond.net.au> (raw)
In-Reply-To: <41118D0C.9090103@yahoo.com.au>

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


  reply	other threads:[~2004-08-05  2:09 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2004-08-04 16:50 SCHED_BATCH and SCHED_BATCH numbering Albert Cahalan
2004-08-05  1:17 ` Peter Williams
2004-08-05  1:27   ` Nick Piggin
2004-08-05  2:09     ` Peter Williams [this message]
2004-08-05  2:23       ` Nick Piggin
2004-08-05  3:03         ` Peter Williams
2004-08-05  3:06           ` Nick Piggin
2004-08-05  2:28             ` Albert Cahalan
2004-08-05  7:06               ` Nick Piggin
2004-08-05  3:36             ` Peter Williams
2004-08-05  4:15               ` Nick Piggin
2004-08-05  6:57 ` Ingo Molnar
2004-08-05  9:48   ` Albert Cahalan

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=411196EE.9050408@bigpond.net.au \
    --to=pwil3058@bigpond.net.au \
    --cc=akpm@osdl.org \
    --cc=albert@users.sf.net \
    --cc=kernel@kolivas.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=nickpiggin@yahoo.com.au \
    /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