Section 8.3. CPU


8.3. CPU

If you wish to have the Linux kernel run as fast as possible for your specific processor and hardware type, there are a few options that you can set to get the last bit of performance out of the hardware. This section will show some of the different processor-specific options that you can tune for your processor.

8.3.1. Processor Types

A wide range of specific processor options are available to be changed in the Linux kernel. The most important one for our purpose specifies the exact type of CPU you are using this kernel for. To determine the type of processor you are using, run the following command:

 $ cat /proc/cpuinfo  | grep "model name" model name      : Intel(R) Xeon(TM) CPU 3.20GHz 

Note that your response will probably not be identical; what is important is that the command shows the model name of the processor present on the system.

  1. Select the subarchitecture type of the processor:

     Processor type and features     Subarchitecture Type         (X) PC-compatible         ( ) AMD Elan         ( ) Voyager (NCR)         ( ) NUMAQ (IBM/Sequent)         ( ) Summit/EXA (IBM x440)         ( ) Support for other sub-arch SMP systems with more than 8 CPUs         ( ) SGI 320/540 (Visual Workstation)         ( ) Generic architecture (Summit, bigsmp, ES7000, default)         ( ) Support for Unisys ES7000 IA32 series 

    Only if your machine is one of the other types in the preceding list should you select anything other than the PC-compatible option. However, if you wish to create a single kernel that will run on all of the types of machines shown, select the Generic architecture option. Some of the above options might not be present if you have not also selected the Symmetric multi-processing support option.

  2. Select the processor family type. The PC-compatible option needs to be selected from the previous options for this submenu to be displayed:

     Processor type and features     Processor family         ( ) 386         ( ) 486         ( ) 586/K5/5x86/6x86/6x86MX         ( ) Pentium-Classic         ( ) Pentium-MMX         ( ) Pentium-Pro         ( ) Pentium-II/Celeron(pre-Coppermine)         ( ) Pentium-III/Celeron(Coppermine)/Pentium-III Xeon         ( ) Pentium M         (X) Pentium-4/Celeron(P4-based)/Pentium-4 M/Xeon         ( ) K6/K6-II/K6-III         ( ) Athlon/Duron/K7         ( ) Opteron/Athlon64/Hammer/K8         ( ) Crusoe         ( ) Efficeon         ( ) Winchip-C6         ( ) Winchip-2         ( ) Winchip-2A/Winchip-3         ( ) GeodeGX1         ( ) Geode GX/LX         ( ) CyrixIII/VIA-C3         ( ) VIA C3-2 (Nehemiah)         ( ) Generic x86 support 

For more details on this configuration item, please refer to the entry for M386 in Chapter 11 for a full description of how to pick the proper processor type depending on what processor you have, and what range of machines you wish the kernel to run on.

8.3.2. SMP

If your system contains more than one CPU, or a Hyperthreaded or Dual Core CPU, you should select the multiprocessor option for the Linux kernel in order to take advantage of the additional processors. Unless you do, you will be wasting the other processors by not using them at all.

Enable multiprocessing:

 Processor type and features     [*] Symmetric multi-processing support 

8.3.3. Preemption

Systems running as servers have very different workload requirements from those being used as a desktop for video and audio applications. The kernel allows different modes of "preemption" in order to handle these different workloads. Preemption is the ability of the kernel to interrupt itself while it is doing something else, in order to work on something with a higher priority, such as updating a sound or video program.

To change to a different preemption model, use this menu:

 Processor type and features     Preemption Model         (X) No Forced Preemption (Server)     ( ) Voluntary Kernel Preemption (Desktop)     ( ) Preemptible Kernel (Low-Latency Desktop) 

If you wish to make the kernel even more responsive to higher priority tasks than the general preemption option provides, you can also allow interruptions to one of the main internal kernel locks:

 Processor type and features     [*] Preempt The Big Kernel Lock 

This option is able to be selected only if you have already selected either the Preemptible Kernel or Symmetric multi-processing support options.

8.3.4. Suspend

The Linux kernel has the ability to suspend itself to disk, allowing you to disconnect the power, and then at a later time, power up and resume exactly where the machine was when it was suspended. This functionality is very useful on laptops that run Linux.

Enable this by selecting:

 Power management options (ACPI, APM)     [*] Software Suspend 

The kernel needs to know where to save the suspended kernel image to, and then later where to resume it from. This location is usually a kernel swap partition on the disk. To specify which partition this should be set:

 Power management options (ACPI, APM)     (/dev/hda3) Default resume partition 

Make sure you specify the proper partition to suspend the machine to, and do not use a partition that is being used by the system for data. The proper partition name can be found by running the following command:

 $ /sbin/swapon -s | grep dev | cut -f 1 -d ' ' /dev/hda3 

