Content-Length: 18422 | pFad | http://lwn.net/Articles/65832/

Read-copy-update and interrupt latency [LWN.net]
|
|
Subscribe / Log in / New account

Read-copy-update and interrupt latency

The read-copy-update (RCU) algorithm has found many applications since it was added to the 2.5 kernel. By eliminating lock contention in many situations, RCU can greatly improve performance and scalability on multiprocessor systems. For more information on how RCU works, see this description or this Driver Porting Series article. Or talk to the SCO Group, which claims to own any code which ever even dreamed of using RCU.

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
KernelRead-copy-update


to post comments

Read-copy-update and interrupt latency

Posted Jan 15, 2004 4:54 UTC (Thu) by jzbiciak (guest, #5246) [Link] (3 responses)

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

Posted Jan 15, 2004 5:03 UTC (Thu) by hisdad (subscriber, #5375) [Link]

Yeah, me too.
I've long thought the kernel needed a thread like that..

Regards

Dad

Read-copy-update and interrupt latency

Posted Jan 15, 2004 5:17 UTC (Thu) by iabervon (subscriber, #722) [Link]

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

Posted Jan 15, 2004 18:26 UTC (Thu) by freethinker (guest, #4397) [Link]

No, kcrud is the SCO version. Which explains a few things...

Read-copy-update and interrupt latency

Posted Jan 15, 2004 10:51 UTC (Thu) by oak (guest, #2786) [Link] (1 responses)

What's the effect of RCU code on single CPU machines?

Read-copy-update and interrupt latency

Posted Jan 16, 2004 23:32 UTC (Fri) by PaulMcKenney (✭ supporter ✭, #9624) [Link]

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.

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.

Read-copy-update and kernel pre-emption

Posted Jan 15, 2004 11:12 UTC (Thu) by Felix.Braun (guest, #3032) [Link] (1 responses)

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

Posted Jan 17, 2004 7:46 UTC (Sat) by dipankar (subscriber, #7820) [Link]

Kernel preemption is turned off during soft interrupts.


Copyright © 2004, Eklektix, Inc.
Comments and public postings are copyrighted by their creators.
Linux is a registered trademark of Linus Torvalds









ApplySandwichStrip

pFad - (p)hone/(F)rame/(a)nonymizer/(d)eclutterfier!      Saves Data!


--- a PPN by Garber Painting Akron. With Image Size Reduction included!

Fetched URL: http://lwn.net/Articles/65832/

Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy