Re: irq_pipeline: likely/unlikely macro usage

Jan Kiszka <[email protected]>
Newsgroups dev.linux.lists.xenomai
Message-ID <[email protected]>
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?

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
> 

-- 
Siemens AG, Foundational Technologies
Linux Expert Center
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.