netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: "Kok, Auke" <auke-jan.h.kok@intel.com>
To: Jeff Garzik <jeff@garzik.org>
Cc: Michael Buesch <mb@bu3sch.de>,
	Christoph Hellwig <hch@infradead.org>,
	Stephen Hemminger <shemminger@linux-foundation.org>,
	"Veeraiyan, Ayyappan" <ayyappan.veeraiyan@intel.com>,
	netdev@vger.kernel.org, arjan@linux.intel.com,
	akpm@linux-foundation.org
Subject: Re: [PATCH] ixgbe: Introduce new 10GbE driver for Intel 82598 based PCI Express adapters...
Date: Mon, 02 Jul 2007 16:57:12 -0700	[thread overview]
Message-ID: <468990D8.6040604@intel.com> (raw)
In-Reply-To: <46897934.5040101@garzik.org>

Jeff Garzik wrote:
> Michael Buesch wrote:
>> On Tuesday 03 July 2007 00:02:57 Kok, Auke wrote:
>>> well, FWIW when I started looking at adding these flags I looked in various 
>>> subsystems in the kernel and picked an implementation that suited. Guess what 
>>> pci.h has? ...:
>>>
>>> 	unsigned int msi_enabled:1;
>>> 	unsigned int msix_enabled:1;
>>>
>>> this is literally where I copied the example from
>>>
>>> I suppose I can fix those, but I really don't understand what all the fuzz is 
>>> about here. We're only conserving memory and staying far away from the real 
>> I'm not sure if these bitfields actually _do_ conserve memory.
>> Generated code gets bigger (need bitwise masks and stuff).
>> Code also needs memory. It probably only conserves memory, if the
>> structure is instanciated a lot.
> 
> Actually, that's a good point.  On several RISC architectures it 
> certainly generates bigger code.

so, even on i386 it does (17 bytes and 6 instructions to test vs. 10:3 if using 
a "bool"):

unsigned int:1:
  8048365:       0f b6 45 f8             movzbl 0xfffffff8(%ebp),%eax
  8048369:       0c 01                   or     $0x1,%al
  804836b:       88 45 f8                mov    %al,0xfffffff8(%ebp)
  804836e:       0f b6 45 f8             movzbl 0xfffffff8(%ebp),%eax
  8048372:       24 01                   and    $0x1,%al
  8048374:       84 c0                   test   %al,%al

bool:
  8048365:       c6 45 fb 01             movb   $0x1,0xfffffffb(%ebp)
  8048369:       0f b6 45 fb             movzbl 0xfffffffb(%ebp),%eax
  804836d:       84 c0                   test   %al,%al

unsigned int:
  8048365:       c7 45 f8 01 00 00 00    movl   $0x1,0xfffffff8(%ebp)
  804836c:       8b 45 f8                mov    0xfffffff8(%ebp),%eax
  804836f:       85 c0                   test   %eax,%eax

using var & flag:
  8048365:       c7 45 f8 01 00 00 00    movl   $0x1,0xfffffff8(%ebp)
  804836c:       8b 45 f8                mov    0xfffffff8(%ebp),%eax
  804836f:       25 00 04 00 00          and    $0x400,%eax
  8048374:       85 c0                   test   %eax,%eax

note that using "var & flag" is slightly larger here... 1 extra instruction and 
7 more bytes.

interesting...


but let's stay constructive here:

~/git/linux-2.6 $ grep -r 'unsigned int.*:1;' * | wc -l
748

Is anyone going to fix those? If we don't, someone will certainly again submit 
patches to add more of these bitfields, after all, some very prominent parts of 
the kernel still use them. Only recently for instance mac80211 merged like 30 of 
these.... and drivers/net, include etc.. certainly has a lot of these.

Cheers,


Auke

  reply	other threads:[~2007-07-02 23:57 UTC|newest]

Thread overview: 41+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-06-12 23:44 [ANNOUNCE] new driver ixgbe for Intel(R) 10GbE PCI Express adapters Ayyappan.Veeraiyan
2007-06-12 23:44 ` [PATCH] ixgbe: Introduce new 10GbE driver for Intel 82598 based " Ayyappan Veeraiyan
2007-07-02 12:52   ` Jeff Garzik
2007-07-02 14:05     ` Arjan van de Ven
2007-07-02 14:25       ` Jeff Garzik
2007-07-02 14:27         ` Arjan van de Ven
2007-07-02 14:41           ` Jeff Garzik
2007-07-02 14:41             ` Arjan van de Ven
2007-07-02 15:26             ` Kok, Auke
2007-07-02 15:32               ` Jeff Garzik
2007-07-02 15:52                 ` Andrew Morton
2007-07-02 16:09                   ` Jeff Garzik
2007-07-02 15:54                 ` Kok, Auke
2007-07-06  8:46                   ` Ingo Oeser
2007-07-02 14:31         ` Arjan van de Ven
2007-07-02 19:00     ` Veeraiyan, Ayyappan
2007-07-02 19:04       ` Ayyappan Veeraiyan
2007-07-02 20:16       ` Christoph Hellwig
2007-07-02 21:09       ` Stephen Hemminger
2007-07-02 21:42         ` Christoph Hellwig
2007-07-02 22:02           ` Kok, Auke
2007-07-02 22:08             ` Jeff Garzik
2007-07-02 22:10             ` Michael Buesch
2007-07-02 22:16               ` Jeff Garzik
2007-07-02 23:57                 ` Kok, Auke [this message]
2007-07-03  0:11                   ` Jeff Garzik
2007-07-03  0:16                   ` Inaky Perez-Gonzalez
2007-07-03 13:19                     ` Jeff Garzik
2007-07-03 18:24                       ` Inaky Perez-Gonzalez
2007-07-05 23:29                         ` Jeff Garzik
2007-07-03  0:08           ` Veeraiyan, Ayyappan
2007-07-03 22:01             ` Ayyappan Veeraiyan
2007-07-02 22:56         ` Veeraiyan, Ayyappan
2007-07-03 12:53       ` Neil Horman
2007-07-05 12:37         ` Neil Horman
2007-07-09 14:21           ` Veeraiyan, Ayyappan
2007-07-10  0:57             ` Neil Horman
2007-06-13 23:05 ` [ANNOUNCE] new driver ixgbe for Intel(R) 10GbE " Francois Romieu
2007-06-13 23:18   ` Kok, Auke
2007-06-14  0:06   ` Ayyappan Veeraiyan
2007-06-14 20:36     ` Francois Romieu

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=468990D8.6040604@intel.com \
    --to=auke-jan.h.kok@intel.com \
    --cc=akpm@linux-foundation.org \
    --cc=arjan@linux.intel.com \
    --cc=ayyappan.veeraiyan@intel.com \
    --cc=hch@infradead.org \
    --cc=jeff@garzik.org \
    --cc=mb@bu3sch.de \
    --cc=netdev@vger.kernel.org \
    --cc=shemminger@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;
as well as URLs for NNTP newsgroup(s).