为什么在单处理器上sizeof(spinlock_t)大于零? [英] Why sizeof(spinlock_t) is greater than zero on uni-processor?
本文介绍了为什么在单处理器上sizeof(spinlock_t)大于零?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
下面的行将输出打印为4,而我期望为0.
The following line printed output as 4 whereas I was expecting 0.
printk(KERN_INFO "size of spinlock_t %d\n", sizeof(spinlock_t));
我在具有单个cpu的系统上尝试过此操作.在构建像CONFIG_DEBUG_SPINLOCK or CONFIG_DEBUG_LOCK_ALLOC
这样的内核时,未启用任何调试标志.根据内核头文件,它应该为零,但输出与此不一致,有任何猜测吗?
I tried this on a system with single cpu. No debugging flags are enabled while building kernel like CONFIG_DEBUG_SPINLOCK or CONFIG_DEBUG_LOCK_ALLOC
. According to kernel header files, it should be zero but output is not consistent with it, any guesses ?
推荐答案
我最好的猜测是,尽管您只有一个CPU,但是内核仍然使用CONFIG_SMP
设置进行编译.
The best guess I have is that although you have a single CPU, the kernel is still compiled with CONFIG_SMP
set.
这篇关于为什么在单处理器上sizeof(spinlock_t)大于零?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文