From: Willy Tarreau Date: Sat, 7 Dec 2013 00:09:04 +0000 (+0100) Subject: OPTIM: ebtree: pack the struct eb_node to avoid holes on 64-bit X-Git-Tag: v1.5-dev20~143 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=f82eb0283046db906dd5845cd6ee2a26bdc70314;p=thirdparty%2Fhaproxy.git OPTIM: ebtree: pack the struct eb_node to avoid holes on 64-bit struct eb_node is 36 bytes on a 64-bit machine. It's thus rounded up to 40 bytes, and when forming a struct eb32_node, another 4 bytes are added, rounded up to 48 bytes. We waste 8 bytes of space on 48 bytes because of alignments. It's basically the same with memory blocks and immediate strings. By packing the structure, eb32_node is down to 40 bytes. This saves 16 bytes per struct task and 20 bytes per struct stksess, used to store each stick-table key. --- diff --git a/ebtree/ebtree.h b/ebtree/ebtree.h index e5bcb50386..39226e3fb5 100644 --- a/ebtree/ebtree.h +++ b/ebtree/ebtree.h @@ -377,7 +377,7 @@ struct eb_node { eb_troot_t *leaf_p; /* leaf node's parent */ short int bit; /* link's bit position. */ short unsigned int pfx; /* data prefix length, always related to leaf */ -}; +} __attribute__((packed)); /* Return the structure of type whose member points to */ #define eb_entry(ptr, type, member) container_of(ptr, type, member)