Why disabling interrupts disables kernel preemption and how spin lock disables preemption

前端 未结 4 1889
梦谈多话
梦谈多话 2020-12-13 10:55

I am reading Linux Kernel Development recently, and I have a few questions related to disabling preemption.

  1. In the \"Interrupt Control\" section of

4条回答
  •  温柔的废话
    2020-12-13 11:54

    In a test kernel module I wrote to monitor/profile a task, I've tried disabling interrupts by:

    1 - Using local_irq_save()

    2 - Using spin_lock_irqsave()

    3 - Manually disable_irq() to all IRQs in /proc/interrupts

    In all 3 cases I could still use the hrtimer to measure time even though IRQs were disabled (and a task I was monitoring got preempted as well).

    I find this veeeeerrrryyyy strange... I personally was anticipating what Sebastian Mountaniol pointed out -> No interrupts - no clock. No clock - no timers...

    Linux kernel 2.6.32 on a single core, single CPU... Can anyone have a better explanation ?

提交回复
热议问题