Really? I see totally otherwise. The rule: "kernel code runs until it does a blocking
call" makes sense. What's really hard is figuring out which 12 spinlocks you need
in what order.
> > > Right now there is a preemptible kernel patch being maintained
> > > somewhere. I haven't had a chance to look recently. But the recent
> > > threads on low latency mentioned it.
> >
> > Try it out. Try running a kernel compile while a POSIX SCHED_FIFO process
> > is running.
>
> My expectation would be that the SCHED_FIFO process would totally stop
> the kernel compile. At least until it saw fit to sleep.
Right - even for a periodic SCHED_FIFO process that gives up the processor a lot.
So how do you ensure that the router daemon runs, that network packets get processed ...
that all the other things that normally happen because kernel tasks run to completion
and because user programs all progress still happen?
>
> > > As for rules. They are the usual SMP rules. In earlier version there
> > > was a requirement or that you used balanced constructs.
> >
>
> There are 3 different goals we are mentioning here.
> 1) SMP
> 2) Soft Realtime. (low-latency)
> This is things like playing audio or video where it is o.k. to skip
> but want it to happen as rarely as possible.
> 3) Hard Realtime. (guaranteed-latency)
>
> All 3 are different.
Agree. People forget though. And "as rarely as possible" is pretty damn vague.
>
> > I'm sorry, but this is not correct. SMP is different from low-latency and
> > has different goals.
>
> SMP has the basic goal of having locks held for as short a time as possible,
It does? I thought SMP had the basic goal of optimizing average case use of multiple
processors and getting a decent ratio between throughput and responsiveness.
That's very different.
> and a preemptible kernel has the goal of having the kernel being unpreemptible
> for as short a time as possible. Both of these are compatible.
Nope. You are taking an implementation rule of thumb "lock should not be held long"
which is often true for SMP and noting that it is compatible with the core design goal
of low-latency. The problem is that for low latency, "we often find it useful to keep
lock hold times short" does not get you very far.
> > You certainly can piggyback low-latency of a sort on
> > on the finer-grained locking you get from SMP support, but if you optimize
> > a kernel for SMP support you don't necessarily look at the same lock issues
> > as you would if your goal was to reduce latency. E.g. for SMP a design like
> >
> > each processor maintains a local cache of resource X. Getting X from
> > the local cache takes 100ns and only local locking.
> >
> > there is a slow and expensive spin locked central resource for X
> > used to replenish local caches. Getting X from the central resource
> > takes 1 second.
> >
> > Cache success rate is over 99.99%.
> >
> > With 10000 accesses to X, total time is 1.01 seconds for an average of 100
> > microseconds and this
> >
> > is overstating the case, for most processes never see the 1second delay and
> > average
> >
> > 100ns per access.
> >
> > But worst case is 1 second!
> >
> > If you were to design for low latency, you'd prefer the design
> >
> > an elaborate resource control mechanism allows all processors to
> > share X and get X resources within 1 millisecond.
> >
> > 1000 times better latency, 10000 times worse average case.
> >
> > You cannot escape a tradeoff by pretending it's not there.
>
> Nope you can't. However in your example I would only prefer your design if
> I was designing for guaranteed latency. Not just trying to keep the
> latencies low.
>
> I don't have a problem with my audio player skipping once ever 2 or 3
> years. A classic low-latency problem.
Actually, soft RT usually means "good performance until really I need it".
> > Look we handle this all the time in RTLinux: we have to throw away
> > heartbreakingly
> >
> > beautiful solutions because worst case numbers are bad.
>
> That is because you care about guaranteed latency, which is a truly
> different case from the normal linux kernel deals with.
Yes indeed.
> Personally I have a hard time buying hard real time code. Because
> there are always things cases where you cannot make guarantees. To
> even have a clue what the speed of your code will really run at you
> need to take into account the exact platform your code will run at,
> and you need to know the operating environment for that platform. And
> even with the best analysis and planning something still goes wrong.
Odd, I could have sworn it worked.
-
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/