Em Mon, Sep 22, 2008 at 09:21:53AM +0200, Gerrit Renker escreveu:
As above:
[acme@doppio ~]$ pahole -C dccp_feat_entry dccp
struct dccp_feat_entry {
u8 feat_num; /* 0 1 */
/* XXX 7 bytes hole, try to pack */
dccp_feat_val val; /* 8 16 */
enum dccp_feat_state state:8; /* 24:24 4 */
/* Bitfield combined with next fields */
_Bool needs_mandatory:1; /* 25: 7 1 */
_Bool needs_confirm:1; /* 25: 6 1 */
_Bool empty_confirm:1; /* 25: 5 1 */
_Bool is_local:1; /* 25: 4 1 */
/* XXX 4 bits hole, try to pack */
/* XXX 6 bytes hole, try to pack */
struct list_head node; /* 32 16 */
/* size: 48, cachelines: 1, members: 8 */
/* sum members: 35, holes: 2, sum holes: 13 */
/* bit holes: 1, sum bit holes: 4 bits */
/* last cacheline: 48 bytes */
};
In this case, unless you plan to put more stuff into this struct in the
future, using a bitfield for the bool members is a pessimization, as we
will use the same amount of memory and generate more complex code. So I
suggest:
struct dccp_feat_entry {
dccp_feat_val val; /* 0 16 */
enum dccp_feat_state state:8; /* 16:24 4 */
/* Bitfield combined with next fields */
u8 feat_num; /* 17 1 */
_Bool needs_mandatory; /* 18 1 */
_Bool needs_confirm; /* 19 1 */
_Bool empty_confirm; /* 20 1 */
_Bool is_local; /* 21 1 */
/* XXX 2 bytes hole, try to pack */
struct list_head node; /* 24 16 */
/* size: 40, cachelines: 1, members: 8 */
/* sum members: 38, holes: 1, sum holes: 2 */
/* last cacheline: 40 bytes */
};
- Arnaldo
--
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html