public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Dave Hansen <dave@linux.vnet.ibm.com>
To: Matt Helsley <matthltc@us.ibm.com>
Cc: vda.linux@googlemail.com, bblum@google.com,
	linux-kernel@vger.kernel.org,
	containers@lists.linux-foundation.org, menage@google.com,
	akpm@linux-foundation.org
Subject: Re: [RFCv2][PATCH] flexible array implementation
Date: Wed, 22 Jul 2009 15:03:26 -0700	[thread overview]
Message-ID: <1248300206.24021.347.camel@nimitz> (raw)
In-Reply-To: <20090722183018.GE5878@count0.beaverton.ibm.com>

On Wed, 2009-07-22 at 11:30 -0700, Matt Helsley wrote:
> > +static int __check_part_and_nr(struct flex_array *fa,
> > +                            int part_nr, int element_nr)
> > +{
> > +     if (part_nr >= __nr_part_ptrs() ||
> > +         element_nr > fa->nr_elements) {
> > +             WARN(1, "bad flexible array element number: %d > %d\n",
> > +                     element_nr, fa->nr_elements);
> > +             return -EINVAL;
> > +     }
> > +     return 0;
> > +}
> 
> Should the above be inline? Does it make sense to optimize the "common"
> case and penalize inappropriate access by putting an unlikely() in
> there? Or is it too early for this stuff?

I think I'll leave it to the compiler for now.  Since we also don't have
a single user, I don't think we have an idea how hot of a path this
might get used in.

> I wonder how the *, /, and % ops will affect things that otherwise
> would have been reduced to shifts and masks -- especially on the
> "smaller" embedded archs.

I'm generally fine with rounding all these sizes to powers-of-two.  But,
I do think it's a wee bit premature at this point.

-- Dave


  reply	other threads:[~2009-07-22 22:03 UTC|newest]

Thread overview: 18+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-07-21 22:00 [RFCv2][PATCH] flexible array implementation Dave Hansen
2009-07-21 22:09 ` Dave Hansen
2009-07-21 22:35   ` Andrew Morton
2009-07-22  3:25 ` Li Zefan
2009-07-22  4:34   ` Dave Hansen
2009-07-22  6:14     ` Li Zefan
2009-07-22  7:09 ` Amerigo Wang
2009-07-22 15:02   ` Dave Hansen
2009-07-22 18:30 ` Matt Helsley
2009-07-22 22:03   ` Dave Hansen [this message]
2009-07-22 19:55 ` Mike Waychison
2009-07-22 22:00   ` Dave Hansen
2009-07-22 20:57 ` Benjamin Blum
2009-07-22 21:51   ` Dave Hansen
2009-07-22 23:20     ` Benjamin Blum
2009-07-23  5:41       ` Dave Hansen
2009-07-23  2:45 ` H. Peter Anvin
2009-07-23 14:30   ` Dave Hansen

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=1248300206.24021.347.camel@nimitz \
    --to=dave@linux.vnet.ibm.com \
    --cc=akpm@linux-foundation.org \
    --cc=bblum@google.com \
    --cc=containers@lists.linux-foundation.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=matthltc@us.ibm.com \
    --cc=menage@google.com \
    --cc=vda.linux@googlemail.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