Use the output of the preceding command in this kernel configuration option, and on the kernel boot line where it specifies where the kernel should be resumed from. After the machine has been suspended, to have it resume properly, pass the resume=/dev/swappartition argument to the kernel command line to have it use the proper image. If you do not want to have the suspended image restored, use the noresume kernel command-line argument.

8.3.5. CPU Frequency Scaling

Most modern processors can slow down the internal clock of the processor to conserve power and battery life. Linux supports this ability and offers a variety of power "governors." Different governors implement different heuristics in order to determine how to vary the processor speed depending on the system load and other variables.

  1. Enable the basic frequency scaling functionality:

     Power management options (ACPI, APM)     [*] CPU Frequency scaling 

  2. Select the different type of frequency governors you wish to use:

     Power management options (ACPI, APM)     [*] CPU Frequency scaling     [*]   'performance' governor     [*]   'powersave' governor     [*]   'userspace' governor for userspace frequency scaling     [*]   'ondemand' cpufreq policy governor     [*]   'conservative' cpufreq governor 

    For more information on what the different governors do, see the entry for CPU_FREQ in Chapter 11.

  3. Select the default governor you wish to have running when the machine boots:

     Power management options (ACPI, APM)     [*] CPU Frequency scaling           Default CPUFreq governor (performance) 

  4. Select the specific processor type on the machine. For details on how to determine the processor type of the machine, see the earlier section, "Processor Types."

     Power management options (ACPI, APM)     [*] CPU Frequency scaling     ---   CPUFreq processor drivers     [ ]   ACPI Processor P-States driver     [ ]   AMD Mobile K6-2/K6-3 PowerNow!     [ ]   AMD Mobile Athlon/Duron PowerNow!     [ ]   AMD Opteron/Athlon64 PowerNow!     [ ]   Cyrix MediaGX/NatSemi Geode Suspend Modulation     [*]   Intel Enhanced SpeedStep     [*]     Use ACPI tables to decode valid frequency/voltage pairs     [*]     Built-in tables for Banias CPUs     [ ]   Intel Speedstep on ICH-M chipsets (ioport interface)     [ ]   Intel SpeedStep on 440BX/ZX/MX chipsets (SMI interface)     [ ]   Intel Pentium 4 clock modulation     [ ]   nVidia nForce2 FSB changing     [ ]   Transmeta LongRun 

8.3.6. Different Memory Models

Linux on 32-bit Intel hardware can access up to 64 GB of memory, but the address space of the 32-bit processor is only 4 GB. To work around this limitation, Linux can map the additional memory into another area and then switch to it when other tasks need it. But if your machine has a smaller amount of memory, it is easier for Linux not to have to worry about handling the bigger areas, so it is beneficial to tell the kernel how much memory you want it to support. For a more detailed description of this option, please see the entry for HIGHMEM in Chapter 11.

Linux supports three different memory models for 32-bit Intel processors, depending on the memory available:

  • Under 1 GB of physical memory

  • Between 1 and 4 GB of physical memory.

  • Greater than 4 GB of physical memory.

To select the amount of memory:

 Processor type and features     High Memory Support         (X) off         ( ) 4GB         ( ) 64GB 

8.3.7. ACPI

On almost all modern Intel-based systems, ACPI is required in order for the machine to work properly. ACPI is a standard that allows the BIOS of the computer to work with the operating system in order to access the hardware in an indirect manner, in the hope of handling a wide range of devices with relatively little code specific to each operating system. ACPI also provides a facility to help suspend and resume a machine and control the speed of the processor and fans. If you have a laptop, it is recommended that you enable this option.

To enable ACPI:

 Power management options (ACPI, APM)     ACPI (Advanced Configuration and Power Interface)         Support         [*] ACPI Support 

There are a wide range of different ACPI "drivers" that control different types of ACPI devices. You should enable the specific ones that you have on your machine:

 Power management options (ACPI, APM)     ACPI (Advanced Configuration and Power Interface) Support         [*] ACPI Support         [*]   AC Adapter         [*]   Battery         [*]   Button         [*]   Video         [*]   Generic Hotkey (EXPERIMENTAL)         [*]   Fan         [*]   Processor         [*]     Thermal Zone         [ ]   ASUS/Medion Laptop Extras         [ ]   IBM ThinkPad Laptop Extras         [ ]   Toshiba Laptop Extras 



Linux Kernel in a Nutshell
Linux Kernel in a Nutshell (In a Nutshell (OReilly))
ISBN: 0596100795
EAN: 2147483647
Year: 2004
Pages: 113

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net