- 论坛徽章:
- 20
|
2. 可以看一下 Document/local_ops.txt
- Preemption (or interrupts) must be disabled when using local ops in
process context to make sure the process won't be migrated to a
different CPU between getting the per-cpu variable and doing the
actual local op.
- When using local ops [in interrupt context], no special care must be
taken on a mainline kernel, since they will run on the local CPU [with
preemption already disabled]. I suggest, however, to explicitly
disable preemption anyway to make sure it will still work correctly on
-rt kernels.
您举的这个例子,入口/出口用到了irq_save/irq_restore,说明这段代码即可被用在interrupt context,也可用在process context。
如果仅用在interrupt context,就没有必要save和restore了。
不过也许您讨论的上下文是-rt内核,那上面那段话就不成立了。
回复 4# 镇水铁牛
|
|