lkml.org 
[lkml]   [2012]   [Oct]   [18]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
SubjectRe: [PATCH] Documentation DMA-API-HOWTO.txt Add dma mapping error check usage examples
From
Date
On Thu, 2012-10-18 at 12:13 +0200, Michael Kerrisk (man-pages) wrote:
> On Thu, Oct 18, 2012 at 11:47 AM, Dan Carpenter
> <dan.carpenter@oracle.com> wrote:
> > On Sun, Oct 14, 2012 at 09:54:24AM -0600, Shuah Khan wrote:
> >> diff --git a/Documentation/DMA-API-HOWTO.txt b/Documentation/DMA-API-HOWTO.txt
> >> index a0b6250..cf1adb4 100644
> >> --- a/Documentation/DMA-API-HOWTO.txt
> >> +++ b/Documentation/DMA-API-HOWTO.txt
> >> @@ -468,11 +468,46 @@ To map a single region, you do:
> >> size_t size = buffer->len;
> >>
> >> dma_handle = dma_map_single(dev, addr, size, direction);
> >> + if (unlikely(dma_mapping_error(dma_handle))) {
> >
> > Don't encourage people to put unlikely() and likely() into their
> > driver code. It should only be used after benchmarking both with
> > and without. I can't imagine how it would make a measurable
> > difference here.
>
> (Hi Dan)
>
> Quite. See http://blog.man7.org/2012/10/how-much-do-builtinexpect-likely-and.html
>
> I wonder how many blind uses of likely() and unlikely() in the kernel
> are actually degrading performance.
>
> Cheers,
>
> Michael


Dan, Michael,

Thanks. I see unlikely() and likely() used widely and didn't realize the
negatives of it. Will fix the examples without the use of unlikely() and
send v2 patch.

Thanks,
-- Shuah




\
 
 \ /
  Last update: 2012-10-18 17:01    [W:1.035 / U:0.272 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site