From: Victor Julien Date: Wed, 9 Jul 2014 06:51:29 +0000 (+0200) Subject: packet recycle: do most clean up on packet reuse X-Git-Tag: suricata-2.1beta2~177 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=ed0b75e1e9bd4b9764c60a55f256ba9881d3ea9d;p=thirdparty%2Fsuricata.git packet recycle: do most clean up on packet reuse Call PACKET_RELEASE_REFS from PacketPoolGetPacket() so that we only access the large packet structure just before actually using it. Should give better cache behaviour. --- diff --git a/src/tmqh-packetpool.c b/src/tmqh-packetpool.c index 9b84f55b45..b26d6b09d9 100644 --- a/src/tmqh-packetpool.c +++ b/src/tmqh-packetpool.c @@ -187,6 +187,7 @@ Packet *PacketPoolGetPacket(void) Packet *p = pool->head; pool->head = p->next; p->pool = pool; + PACKET_REINIT(p); return p; } @@ -202,6 +203,7 @@ Packet *PacketPoolGetPacket(void) Packet *p = pool->head; pool->head = p->next; p->pool = pool; + PACKET_REINIT(p); return p; } @@ -217,14 +219,14 @@ void PacketPoolReturnPacket(Packet *p) { PktPool *my_pool = GetThreadPacketPool(); + PACKET_RELEASE_REFS(p); + PktPool *pool = p->pool; if (pool == NULL) { free(p); return; } - PACKET_RECYCLE(p); - if (pool == my_pool) { /* Push back onto this thread's own stack, so no locking. */ p->next = my_pool->head;