From: Henrik Austad <henrik@austad.us>
To: Ted Baker <baker@cs.fsu.edu>
Cc: Chris Friesen <cfriesen@nortel.com>, Raistlin <raistlin@linux.it>,
Peter Zijlstra <a.p.zijlstra@chello.nl>,
Douglas Niehaus <niehaus@ittc.ku.edu>,
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>,
Noah Watkins <jayhawk@soe.ucsc.edu>,
KUSP Google Group <kusp@googlegroups.com>,
Tommaso Cucinotta <cucinotta@sssup.it>,
Giuseppe Lipari <lipari@retis.sssup.it>
Subject: Re: RFC for a new Scheduling policy/class in the Linux-kernel
Date: Thu, 16 Jul 2009 09:17:09 +0200 [thread overview]
Message-ID: <200907160917.10098.henrik@austad.us> (raw)
In-Reply-To: <20090715221410.GE14993@cs.fsu.edu>
On Thursday 16 July 2009 00:14:11 Ted Baker wrote:
> On Tue, Jul 14, 2009 at 12:24:26PM -0600, Chris Friesen wrote:
> > > - that A's budget is not diminished.
> >
> > If we're running B with A's priority, presumably it will get some amount
> > of cpu time above and beyond what it would normally have gotten during a
> > particular scheduling interval. Perhaps it would make sense to charge B
> > what it would normally have gotten, and charge the excess amount to A?
>
> First, why will B get any excess time, if is charged?
My understanding of PEP is that when B executes through the A-proxy, B will
consume parts of A's resources until the lock is freed. This makes sense when
A and B runs on different CPUs and B is moved (temporarily) to CPU#A. If B
were to use it's own budget when running here, once A resumes execution and
exhaustes its entire budget, you can have over-utilization on that CPU (and
under-util on CPU#B).
> There will
> certainly be excess time used in any context switch, including
> premptions and blocking/unblocking for locks, but that will come
> out of some task's budget.
AFAIK, there are no such things as preemption-overhead charging to a task's
budget in the kernel today. This time simply vanishes and must be compensated
for when running a task through the acceptance-stage (say, only 95% util pr
CPU or some such).
> Given the realities of the scheduler,
> the front-end portion of the context-switch will be charged to the
> preempted or blocking task, and the back-end portion of the
> context-switch cost will be charged to the task to which the CPU
> is switched.
> In a cross-processor proxy situation like the one
> above we have four switches: (1) from A to C on processor #1; (2)
> from whatever else (call it D) that was running on processor #2 to
> B, when B receives A's priority; (3) from B back to D when B
> releasse the lock; (4) from C to A when A gets the lock. A will
> naturally be charged for the front-end cost of (1) and the
> back-end cost of (4), and B will naturally be charged for the
> back-end cost of (2) and the front-end cost of (3).
>
> The budget of each task must be over-provisioned enough to
> allow for these additional costs. This is messy, but seems
> unavoidable, and is an important reason for using scheduling
> policies that minimize context switches.
>
> Back to the original question, of who should be charged for
> the actual critical section.
That depends on where you want to run the tasks. If you want to migrate B to
CPU#A, A should be charged. If you run B on CPU#B, then B should be charged
(for the exact same reasoning A should be charged in the first case).
The beauty of PEP, is that enabling B to run is very easy. In the case where B
runs on CPU#B, B must be updated statically so that the scheduler will
trigger on the new priority. In PEP, this is done automatically when A is
picked. One solution to this, would be to migrate A to CPU#B and insert A
into the runqueue there. However, then you add more overhead by moving the
task around instead of just 'borrowing' the task_struct.
> From the schedulability analysis point of view, B is getting
> higher priority time than it normally would be allowed to execute,
> potentially causing priority inversion (a.k.a. "interference" or
> "blocking") to a higher priority task D (which does not even share
> a need for the lock that B is holding) that would otherwise run on
> the same processor as B. Without priority inheritance this kind
> of interferfence would not happen. So, we are benefiting A at the
> expense of D. In the analysis, we can either allow for all such
> interference in a "blocking term" in the analysis for D, or we
> might call it "preemption" in the analysis of D and charge it to A
> (if A has higher priority than D). Is the latter any better?
If D has higher priority than A, then neither A nor B (with the locks held)
should be allowed to run before D.
> I
> think not, since we now have to inflate the nominal WCET of A to
> include all of the critical sections that block it.
>
> So, it seems most logical and simplest to leave the charges where
> they naturally occur, on B. That is, if you allow priority
> inheritance, you allow tasks to sometimes run at higher priority
> than they originally were allocated, but not to execute more
> than originally budgeted.
Yes, no task should be allowed to run more than the budget, but that requires
B to execute *only* on CPU#B.
On the other hand, one could say that if you run PEP and B is executed on
CPU#A, and A then exhausts its budget, you could blame A as well, as
lock-contention is a common problem and it's not only the kernel's fault. Do
we need perfect or best-effort lock-resolving?
> Ted
--
henrik
next prev parent reply other threads:[~2009-07-16 7:17 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 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 [this message]
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
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
-- strict thread matches above, loose matches on Subject: below --
2009-07-16 17:54 Raj Rajkumar
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=200907160917.10098.henrik@austad.us \
--to=henrik@austad.us \
--cc=a.p.zijlstra@chello.nl \
--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=fabio@gandalf.sssup.it \
--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=raistlin@linux.it \
--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