summaryrefslogtreecommitdiffstats
path: root/src/resolve
diff options
context:
space:
mode:
authorZbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl>2021-05-14 11:28:17 +0200
committerZbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl>2021-05-14 16:31:16 +0200
commit9079bd32ce72a7e2e131e214d9b64b464f67fb2b (patch)
tree2372d99e29307ecb624cd01588e384660cf43c8c /src/resolve
parentresolved: make counter for redirects smaller (diff)
downloadsystemd-9079bd32ce72a7e2e131e214d9b64b464f67fb2b.tar.xz
systemd-9079bd32ce72a7e2e131e214d9b64b464f67fb2b.zip
resolved: pahole optimization for DnsQuery
Change from the last three commits: /* size: 312, cachelines: 5, members: 46 */ /* sum members: 296, holes: 5, sum holes: 16 */ ↓ /* size: 288, cachelines: 5, members: 46 */ /* sum members: 286, holes: 1, sum holes: 1 */ It's not a big difference, but we might have quite a few queries in flight, so let' make this a bit more efficient.
Diffstat (limited to 'src/resolve')
-rw-r--r--src/resolve/resolved-dns-query.h37
1 files changed, 21 insertions, 16 deletions
diff --git a/src/resolve/resolved-dns-query.h b/src/resolve/resolved-dns-query.h
index fcc57a0e0d..43a833a08a 100644
--- a/src/resolve/resolved-dns-query.h
+++ b/src/resolve/resolved-dns-query.h
@@ -33,14 +33,6 @@ struct DnsQueryCandidate {
struct DnsQuery {
Manager *manager;
- /* When resolving a service, we first create a TXT+SRV query, and then for the hostnames we discover
- * auxiliary A+AAAA queries. This pointer always points from the auxiliary queries back to the
- * TXT+SRV query. */
- DnsQuery *auxiliary_for;
- LIST_HEAD(DnsQuery, auxiliary_queries);
- uint8_t n_auxiliary_queries;
- int auxiliary_result;
-
/* The question, formatted in IDNA for use on classic DNS, and as UTF8 for use in LLMNR or mDNS. Note
* that even on classic DNS some labels might use UTF8 encoding. Specifically, DNS-SD service names
* (in contrast to their domain suffixes) use UTF-8 encoding even on DNS. Thus, the difference
@@ -63,8 +55,12 @@ struct DnsQuery {
uint64_t flags;
int ifindex;
- DnsTransactionState state;
- uint8_t n_cname_redirects;
+ /* When resolving a service, we first create a TXT+SRV query, and then for the hostnames we discover
+ * auxiliary A+AAAA queries. This pointer always points from the auxiliary queries back to the
+ * TXT+SRV query. */
+ int auxiliary_result;
+ DnsQuery *auxiliary_for;
+ LIST_HEAD(DnsQuery, auxiliary_queries);
LIST_HEAD(DnsQueryCandidate, candidates);
sd_event_source *timeout_event_source;
@@ -76,18 +72,26 @@ struct DnsQuery {
uint64_t answer_query_flags;
DnsProtocol answer_protocol;
int answer_family;
+ DnsPacket *answer_full_packet;
DnsSearchDomain *answer_search_domain;
+
+ DnsTransactionState state;
int answer_errno; /* if state is DNS_TRANSACTION_ERRNO */
- bool previous_redirect_unauthenticated;
- bool previous_redirect_non_confidential;
- bool previous_redirect_non_synthetic;
- DnsPacket *answer_full_packet;
+
+ unsigned block_ready;
+
+ uint8_t n_auxiliary_queries;
+ uint8_t n_cname_redirects;
+
+ bool previous_redirect_unauthenticated:1;
+ bool previous_redirect_non_confidential:1;
+ bool previous_redirect_non_synthetic:1;
+ bool request_address_valid:1;
/* Bus + Varlink client information */
sd_bus_message *bus_request;
Varlink *varlink_request;
int request_family;
- bool request_address_valid;
union in_addr_union request_address;
unsigned block_all_complete;
char *request_address_string;
@@ -102,12 +106,13 @@ struct DnsQuery {
/* Completion callback */
void (*complete)(DnsQuery* q);
- unsigned block_ready;
sd_bus_track *bus_track;
LIST_FIELDS(DnsQuery, queries);
LIST_FIELDS(DnsQuery, auxiliary_queries);
+
+ /* Note: fields should be ordered to minimize alignment gaps. Use pahole! */
};
enum {