public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Peter Williams <pwil3058@bigpond.net.au>
To: William Lee Irwin III <wli@holomorphy.com>
Cc: Linux Kernel Mailing List <linux-kernel@vger.kernel.org>,
	Michal Kaczmarski <fallow@op.pl>,
	Shane Shrybman <shrybman@aei.ca>
Subject: Re: [PATCH] V-3.0 Single Priority Array O(1) CPU Scheduler Evaluation
Date: Wed, 04 Aug 2004 10:37:57 +1000	[thread overview]
Message-ID: <41102FE5.9010507@bigpond.net.au> (raw)
In-Reply-To: <20040803104912.GW2334@holomorphy.com>

William Lee Irwin III wrote:
> On Tue, Aug 03, 2004 at 01:39:02PM +1000, Peter Williams wrote:
> 
>>OK.  Now I understand.
>>The main reason that I didn't do something like that is that 
>>(considering that real time tasks don't get promoted) it would complicate:
>>1. the selection (in schedule()) of the next task to be run as it would 
>>no longer be a case of just finding the first bit in the bitmap,
>>2. determining the appropriate list to put the task on in 
>>enqueue_task(), etc., and
>>3. determining the right bit to turn off in the bit map when dequeuing 
>>the last task in a slot.
>>As these are frequent operations compared to promotion I thought it 
>>would be better to leave the complexity in do_promotion().  Now that 
>>you've caused me to think about it again I realize that the changes in 
>>the above areas may not be as complicated as I thought would be 
>>necessary.  So I'll give it some more thought.
> 
> 
> In such schemes, realtime tasks are considered separately from
> timesharing tasks. Finding a task to run or migrate proceeds with a
> circular search of the portion of the bitmap used for timesharing tasks
> after a linear search of that for RT tasks. The list to enqueue a
> timesharing task in is just an offset from the fencepost determined by
> priority. Dequeueing is supported with a tag for actual array position.
> I did this for aperiodic queue rotations, which differs from your SPA.

While pondering this I have stumbled on a problem that rules out using a 
rotating list for implementing promotion.  The problem is that one of 
the requirements is that once a SCHED_NORMAL task is promoted to the 
MAX_RT_PRIO slot it stays there (as far as promotion is concerned). 
With the rotating list this isn't guaranteed and, in fact, any tasks 
that are in the MAX_RT_PRIO slot when promotion occurs will actually be 
demoted to IDLE_PRIO - 1.

Promotion should be a rare event as it is unnecessary if there's less 
than two tasks on the runqueue and when there are more than one task on 
the runqueue the interval between promotions increases linearly with the 
number of runnable tasks.  It is also an O(1) operation albeit with a 
constant factor determined by the number of occupied SCHED_NORMAL 
priority slots.

I will modify the code to take better advantage of the fact that 
promotion is not required when the number of runnable tasks is less than 
2 e.g. by resetting next_prom_due so that the first promotion after the 
number of runnable tasks exceeds 1 will only occur after a full 
promotion interval has expired.  At normal loads (and with sensible 
promotion interval settings i.e. greater than the time slice size) this 
should result in promotion never (or hardly ever) occurring and the 
overhead of do_promotions() will only have to be endured when it's 
absolutely necessary.

Peter
-- 
Peter Williams                                   pwil3058@bigpond.net.au

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


  reply	other threads:[~2004-08-04  0:38 UTC|newest]

Thread overview: 22+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2004-08-02  6:31 [PATCH] V-3.0 Single Priority Array O(1) CPU Scheduler Evaluation Peter Williams
2004-08-02 13:42 ` William Lee Irwin III
2004-08-03  0:33   ` Peter Williams
2004-08-03  2:03     ` William Lee Irwin III
2004-08-03  3:39       ` Peter Williams
2004-08-03 10:49         ` William Lee Irwin III
2004-08-04  0:37           ` Peter Williams [this message]
2004-08-04  0:50             ` William Lee Irwin III
2004-08-04  1:36               ` Peter Williams
2004-08-04  1:51                 ` William Lee Irwin III
2004-08-04  2:40                   ` Peter Williams
2004-08-04  7:05                     ` Ingo Molnar
2004-08-04  7:44                     ` William Lee Irwin III
2004-08-05  1:06                       ` Peter Williams
2004-08-05  2:00                         ` William Lee Irwin III
2004-08-05  2:12                           ` Peter Williams
     [not found] <2oEEn-197-9@gated-at.bofh.it>
2004-08-02 13:27 ` Andi Kleen
2004-08-03  0:27   ` Peter Williams
2004-08-03  3:53     ` Andrew Morton
2004-08-03  4:38       ` Peter Williams
2004-08-03  6:51       ` Andi Kleen
  -- strict thread matches above, loose matches on Subject: below --
2004-08-07  1:44 Peter Williams

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=41102FE5.9010507@bigpond.net.au \
    --to=pwil3058@bigpond.net.au \
    --cc=fallow@op.pl \
    --cc=linux-kernel@vger.kernel.org \
    --cc=shrybman@aei.ca \
    --cc=wli@holomorphy.com \
    /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