linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Tejun Heo <tj@kernel.org>
To: Imre Deak <imre.deak@nokia.com>
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 17:23:20 +0200	[thread overview]
Message-ID: <4BF2B0E8.3060600@kernel.org> (raw)
In-Reply-To: <20100518111823.GB5261@localhost>

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.  The patch looks good then.  I
still think ^ test would be clearer tho.  Hmmm... Can you please add
little comment there stating that you're looking for the highest bit
flipping?

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

Thanks.

-- 
tejun

  reply	other threads:[~2010-05-18 15:24 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 [this message]
2010-05-18 20:59       ` Imre Deak
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=4BF2B0E8.3060600@kernel.org \
    --to=tj@kernel.org \
    --cc=akpm@linux-foundation.org \
    --cc=eparis@redhat.com \
    --cc=imre.deak@nokia.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=paulmck@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;
as well as URLs for NNTP newsgroup(s).