Linux Kernel Architecture

(Jacob Rumans) #1
Mauerer app04.tex V1 - 09/04/2008 6:12pm Page 1232

Appendix D: System Startup


❑ proc_caches_initinitiates slab caches for the remaining data structures involved in the process
description. The following structures are considered:sighand,signal,files,fs,fs_struct,
andmm_struct.
❑ buffer_initgenerates a cache forbuffer_heads and calculates the value of the
max_buffer_headsvariable so that the buffer heads never use more than 10 percent of
the memory inZONE_NORMAL.
❑ vfs_caches_initcreates caches for various data structures needed by the virtual filesystem
(VFS) layer.
❑ radix_tree_initcreates a slab cache forradix_tree_nodeinstances needed by memory man-
agement.
❑ page_writeback_initinitializes the flushing mechanism and, more specifically, defines the
limit value for dirty pages after which the mechanism comes into effect.
❑ proc_root_initinitializes the inode cache of theprocfilesystem, registers the process
filesystem (procfs) in the kernel, and generates the central filesystem entries — for example,
/proc/meminfo,/proc/uptime,/proc/version,andsoon.

SearchingforKnown SystemErrors


Software is not the only thing that has bugs — mishaps also occur when implementing processors and,
as a result, chips do not function as they should. Fortunately, most error situations can be remedied with
workarounds. However, before workarounds can beput in place, the kernel needs to know whether a
particular processor does, in fact, have any bugs. This can be established using the architecture-specific
check_bugsfunction.

For instance, the following code is available for IA-32 systems:

arch/x86/kernel/cpu/bugs.c
static void __init check_bugs(void)
{
identify_boot_cpu();


check_config();
check_fpu();
check_hlt();
check_popad();
init_utsname()->machine[1] = ’0’ + (boot_cpu_data.x86 >6?6:boot_cpu_data.x86);
alternative_instructions();
}


The last statement (alternative_instructions) also invokes a function that replaces certain assem-
bler instructions — depending on processor type — with faster, more modern alternatives. This enables
distributors to create kernel images that are capable of running on a wide variety of machines without
having to forgo more recent features.

For comparison of the CPU quality, here is thecheck_bugsroutine of S390, Alpha, Extensa, H8300, v850,
FRV, Blackfin, Cris, PA-RISC, and PPC64:

static void check_bugs(void)
Free download pdf