]> git.ipfire.org Git - thirdparty/suricata.git/commit
threads: fine grained locking for Thread
authorVictor Julien <vjulien@oisf.net>
Tue, 17 Sep 2024 09:02:00 +0000 (11:02 +0200)
committerVictor Julien <victor@inliniac.net>
Fri, 10 Jan 2025 08:16:36 +0000 (09:16 +0100)
commit276d625a66138ddf9053752c32fdad620c916ff3
tree79f9ace71b14e232924e12884ac93e2b6b5a634c
parentef396f7509ccef47afa949eb1f463a29130213b5
threads: fine grained locking for Thread

Until now many accesses to the Thread structure required taking a global
lock, leading to performance issues. In practice this only happened in
offline mode.

This patch adds a finer grained locking scheme. It assumes that the
Thread object itself cannot disappear, and adds a spinlock to protect
updates to the structure.

Additionally, the `pktts` field is made an atomic, so that it can be
read w/o taking the spinlock. Updates to it are still done under lock.
src/tm-threads.c