Re: [PATCH v2 net-next af-packet 1/2] Enhance af-packet to provide(near zero)lossless packet capture functionality.
From: chetan loke
Date: Thu Jul 07 2011 - 09:05:08 EST
On Thu, Jul 7, 2011 at 3:13 AM, David Miller <davem@xxxxxxxxxxxxx> wrote:
> Get rid of __packed__, it's going to kill performance on RISC
> platforms. ÂIf you use __packed__, regardless of the actual alignment,
The performance boost has been achieved by amortizing the cost of
static spin-wait/poll and not by shrinking the data-set.
> the compiler must assume that each part of the struct "might" be
> unaligned. ÂSo on architectures such as sparc where alignment matters,
> a word is going to be accessed by a sequence of byte loads/stores.
>
Haven't worked with sparc so I didn't know. Thanks for the insight.
One also needs to analyze both the user/kernel components.The app
reads the header(hdr_size <<< blk_size) just once and then walks the
entire block. Apps operate on local copy of the variable and not on
the header.
kernel components - almost everything is cached in kbdq_core. block is
updated while closing.
> Do not use packed unless absolutely enforced by a protocol or hardware
> data structure, it's evil.
>
Depends. Why not evaluate on case-by-case basis? All I need to do is
pass this definition of the header around and only mandate how wide
the fields should be.
Once packed, I don't need to worry about padding on different
OS's/arch's. All I care about is the offset to the first pkt and other
details. The block says - you provide me offset to the first packet
and I will start walking the packets.
Another way to look at it - you pack something and then no padding is
needed(not the right example because every pkt-header will be
byte-sequenced if packed but you get the idea) :
http://git2.kernel.org/?p=linux/kernel/git/davem/net-2.6.git;a=commit;h=13fcb7bd322164c67926ffe272846d4860196dc6
Chetan Loke
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/