How intel_idle works

When the system is in IDLE state which means nothing to run and swapper is running, it calls cpuidle_idle_call() like shown in the below. This cpuidle_idle_call() is called from arch_cpu_idle(). cpuidle_idle_call() is the main idle loop which is checking idle driver and do further steps if the driver is installed and active. It can changeContinue reading “How intel_idle works”

What is ‘page_cache’, how it is managed and how ‘drop_caches’ dropping this pages?

– The “buffers/cache” values reported by free include the page cache, but not the dentry cache which is saved in slab ‘dentry_cache’. – page cache is increased and decreased based on the disk access activities and managed by each super block (it means each disk). – ‘echo 1 > /proc/sys/vm/drop_caches’ frees page caches by callingContinue reading “What is ‘page_cache’, how it is managed and how ‘drop_caches’ dropping this pages?”

What happens if numa=off is provided in kernel parameter?

If “numa=off” is in kernel boot parameter, it will mark ‘numa_off’ global variable which will be checked during initialization function which is ‘x86_numa_init()’ in x86_64. This will make it not call ‘numa_init’ if numa_off is 1. static __init int numa_setup(char *opt) { if (!opt) return -EINVAL; if (!strncmp(opt, “off”, 3)) numa_off = 1; #ifdef CONFIG_NUMA_EMUContinue reading “What happens if numa=off is provided in kernel parameter?”

What’s virtual address limit of 32bit/64bit Linux kernel?

RHEL 5 code 32bit: include/asm-i386/processor.h /* * User space process size: 3GB (default). */ #define TASK_SIZE (PAGE_OFFSET) 64bit: include/asm-x86_64/processor.h /* * User space process size. 47bits minus one guard page. */ #define TASK_SIZE64 (0x800000000000UL – 4096) /* This decides where the kernel will search for a free chunk of vm * space during mmap’s. */Continue reading “What’s virtual address limit of 32bit/64bit Linux kernel?”

Personal memo for ‘Automatic NUMA Balancing’

Automatic NUMA Balancing It is described in Documentation/sysctl/kernel.txt numa_balancing Enables/disables automatic page fault based NUMA memory balancing. Memory is moved automatically to nodes that access it often. Enables/disables automatic NUMA memory balancing. On NUMA machines, there is a performance penalty if remote memory is accessed by a CPU. When this feature is enabled the kernelContinue reading “Personal memo for ‘Automatic NUMA Balancing’”

Tracing a function with jprobes

One problem with kprobes is that you can’t check validity of the arguments passed to the function you are monitoring. For that matter, jprobes comes in. It’s basically make a wrapper for the existing function and will be called instead without make any changes to the existing function. jprobes is an extention to the kprobesContinue reading “Tracing a function with jprobes”

Tracing an instruction or a function with kprobes

As the kernel is running on top of all other services, it’s hard to debug it in a live system. You can use ‘gdb’ on a live system, but you only can check the current values of some exported symbols. You can’t use breakpoint on a running kernel. If you set a breakpoint, it’ll stopContinue reading “Tracing an instruction or a function with kprobes”

Extending SysRq

Basics about SysRq During the kernel debugging, you can use SysRq to get some details about the system status at some point or to execute some commands without typing the command. We can use one of the below method to trigger the operation. Method 1. $ echo 1 > /proc/sys/kernel/sysrq Press ‘Alt-SysRq-[key]’ combination to triggerContinue reading “Extending SysRq”

Jump into vmcore analysis – Step 8

There’s a time you want to check the local variables or other entries in the stack. Below is an example that was crashed in ‘kmem_freepages’ and needed to check why it’s crashed whiling freeing it. PID: 26 TASK: ffff81027f9197a0 CPU: 0 COMMAND: “events/0” #0 [ffff81027f92fa90] crash_kexec at ffffffff800aaa0c #1 [ffff81027f92fb50] __die at ffffffff8006520f #2 [ffff81027f92fb90]Continue reading “Jump into vmcore analysis – Step 8”

Jump into vmcore analysis – Step 7

If the vmcore was generated by human and you want to check who actually was, you might need to check the related process. There are various options in ‘ps’ command, so, you would be able to check it with below steps. crash> ps -a 6326 PID: 6326 TASK: ffff810402165820 CPU: 1 COMMAND: “fuser” ARG: fuserContinue reading “Jump into vmcore analysis – Step 7”

Jump into vmcore analysis – Step 6

The real merit of the vmcore is that you can trace the code with the current value each variable holds. Here you can find one example that traces the filesystem which ended up with the corrupted data entry somehow. http://pagead2.googlesyndication.com/pagead/show_ads.js crash> bt PID: 6326 TASK: ffff810402165820 CPU: 1 COMMAND: “fuser” #0 [ffff8103b54efa80] crash_kexec at ffffffff800b099cContinue reading “Jump into vmcore analysis – Step 6”