summaryrefslogtreecommitdiff
path: root/sys/net/art.h
diff options
context:
space:
mode:
authorDavid Gwynne <dlg@cvs.openbsd.org>2016-06-03 03:59:44 +0000
committerDavid Gwynne <dlg@cvs.openbsd.org>2016-06-03 03:59:44 +0000
commit17ce956acd2007ab48568f90011ddaa79c66d139 (patch)
treea53d69996400b812cd0bce7b49b27f0c59b8ca70 /sys/net/art.h
parent2e4f95fd3830b1fa3e421f9dea64e0389e90f837 (diff)
defer the freeing of art tables and nodes to a task.
this will allow us to sleep in srp_finalize before freeing the memory. the defer is done by putting the tables and nodes on a list which is serviced by a task. the task removes all the entries from the list and pool_puts them. the art_tables gc code uses at_parent as its list entry, and the art_node gc code uses a union with the an_dst pointer. both at_parent and an_dst are only used when theyre active as part of an art data structure, and are not used in lookups. once the art is done with them we can reuse these pointers safely. ok mpi@
Diffstat (limited to 'sys/net/art.h')
-rw-r--r--sys/net/art.h9
1 files changed, 7 insertions, 2 deletions
diff --git a/sys/net/art.h b/sys/net/art.h
index 48e172bce95..856a80bc182 100644
--- a/sys/net/art.h
+++ b/sys/net/art.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: art.h,v 1.12 2016/04/13 08:04:14 mpi Exp $ */
+/* $OpenBSD: art.h,v 1.13 2016/06/03 03:59:43 dlg Exp $ */
/*
* Copyright (c) 2015 Martin Pieuchot
@@ -44,9 +44,14 @@ struct rtentry;
*/
struct art_node {
SRPL_HEAD(, rtentry) an_rtlist; /* Route related to this node */
- struct sockaddr *an_dst; /* Destination address (key) */
+ union {
+ struct sockaddr *an__dst; /* Destination address (key) */
+ struct art_node *an__gc; /* Entry on GC list */
+ } an_pointer;
uint8_t an_plen; /* Prefix length */
};
+#define an_dst an_pointer.an__dst
+#define an_gc an_pointer.an__gc
void art_init(void);
struct art_root *art_alloc(unsigned int, unsigned int, unsigned int);