You are not logged in.

#1 2004-03-24 12:58:43

Registered: 2004-03-04
Posts: 155

Linux: Kernel Preemption, To Enable Or Not To Enable

The default 2.6.4 Arch Linux kernel .config has 'CONFIG_PREEMPT=y'. 

Not everyone has been happy with kernel preemption, however.  There is an interesting discussion of this under the title "Linux: Kernel Preemption, To Enable Or Not To Enable at

The text of the article is repeated here:

"A recent bug report on the lkml complained of significant performance degradation from enabling CONFIG_PREEMPT, kernel preemption. 2.6 kernel maintainer Andrew Morton [interview] pointed out that such degradation from enabling kernel preemption is not normal, instead likely from it triggering a bug. However, an interesting conversation on the merits of kernel preemption followed.

Andrea Arcangeli, author of the 2.4 virtual memory subsystem, bluntly suggested, "keep preempt turned off always, it's useless. Preempt just wastes cpu with tons of branches in fast paths that should take one cycle instead." Andrew Morton noted, "preempt is overrated." However, he went on to point out that kernel preemption has been very useful in detecting locking bugs. He added, "it has been demonstrated that preempt improves the average latency. But not worst-case, because those paths tend to be under spinlock."

Robert Love [interview] replied directly to Andrea's comments saying, "I think you are really blowing the overhead of kernel preemption out of proportion," going on to agree with Andrew's statements. He further explained:

"I also feel you underestimate the improvements kernel preemption gives. Yes, the absolute worst case latency probably remains because it tends to occur under lock (although, it is now easier to pinpoint that latency and work some magic on the locks). But the variance of the latency goes way down, too. We smooth out the curve. And these are differences that matter."

There is more discussion and feedback with the article (including the original bug report).


#2 2004-03-25 10:08:07

From: Athens, Greece
Registered: 2004-03-05
Posts: 807

Re: Linux: Kernel Preemption, To Enable Or Not To Enable

I like preemption. it the "democracy" heaven of processes and threads. This post was interesting, but the point is this bug..?
if the bug is found, who can say that preemption in the kernel is not a good idea?

thanks for posting though ;P


Board footer

Powered by FluxBB