Linux – How to check the kernel preemption configuration

kernellinux

I want to check if my Linux kernel is preemptive or non-preemptive.
How can I check this using a command, something such as uname -a?

Best Answer

Whether a kernel is preemptive or not depends on what you want to preempt, as in the Linux kernel, there are various things that can have preemption enabled/disabled separately.

If your kernel has CONFIG_IKCONFIG and CONFIG_IKCONFIG_PROC enabled, you can find out your preemption configuration through /proc/config.gz (if you don't have this, some distributions ship the kernel config in /boot instead):

$ gzip -cd /proc/config.gz | grep PREEMPT
CONFIG_TREE_PREEMPT_RCU=y
CONFIG_PREEMPT_RCU=y
CONFIG_PREEMPT_NOTIFIERS=y
# CONFIG_PREEMPT_NONE is not set
# CONFIG_PREEMPT_VOLUNTARY is not set
CONFIG_PREEMPT=y
CONFIG_PREEMPT_COUNT=y
# CONFIG_DEBUG_PREEMPT is not set
# CONFIG_PREEMPT_TRACER is not set

If you have CONFIG_IKCONFIG, but not CONFIG_IKCONFIG_PROC, you can still get it out of the kernel image with extract-ikconfig.

Related Question