mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Davide Libenzi <davidel@xmailserver.org>
To: Andrew Morton <akpm@linux-foundation.org>
Cc: Ulrich Drepper <drepper@redhat.com>,
	Linux Kernel Mailing List <linux-kernel@vger.kernel.org>,
	netdev@vger.kernel.org, mtk.manpages@gmail.com,
	Linus Torvalds <torvalds@linux-foundation.org>
Subject: Re: [PATCH 01/18] flag parameters: helper function
Date: Mon, 5 May 2008 19:09:32 -0700 (PDT)	[thread overview]
Message-ID: <Pine.LNX.4.64.0805051856550.20837@alien.or.mcafeemobile.com> (raw)
In-Reply-To: <20080505185103.b9299541.akpm@linux-foundation.org>

On Mon, 5 May 2008, Andrew Morton wrote:

> > +int flags_remap(const struct flags_rmap *m, int n,
> > +		int f, int *rf)
> > +{
> > +	int i;
> > +	for (i = 0, *rf = 0; f && i < n; i++, m++)
> > +		if (f & m->f) {
> > +			*rf |= m->of;
> > +			f &= ~m->f;
> > +		}
> > +	return f;
> > +}
> 
> hm, that looks expensive.  The compiler will need to generate a deref of m
> and rf multiple times around the loop.  Copying them into locals does
> improve that a lot.

That's not a fast path. The extra cycles in the ldr/str get lost in the 
overall syscall cost. But I guess Uli (or myself afterward) can change it 
if you fill picky about it ;)



> I'm only on [1/18] so I don't know how often this code gets executed.  If
> it's "on each open" then ouch, perhaps it might even be worth investigating a
> table-based implementation.
> 
> Also: sorry, but ugh-at-the-naming.  We don't *gain* anything from having
> idenitifers called f, of, m, n and rf.  And we lose quite a lot in
> readability and understandability.  It would be much nicer to invest a
> little bit more typing-time here, IMO.

Why? Don't you like nibble-sized variable names? :)
Uli took my email-code as is, so either he changes it, or I'll post 
patches over it later.




- Davide



  reply	other threads:[~2008-05-06  2:09 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-05-05  3:42 Ulrich Drepper
2008-05-05  4:45 ` Davide Libenzi
2008-05-05  5:02   ` Ulrich Drepper
2008-05-06  1:51 ` Andrew Morton
2008-05-06  2:09   ` Davide Libenzi [this message]
2008-05-06  2:39   ` Ulrich Drepper
2008-05-06  2:56     ` Andrew Morton

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=Pine.LNX.4.64.0805051856550.20837@alien.or.mcafeemobile.com \
    --to=davidel@xmailserver.org \
    --cc=akpm@linux-foundation.org \
    --cc=drepper@redhat.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mtk.manpages@gmail.com \
    --cc=netdev@vger.kernel.org \
    --cc=torvalds@linux-foundation.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

all inboxes | Powered by JetHome®