1

Assume I have RSS and interrupt affinity correctly set up.

Is it guaranteed by the Linux kernel that a softirq is executed on the same CPU/core where hardware interrupt handler has been triggered? I understand that interrupt handler would schedule a softirq for execution, and the actual execution may happen later.

Mark
  • 6,052
  • 8
  • 61
  • 129
  • 1
    At least for _tasklets_, if the tasklet is not already currently scheduled to run on some other CPU then it will be scheduled to run on the requesting CPU. – Ian Abbott Nov 05 '20 at 09:56
  • @IanAbbott, is there a way to enforce executing `softirq` on the same core (when possible) where the hard IRQ has executed? Or given the nature of softirq implementation in Linux this is no feasible/efficient? – Mark Nov 05 '20 at 13:31
  • 1
    I'm not sure what sort of softirq you mean, but for tasklets, as long as you ensure that it is only ever scheduled by a particular CPU (the one with affinity to the hardirq) then it will always execute on that CPU. – Ian Abbott Nov 05 '20 at 13:53
  • @IanAbbott, I meant for instance `NET_RX_SOFTIRQ`. – Mark Nov 05 '20 at 14:55
  • 2
    I'm not that familiar with the network code, but it looks like `napi_schedule()` will schedule the poll function (from the `struct napi_struct` `poll` member) to run on the same current CPU, unless it is already scheduled, so a bit like tasklets. However, it could also be scheduled from the timer set up as part of the `struct napi_struct` and I think the timer routine could be running on a different CPU. – Ian Abbott Nov 05 '20 at 15:44

0 Answers0