Profile-Guided Operating System Kernel Optimization

Instructions

  1. Apply the kernel patch (for Linux 3.13 and higher)
  2. Configure GCC (for x86_64) with the following options:
    configure --program-prefix=k --enable-languages=c --enable-lto --disable-threads --disable-nls --disable-tls --disable-multiarch --disable-bootstrap --disable-werror --enable-cloog-backend=isl --build=x86_64-linux-gnu --host=x86_64-linux-gnu --target=x86_64-linux-gnu
  3. Configure the kernel (x86_64 config sample 3.13, 3.14) with:
    CONFIG_GCOV_KERNEL=y
    CONFIG_GCOV_PROFILE_ALL=y
  4. Build the instrumented kernel:
    make CC=kgcc CFLAGS_GCOV=-fprofile-generate
  5. Run applications on the instrumented kernel
  6. Collect profile data with this script:
    gather.sh profile.tar.gz
  7. Profile data processing
    Scripts: process.sh, rename.sh
    Profile data processing tool for GCC 4.7, 4.8, 4.9
    Compile the profile data processing tool with g++ -o calcsum calcsum-4.?.cpp
    Profile data processing command: process.sh profile.tar.gz
  8. Reconfigure the kernel with:
    CONFIG_GCOV_KERNEL=n
    CONFIG_GCOV_PROFILE_ALL=n
  9. Build the optimized kernel:
    make clean
    make CC=kgcc KCFLAGS="-fprofile-use -fprofile-correction -Wno-error=coverage-mismatch -fprofile-dir=/path/to/profile"

Publications

Valid XHTML 1.0 Strict