public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Andrew Morton <akpm@linux-foundation.org>
To: Roland Dreier <roland@kernel.org>
Cc: Joern Engel <joern@logfs.org>, linux-kernel@vger.kernel.org
Subject: Re: [PATCH 1/2] btree: Fix tree corruption in btree_get_prev()
Date: Wed, 6 Jun 2012 18:29:38 -0700	[thread overview]
Message-ID: <20120606182938.f8f6178d.akpm@linux-foundation.org> (raw)
In-Reply-To: <CAG4TOxNwVYPPP_AL=YZ6LnZZWyp8FUa50aGtgqGjTwnu598-Lw@mail.gmail.com>

On Wed, 6 Jun 2012 17:44:20 -0700 Roland Dreier <roland@kernel.org> wrote:

> On Wed, Jun 6, 2012 at 4:36 PM, Roland Dreier <roland@kernel.org> wrote:
> > On the other hand, your change makes me think we don't
> > even need a separate iterator (and we can avoid the variable
> > length array declaration)
> 
> FWIW with that change on top of my patch, I see
> 
> add/remove: 0/0 grow/shrink: 0/1 up/down: 0/-123 (-123)
> function                                     old     new   delta
> btree_get_prev                               646     523    -123
> 
> on x86-64, so avoiding the variable length array is definitely
> worth something.
> 
> So the issue for me is whether messing with the caller's
> __key storage is OK, or if it's worth having a temporary
> local variable.
> 

Sometimes altering the caller's *__key when lookup fails is pretty rude
behavior :(

Perhaps we could add an arg to btree_get_prev(), provide it with
separate input and output key pointers?

      reply	other threads:[~2012-06-07  1:29 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-06-06 17:17 [PATCH 1/2] btree: Fix tree corruption in btree_get_prev() Roland Dreier
2012-06-06 17:17 ` [PATCH 2/2] btree: Catch NULL value before it does harm Roland Dreier
2012-06-06 23:21 ` [PATCH 1/2] btree: Fix tree corruption in btree_get_prev() Andrew Morton
2012-06-06 23:36   ` Roland Dreier
2012-06-07  0:44     ` Roland Dreier
2012-06-07  1:29       ` Andrew Morton [this message]

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=20120606182938.f8f6178d.akpm@linux-foundation.org \
    --to=akpm@linux-foundation.org \
    --cc=joern@logfs.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=roland@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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox