[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <CAHk-=wh=aLuvLu++ZcehjDLgZfSqOVK+whecEq_-JP12VQ96sg@mail.gmail.com>
Date: Thu, 6 Dec 2018 10:51:33 -0800
From: Linus Torvalds <torvalds@...ux-foundation.org>
To: Christoph Hellwig <hch@....de>
Cc: iommu@...ts.linux-foundation.org, brouer@...hat.com,
tariqt@...lanox.com, ilias.apalodimas@...aro.org, toke@...e.dk,
robin.murphy@....com,
Linux List Kernel Mailing <linux-kernel@...r.kernel.org>
Subject: Re: [RFC] avoid indirect calls for DMA direct mappings
On Thu, Dec 6, 2018 at 10:43 AM Christoph Hellwig <hch@....de> wrote:
>
> >
> > (a) the dma_is_direct() function/macro uses "likely()" for the test
>
> I'm a little worried about that. Yes, for the common case it is
> likely. But if you run a setup where you say always have an iommu
> it is not, in fact it is never called in that case, but we only know
> that at runtime.
Note that "likely()" doesn't have any really huge overhead - it just
makes the compiler move the unlikely case out-of-line.
Compared to the overhead of the indirect branch, it's simply not a
huge deal, it's more a mispredict and cache layout issue.
So marking something "likely()" when it isn't doesn't really penalize
things too much. It's not like an exception or anything like that,
it's really just a marker for better code layout.
Linus
Powered by blists - more mailing lists