Introduction

"Preset LPJ" is a feature to avoid the cost associated with calibrating loops_per_jiffy at each boot time.

The value of loops_per_jiffy (LPJ) is normally calculated in the routine calibrate_delay() early in the initialization sequence of the Linux kernel. The cost of doing this operation is independent of the CPU frequency and is about 250 milliseconds on most hardware. The value of LPJ should be the same for the same hardware operating at the same clock frequency. Thus LPJ can be calculated once and used for subsequent boots, and the cost to do the delay calibration can be avoided.

Basically, the patch allows you to specify a preset value for loops_per_jiffy at kernel compile time, or on the command line at kernel boot time.

LKML Discussion

The CELF patch was submitted to LKML on July 10, and was discussed
here

Rationale

This saves about 250 milliseconds on a 2.4-based Linux system. The duration of the calibration does not depend on the speed of the processor, but on the value of HZ for a particular architecture, and the number of iterations required to perform the calibration. For a 2.6 version of Linux, HZ is now defined as 1000 for the i386 platform (meaning a HZ duration is 1 millisecond rather than 10 milliseconds as it was for most architectures in the 2.4 version of the Linux kernel). Thus, for i386, the savings is now only about 25 milliseconds. However, many architectures still use a HZ value of 100, so for these architectures this change is still important.

Specification

The forum has written a specification for this feature. It is available at: [Calibrate Delay Avoidance Specification R2]. The specification page has more details about the operation of calibrate_delay() and the need for this feature.

Downloads

A version of this feature is now included in official (Linus' tree) Linux version 2.6.9-rc2.

Note that this version does away with the kernel configuration option, and only allows preseting lpj from the kernel command line.

Patch

No patch, no configuration settings needed for kernel's later than 2.6.9-rc2.