We obviously have lots of those, so even small savings add up.
Bitfields are dropped because they don't give any memory savings due to
alignment requirements (but would still require more complex to access).
/* size: 184, cachelines: 3, members: 28 */
/* sum members: 172, holes: 1, sum holes: 4 */
/* sum bitfield members: 4 bits (0 bytes) */
/* padding: 7 */
/* bit_padding: 4 bits */
↓
/* size: 176, cachelines: 3, members: 28 */
DnsAnswer *answer;
DnsResourceRecord *opt;
+ /* For support of truncated packets */
+ DnsPacket *more;
+
/* Packet reception metadata */
+ usec_t timestamp; /* CLOCK_BOOTTIME (or CLOCK_MONOTONIC if the former doesn't exist) */
int ifindex;
int family, ipproto;
union in_addr_union sender, destination;
uint16_t sender_port, destination_port;
uint32_t ttl;
- usec_t timestamp; /* CLOCK_BOOTTIME (or CLOCK_MONOTONIC if the former doesn't exist) */
- /* For support of truncated packets */
- DnsPacket *more;
+ bool on_stack;
+ bool extracted;
+ bool refuse_compression;
+ bool canonical_form;
- bool on_stack:1;
- bool extracted:1;
- bool refuse_compression:1;
- bool canonical_form:1;
+ /* Note: fields should be ordered to minimize alignment gaps. Use pahole! */
};
static inline uint8_t* DNS_PACKET_DATA(const DnsPacket *p) {