All of lore.kernel.org
 help / color / mirror / Atom feed
From: Imre Deak <imre.deak@nokia.com>
To: ext Tejun Heo <tj@kernel.org>
Cc: Andrew Morton <akpm@linux-foundation.org>,
	Eric Paris <eparis@redhat.com>,
	"Paul E. McKenney" <paulmck@linux.vnet.ibm.com>,
	LKML <linux-kernel@vger.kernel.org>
Subject: Re: [PATCH] idr: fix backtrack logic in idr_remove_all
Date: Tue, 18 May 2010 23:59:14 +0300	[thread overview]
Message-ID: <20100518205914.GA11667@localhost> (raw)
In-Reply-To: <4BF2B0E8.3060600@kernel.org>

On Tue, May 18, 2010 at 05:23:20PM +0200, ext Tejun Heo wrote:
> On 05/18/2010 01:18 PM, Imre Deak wrote:
> >> Shouldn't this be id ^ bt_mask?  The above only detects 1 -> 0
> >> transitions not the other way around.
> > 
> > It works according to the following with n=1:
> > 
> > id            id+2            fls((id+2) & ~id)
> > 0             2               2
> > 2             4               3
> > 4             6               2
> > 6             8               4
> > 8             10              2
> > 10            12              3
> > 12            14              2
> > 
> > I think this should work.
> 
> Ah, I thought you were doing fls(id & ~(id + 2)) and thus looking at 1
> -> 0 transitions.  It's the other way and you're looking for the
> highest 0 -> 1 transition which should be the same to the highest bit
> changing if you aren't overflowing.

Yes, both ways you get the same result and in case of overflow neither
will work.

> The patch looks good then.  I still think ^ test would be clearer tho.
> Hmmm...

Well xor results in one instruction less on machines without a nand
instruction, so I'll change that.

> Can you please add little comment there stating that you're
> looking for the highest bit flipping?

Yes, I'll re-test and follow up with an updated patch.

Thanks for the review,
Imre

> 
> Reviewed-by: Tejun Heo <tj@kernel.org>
> 
> Thanks.
> 

  reply	other threads:[~2010-05-18 21:18 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-05-12 11:47 [PATCH] idr: fix backtrack logic in idr_remove_all imre.deak
2010-05-18 10:24 ` Tejun Heo
2010-05-18 11:18   ` Imre Deak
2010-05-18 15:23     ` Tejun Heo
2010-05-18 20:59       ` Imre Deak [this message]
2010-05-18 22:23         ` [PATCH v2] " imre.deak

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=20100518205914.GA11667@localhost \
    --to=imre.deak@nokia.com \
    --cc=akpm@linux-foundation.org \
    --cc=eparis@redhat.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=paulmck@linux.vnet.ibm.com \
    --cc=tj@kernel.org \
    /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.