From: Karthik Singaram Lakshmanan <karthiksingaram@gmail.com>
To: Ted Baker <baker@cs.fsu.edu>
Cc: Peter Zijlstra <peterz@infradead.org>,
Chris Friesen <cfriesen@nortel.com>,
Noah Watkins <jayhawk@soe.ucsc.edu>, Raistlin <raistlin@linux.it>,
Douglas Niehaus <niehaus@ittc.ku.edu>,
Henrik Austad <henrik@austad.us>,
LKML <linux-kernel@vger.kernel.org>, Ingo Molnar <mingo@elte.hu>,
Bill Huey <billh@gnuppy.monkey.org>,
Linux RT <linux-rt-users@vger.kernel.org>,
Fabio Checconi <fabio@gandalf.sssup.it>,
"James H. Anderson" <anderson@cs.unc.edu>,
Thomas Gleixner <tglx@linutronix.de>,
Dhaval Giani <dhaval.giani@gmail.com>,
KUSP Google Group <kusp@googlegroups.com>,
Tommaso Cucinotta <cucinotta@sssup.it>,
Giuseppe Lipari <lipari@retis.sssup.it>,
Raj Rajkumar <raj@ece.cmu.edu>,
dionisio@sei.cmu.edu
Subject: Re: RFC for a new Scheduling policy/class in the Linux-kernel
Date: Thu, 16 Jul 2009 21:44:09 -0400 [thread overview]
Message-ID: <1ca41c0f0907161844l14176743y3520b1376389bfc@mail.gmail.com> (raw)
In-Reply-To: <20090716233836.GF27757@cs.fsu.edu>
> This does not solve the problem of avoiding queue reordering in
> response to dynamic priority changes, since where you insert the
> task in the queue (including the bit setting for the priority and
> the linking/unlinking) depends on the curent priority.
>
I completely agree with this. The bit map needs to be modified for
dynamic priority changes. However, atomic operations (like
Compare-And-Swap) can be used to modify the bitmap. Barring any
(highly unlikely but bounded) contention scenarios from other
processors, this implementation would still continue to be efficient
than maintaining a priority-ordered queue.
> By the way, the use of bit-maps is very appealing for the O(1)
> operations, including bit-scan, especially if your machine has
> atomic set/test bit instructions. We used this structure for some
> single-processor RT kernels in the 1980's. The task scheduling
> and sleep/wakeup operations were just a few instructions. However
> the use of bit-maps forced us to set a fixed limit on the number
> of tasks in the system. We also could not change priorities
> without doing an ugly (non-atomic) re-shuffling of the structures.
>
> You are proposing one bit per priority level, of course, rather
> than one bit per task. This allows you to use linked lists within
> priorities, but you lose the one-instruction suspend/unsuspend.
>
We can still maintain the O(1) instruction-suspend/unsuspend, if we
maintain a counter for each priority level.
(a) When a task suspends on a lock, we can do an atomic increment of
the counter for its priority level and set the bit on the priority map
of tasks waiting for the lock. Attaching the task to a
per-priority-level linked list queue should take O(1) assuming that
there is a tail pointer.
(b) When the lock is released, find the highest priority bit set on
the lock's priority map, index into the appropriate per-priority-level
linked list, and wake up the task at the head of the queue (delete
operation with O(1)). Do an atomic decrement of the counter, if it
reaches zero unset the bit on the priority map.
While there are still contention issues that arise with updating the
linked list and counters, these are restricted to tasks within the
same priority level (highly unlikely that multiple tasks from the same
priority level decide to acquire the same lock within a window of a
couple of instructions), and should be much less than the contention
arising from all the tasks in the system.
> It is not immediately obvious how to extend this technique to
> deadline-based scheduling.
>
> There can only be a finite number of distinct deadlines in a
> system at any one time. So at any point in time a finite number
> of bits is sufficient. The problem is that the deadlines are
> advancing, so a fixed mapping of bit positions to deadlines does
> not work.
>
> There is one way this can be used with EDF, at least for a single
> processor, which is related to the way I came up with the SRP. If
> you keep a stack of preempting tasks (earliest deadline on top),
> the positions in the stack do map nicely to a bit vector.
>
> You then need some other structure for the tasks with deadlines
> later than the bottom of your stack.
>
Yes. I did not think about EDF based schedulers when I proposed the
implementation mechanism. I believe we can work on the SRP idea to get
a corresponding version for EDF.
> I don't see how this generalizes to SMP.
>
I agree that there needs to be more work to generalize the idea to EDF
based schedulers on SMP, however, the idea still applies to
fixed-priority scheduling in the SMP context. Many SMP processors
support atomic instructions (for example:
http://software.intel.com/en-us/articles/implementing-scalable-atomic-locks-for-multi-core-intel-em64t-and-ia32-architectures/).
We can utilize these instructions to efficiently implement such locks
at least in fixed-priority schedulers (like Deadline Monotonic
Schedulers) for SMP systems.
Thanks
- Karthik
--
To unsubscribe from this list: send the line "unsubscribe linux-rt-users" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
next prev parent reply other threads:[~2009-07-17 1:44 UTC|newest]
Thread overview: 82+ messages / expand[flat|nested] mbox.gz Atom feed top
2009-07-10 21:50 RFC for a new Scheduling policy/class in the Linux-kernel Henrik Austad
2009-07-11 18:28 ` Peter Zijlstra
2009-07-12 2:40 ` Douglas Niehaus
2009-07-12 15:31 ` Peter Zijlstra
2009-07-13 15:44 ` Raistlin
2009-07-13 16:33 ` Chris Friesen
2009-07-14 10:47 ` Raistlin
2009-07-14 11:03 ` Peter Zijlstra
2009-07-14 11:56 ` Luca Abeni
2009-07-14 18:19 ` Raistlin
2009-07-14 14:48 ` Chris Friesen
2009-07-14 15:19 ` James H. Anderson
2009-07-14 16:31 ` Peter Zijlstra
2009-07-14 16:54 ` James H. Anderson
2009-07-14 19:28 ` Henrik Austad
2009-07-14 19:33 ` James H. Anderson
2009-07-15 21:53 ` Ted Baker
2009-07-17 7:40 ` Henrik Austad
2009-07-17 13:37 ` Ted Baker
2009-07-15 4:25 ` Bjoern B. Brandenburg
2009-07-15 20:55 ` Ted Baker
2009-07-15 21:53 ` Chris Friesen
2009-07-15 22:34 ` Ted Baker
2009-07-15 22:39 ` Dhaval Giani
2009-07-15 23:16 ` Ted Baker
2009-07-16 8:58 ` Peter Zijlstra
2009-07-16 9:11 ` Peter Zijlstra
2009-07-17 0:32 ` Raistlin
2009-07-17 0:43 ` Raistlin
2009-07-16 12:17 ` Raistlin
2009-07-16 23:29 ` Raistlin
2009-07-18 20:12 ` Michal Sojka
2009-07-14 17:16 ` James H. Anderson
2009-07-15 21:19 ` Ted Baker
2009-07-14 19:54 ` Raistlin
2009-07-14 16:48 ` Raistlin
2009-07-14 18:24 ` Chris Friesen
2009-07-14 19:14 ` Raistlin
2009-07-15 22:14 ` Ted Baker
2009-07-16 7:17 ` Henrik Austad
2009-07-16 23:13 ` Ted Baker
2009-07-17 0:19 ` Raistlin
2009-07-17 7:31 ` Henrik Austad
2009-07-16 14:46 ` Chris Friesen
2009-07-16 22:34 ` Ted Baker
2009-07-16 23:07 ` Raistlin
2009-07-15 21:45 ` Ted Baker
2009-07-15 22:12 ` Chris Friesen
2009-07-15 22:52 ` Ted Baker
2009-07-17 13:35 ` Giuseppe Lipari
2009-07-13 17:25 ` Peter Zijlstra
2009-07-13 18:14 ` Noah Watkins
2009-07-13 20:13 ` Ted Baker
2009-07-13 21:45 ` Chris Friesen
2009-07-14 11:16 ` Raistlin
2009-07-15 23:11 ` Ted Baker
2009-07-16 7:58 ` Peter Zijlstra
2009-07-16 8:52 ` Thomas Gleixner
2009-07-16 12:17 ` Raistlin
2009-07-16 12:59 ` James H. Anderson
2009-07-16 13:37 ` Peter Zijlstra
2009-07-16 22:15 ` Ted Baker
2009-07-16 22:34 ` Karthik Singaram Lakshmanan
2009-07-16 23:38 ` Ted Baker
2009-07-17 1:44 ` Karthik Singaram Lakshmanan [this message]
2009-07-16 15:17 ` Chris Friesen
2009-07-16 21:26 ` Ted Baker
2009-07-16 22:08 ` Chris Friesen
2009-07-16 23:54 ` Ted Baker
2009-07-14 9:15 ` Peter Zijlstra
2009-07-14 19:07 ` Raistlin
2009-07-13 17:28 ` Peter Zijlstra
2009-07-14 19:47 ` Raistlin
[not found] ` <002301ca0403$47f9d9d0$d7ed8d70$@tlh@comcast.net>
2009-07-13 23:47 ` Douglas Niehaus
2009-07-14 7:27 ` Chris Friesen
2009-07-14 7:44 ` Douglas Niehaus
2009-07-12 6:17 ` Henrik Austad
2009-07-13 9:55 ` Raistlin
2009-07-13 10:14 ` Peter Zijlstra
2009-07-13 16:06 ` Raistlin
2009-07-14 8:42 ` Peter Zijlstra
2009-07-14 9:36 ` Raistlin
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=1ca41c0f0907161844l14176743y3520b1376389bfc@mail.gmail.com \
--to=karthiksingaram@gmail.com \
--cc=anderson@cs.unc.edu \
--cc=baker@cs.fsu.edu \
--cc=billh@gnuppy.monkey.org \
--cc=cfriesen@nortel.com \
--cc=cucinotta@sssup.it \
--cc=dhaval.giani@gmail.com \
--cc=dionisio@sei.cmu.edu \
--cc=fabio@gandalf.sssup.it \
--cc=henrik@austad.us \
--cc=jayhawk@soe.ucsc.edu \
--cc=kusp@googlegroups.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-rt-users@vger.kernel.org \
--cc=lipari@retis.sssup.it \
--cc=mingo@elte.hu \
--cc=niehaus@ittc.ku.edu \
--cc=peterz@infradead.org \
--cc=raistlin@linux.it \
--cc=raj@ece.cmu.edu \
--cc=tglx@linutronix.de \
/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