From: Julia Lawall <julia.lawall@lip6.fr>
To: Geert Uytterhoeven <geert@linux-m68k.org>
Cc: Julia Lawall <julia.lawall@lip6.fr>,
David Laight <David.Laight@aculab.com>,
linux-rdma <linux-rdma@vger.kernel.org>,
"kernel-janitors@vger.kernel.org"
<kernel-janitors@vger.kernel.org>,
Linux Fbdev development list <linux-fbdev@vger.kernel.org>,
Linux-sh list <linux-sh@vger.kernel.org>,
"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>,
"ath10k@lists.infradead.org" <ath10k@lists.infradead.org>,
linux-wireless <linux-wireless@vger.kernel.org>,
"netdev@vger.kernel.org" <netdev@vger.kernel.org>,
driverdevel <devel@driverdev.osuosl.org>,
"iss_storagedev@hp.com" <iss_storagedev@hp.com>,
scsi <linux-scsi@vger.kernel.org>,
linux-s390 <linux-s390@vger.kernel.org>,
"adi-buildroot-devel@lists.sourceforge.net"
<adi-buildroot-devel@lists.sourceforge.net>,
Arnd Bergmann <arnd@arndb.de>,
sebott@linux.vnet.ibm.com
Subject: Re: [PATCH 0/10] use safer test on the result of find_first_zero_bit
Date: Wed, 4 Jun 2014 15:12:23 +0200 (CEST) [thread overview]
Message-ID: <alpine.DEB.2.10.1406041510520.2441@hadrien> (raw)
In-Reply-To: <CAMuHMdV2wP43Lxf-UtCum37HyMPSboRb6RLNTHzm_ZNOBeJR0g@mail.gmail.com>
On Wed, 4 Jun 2014, Geert Uytterhoeven wrote:
> Hi Julia,
>
> On Wed, Jun 4, 2014 at 1:00 PM, Julia Lawall <julia.lawall@lip6.fr> wrote:
> > OK, thanks. I was only looking at the C code.
> >
> > But the C code contains a loop that is followed by:
> >
> > if (!size)
> > return result;
> > tmp = *p;
> >
> > found_first:
> > tmp |= ~0UL << size;
> > if (tmp == ~0UL) /* Are any bits zero? */
> > return result + size; /* Nope. */
> >
> > In the first return, it would seem that result == size. Could the second
> > one be changed to just return size? It should not hurt performance.
>
> "size" may have been changed between function entry and this line.
> So you have to store it in a temporary.
Sorry, after reflection it seems that indeed size + result is always the
original size, so it is actually all of the code that uses >= that is
doing something unnecessary. == for the failure test is fine.
julia
next prev parent reply other threads:[~2014-06-04 13:12 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-06-04 9:07 [PATCH 0/10] use safer test on the result of find_first_zero_bit Julia Lawall
2014-06-04 9:07 ` [PATCH 2/10] ath10k: " Julia Lawall
2014-06-04 9:35 ` [PATCH 0/10] " Geert Uytterhoeven
[not found] ` <CAMuHMdXsoFUXj4jLMWN6NY7Um19KwWO9Rhx=9=gqWu_K5Ev2kQ-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2014-06-04 9:38 ` Julia Lawall
2014-06-04 9:46 ` David Laight
2014-06-04 9:52 ` Julia Lawall
2014-06-04 10:55 ` Geert Uytterhoeven
2014-06-04 11:00 ` Julia Lawall
2014-06-04 11:07 ` Geert Uytterhoeven
2014-06-04 13:12 ` Julia Lawall [this message]
2014-06-04 13:34 ` David Laight
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=alpine.DEB.2.10.1406041510520.2441@hadrien \
--to=julia.lawall@lip6.fr \
--cc=David.Laight@aculab.com \
--cc=adi-buildroot-devel@lists.sourceforge.net \
--cc=arnd@arndb.de \
--cc=ath10k@lists.infradead.org \
--cc=devel@driverdev.osuosl.org \
--cc=geert@linux-m68k.org \
--cc=iss_storagedev@hp.com \
--cc=kernel-janitors@vger.kernel.org \
--cc=linux-fbdev@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-rdma@vger.kernel.org \
--cc=linux-s390@vger.kernel.org \
--cc=linux-scsi@vger.kernel.org \
--cc=linux-sh@vger.kernel.org \
--cc=linux-wireless@vger.kernel.org \
--cc=netdev@vger.kernel.org \
--cc=sebott@linux.vnet.ibm.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox