Re: irq_pipeline: likely/unlikely macro usage
Tobias Schaffner <[email protected]>
| Newsgroups | dev.linux.lists.xenomai |
|---|---|
| Message-ID | <[email protected]> |
On 2/16/26 13:51, Jan Kiszka wrote: > On 16.02.26 13:26, Tobias Schaffner wrote: >> Hi all, >> >> while staring at the irq_pipelining implementation, I noticed that there >> are some locations that use the unlikely macro for the OOB fast path, >> e.g., [1]. >> >> Could someone explain why we are optimizing for the in-band path here? >> Although the in-band path is indeed more likely, I would have expected >> that we would want to optimize for the OOB path anyway, since this is >> where the saved cycles really matter. >> > > Likely/unlikely optimizations are generally tricky. They are hints which > might even be ignored by concrete archs or in concrete situations. > > If they lead to consistently higher latency for oob, I would agree that > we should lean to that path instead. However, if they reduce the average > latency for inband and practically do not increase the worst-case for > oob, it might be a better decision to take that performance optimization > because the worst-case latency is what matters for oob more. > > But it remains a fair question whether we can answer that question > whenever we added [un]likely... Did you find inconsistencies in their > usage as well? No, it does not look inconsistent to me. It looks like the more frequent path is consistently chosen. And I wondered if this is correct. Best, Tobias > Jan > >> Best, >> Tobias >> >> [1] https://gitlab.com/Xenomai/linux-dovetail/-/blob/v5.10.y-dovetail/ >> arch/x86/kernel/irq_pipeline.c?ref_type=heads#L260 >> >