All of lore.kernel.org
 help / color / mirror / Atom feed
From: Andrew Morton <akpm@linux-foundation.org>
To: Davide Libenzi <davidel@xmailserver.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 02/18] flag parameters: socket and socketpair
Date: Mon, 5 May 2008 19:17:25 -0700	[thread overview]
Message-ID: <20080505191725.89faed88.akpm@linux-foundation.org> (raw)
In-Reply-To: <Pine.LNX.4.64.0805051910050.20837@alien.or.mcafeemobile.com>

On Mon, 5 May 2008 19:13:14 -0700 (PDT) Davide Libenzi <davidel@xmailserver.org> wrote:

> On Mon, 5 May 2008, Andrew Morton wrote:
> 
> > On Sun, 4 May 2008 23:42:46 -0400 Ulrich Drepper <drepper@redhat.com> wrote:
> > 
> > > +static const struct flags_rmap sock_file_flags_remap[] = {
> > > +	{ SOCK_CLOEXEC, O_CLOEXEC },
> > > +};
> > > +
> > >  asmlinkage long sys_socket(int family, int type, int protocol)
> > >  {
> > >  	int retval;
> > >  	struct socket *sock;
> > > +	int fflags;
> > > +
> > > +	type = flags_remap(sock_file_flags_remap,
> > > +			   ARRAY_SIZE(sock_file_flags_remap),
> > > +			   type, &fflags);
> > 
> > oh, so that's what it does.
> > 
> > afaict we only ever remap one or two flags.  Would it not be more efficient
> > to do that inline?  Something along the lines of:
> > 
> > 	type = flag_remap(type, &fflags, SOCK_whatever, O_whatever);
> > 	type = flag_remap(type, &fflags, SOCK_whatever2, O_whatever2);
> > 
> > ?
> 
> I think it is better to keep it able to remap more than one flag, with a 
> single call, that is table driven.
> 

The table-driven approach is slower for one and probably two bits and it is
somewhat less readable.  What do we gain in return for this?

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

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-05-05  3:42 [PATCH 02/18] flag parameters: socket and socketpair Ulrich Drepper
2008-05-05  4:24 ` YOSHIFUJI Hideaki / 吉藤英明
2008-05-05  5:00   ` Ulrich Drepper
2008-05-05  8:11 ` David Miller
2008-05-06  1:58 ` Andrew Morton
2008-05-06  2:13   ` Davide Libenzi
2008-05-06  2:17     ` Andrew Morton [this message]
2008-05-06  2:30       ` Davide Libenzi
2008-05-06 11:43       ` Alan Cox
2008-05-06  2:33   ` Ulrich Drepper
2008-05-06  2:42     ` Andrew Morton
2008-05-06  2:58       ` Ulrich Drepper
2008-05-06  3:05         ` Andrew Morton
2008-05-06  3:10           ` Ulrich Drepper
2008-05-06  3:02       ` Ulrich Drepper

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=20080505191725.89faed88.akpm@linux-foundation.org \
    --to=akpm@linux-foundation.org \
    --cc=davidel@xmailserver.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 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.