Read-copy-update and interrupt latency
It turns out, however, that there is one little problem with RCU - its effect on interrupt response times. RCU works by setting aside cleanup work until a later time, when it is known that the data structures of interest have no further references in the kernel. That cleanup work is done with a software interrupt, meaning it can happen after a hardware interrupt or at rescheduling time. But the list of RCU-protected data to be cleaned up can get quite long; it is used, for example, in high-turnover data structures like the dentry cache. So that software interrupt can, potentially, take a long time to run. The RCU cleanup code, in other words, can monopolize a processor for a relatively long period at just the times when a high-priority process might be trying to run.
Dipankar Sarma has taken a look at the situation and found that processing RCU callbacks can, in some situations, take as much as 400 microseconds or so. That may not seem like a lot of time, but it can be enough to significantly increase response latencies. So he has sent out a set of patches which address the problem.
In modern-day kernel programming, it sometimes seems like there is a standard answer to every problem: create a new kernel thread. Dipankar's patch does exactly that; it adds a new per-CPU "krcud" thread which handles RCU cleanup whenever the list of callbacks gets to be too long. Short callback lists are still dealt with at software interrupt time, since that is a faster way of doing things. But, if the list is too long (256 entries, by default) and, in particular, if there is a real-time process waiting to run, the tail end of the list is delegated over to krcud and control is returned to the scheduler.
Dipankar reports good results in his tests, with overall system latencies
of less than 400 microseconds. He's not pushing this patch for inclusion
yet; it needs more testing first. But, if things pan out, a
faster-responding 2.6 kernel may result in the near future.
Index entries for this article | |
---|---|
Kernel | Read-copy-update |
Posted Jan 15, 2004 4:54 UTC (Thu)
by jzbiciak (guest, #5246)
[Link] (3 responses)
Posted Jan 15, 2004 5:03 UTC (Thu)
by hisdad (subscriber, #5375)
[Link]
Regards Dad
Posted Jan 15, 2004 5:17 UTC (Thu)
by iabervon (subscriber, #722)
[Link]
Posted Jan 15, 2004 18:26 UTC (Thu)
by freethinker (guest, #4397)
[Link]
Posted Jan 15, 2004 10:51 UTC (Thu)
by oak (guest, #2786)
[Link] (1 responses)
Posted Jan 16, 2004 23:32 UTC (Fri)
by PaulMcKenney (✭ supporter ✭, #9624)
[Link]
There are cases where it -is- safe to immediately free things up in an UP kernel, and Dipankar has some code that permits this in some cases as well.
Posted Jan 15, 2004 11:12 UTC (Thu)
by Felix.Braun (guest, #3032)
[Link] (1 responses)
Posted Jan 17, 2004 7:46 UTC (Sat)
by dipankar (subscriber, #7820)
[Link]
Is it just me, or did anyone else read krcud as kcrud? Fitting name for a task that's meant to garbage collect, IMHO.
Read-copy-update and interrupt latency
Yeah, me too.Read-copy-update and interrupt latency
I've long thought the kernel needed a thread like that..
I wonder if anyone actually read krcud as krcud. My first thought
was that sysadmins aren't going to be happy about the rcud building up in
their process tables.
Read-copy-update and interrupt latency
No, kcrud is the SCO version. Which explains a few things...Read-copy-update and interrupt latency
What's the effect of RCU code on single CPU machines?Read-copy-update and interrupt latency
It defers deletion, similar to SMP kernels. For an example of why this is needed, consider an interrupt handler (perhaps softirq) that deletes an element from a data structure that can be referenced from mainline code. The interrupt handler then cannot immediately free up the element, since the interrupted mainline code might well still be referencing it.Read-copy-update and interrupt latency
Excuse my ignorance, but can't the soft interrupt that takes care of cleaning up be pre-empted by the potential real-time process? Or is kernel pre-emption turned off during soft interrupts?
Read-copy-update and kernel pre-emption
Kernel preemption is turned off during soft interrupts.
Read-copy-update and kernel pre-emption