Linux Module to print number of CPU's

We can look at /proc/cpuinfo to find out the number of processors present in Linux from user space.


What if we want to find out the number of cpus in kernel module. num_online_cpus() function can give the number of CPU's which are online.

Code:



Output:


References:

https://stackoverflow.com/questions/43171805/find-number-of-cpus-in-linux-kernel

Comments

Popular posts from this blog

bb.utils.contains yocto

make config vs oldconfig vs defconfig vs menuconfig vs savedefconfig

PR, PN and PV Variable in Yocto