All of lore.kernel.org
 help / color / mirror / Atom feed
From: Shuah Khan <shuah.khan@hp.com>
To: mtk.manpages@gmail.com
Cc: Dan Carpenter <dan.carpenter@oracle.com>,
	Andrew Morton <akpm@linux-foundation.org>,
	konrad.wilk@oracle.com, rob@landley.net, joerg.roedel@amd.com,
	devel@linuxdriverproject.org, linux-kernel@vger.kernel.org,
	linux-doc@vger.kernel.org, shuahkhan@gmail.com
Subject: Re: [PATCH] Documentation DMA-API-HOWTO.txt Add dma mapping error check usage examples
Date: Thu, 18 Oct 2012 08:30:59 -0600	[thread overview]
Message-ID: <1350570659.2680.5.camel@lorien2> (raw)
In-Reply-To: <CAKgNAkhx2trGUMCbpYbKbMYYjq9oTeAnqG436_MP2t6noA3K-g@mail.gmail.com>

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



  reply	other threads:[~2012-10-18 14:31 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-10-14 15:54 [PATCH] Documentation DMA-API-HOWTO.txt Add dma mapping error check usage examples Shuah Khan
2012-10-18  9:47 ` Dan Carpenter
2012-10-18 10:13   ` Michael Kerrisk (man-pages)
2012-10-18 14:30     ` Shuah Khan [this message]
2012-10-18 20:00     ` [PATCH v2] " Shuah Khan
2012-10-18 21:32       ` Jesper Juhl
2012-10-19 16:57       ` Konrad Rzeszutek Wilk
2012-10-24 15:09       ` Joerg Roedel

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1350570659.2680.5.camel@lorien2 \
    --to=shuah.khan@hp.com \
    --cc=akpm@linux-foundation.org \
    --cc=dan.carpenter@oracle.com \
    --cc=devel@linuxdriverproject.org \
    --cc=joerg.roedel@amd.com \
    --cc=konrad.wilk@oracle.com \
    --cc=linux-doc@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mtk.manpages@gmail.com \
    --cc=rob@landley.net \
    --cc=shuahkhan@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.