defrag: timeout/reuse start of list

pull/11227/head
Victor Julien 9 months ago committed by Victor Julien
parent 97705c94e4
commit 26a73503aa

@ -682,7 +682,7 @@ static DefragTracker *DefragTrackerGetUsedDefragTracker(void)
if (DRLOCK_TRYLOCK(hb) != 0) if (DRLOCK_TRYLOCK(hb) != 0)
continue; continue;
DefragTracker *dt = hb->tail; DefragTracker *dt = hb->head;
if (dt == NULL) { if (dt == NULL) {
DRLOCK_UNLOCK(hb); DRLOCK_UNLOCK(hb);
continue; continue;

@ -69,11 +69,11 @@ static uint32_t DefragTrackerHashRowTimeout(
do { do {
if (SCMutexTrylock(&dt->lock) != 0) { if (SCMutexTrylock(&dt->lock) != 0) {
dt = dt->hprev; dt = dt->hnext;
continue; continue;
} }
DefragTracker *next_dt = dt->hprev; DefragTracker *next_dt = dt->hnext;
/* check if the tracker is fully timed out and /* check if the tracker is fully timed out and
* ready to be discarded. */ * ready to be discarded. */
@ -131,13 +131,13 @@ uint32_t DefragTimeoutHash(SCTime_t ts)
/* defrag hash bucket is now locked */ /* defrag hash bucket is now locked */
if (hb->tail == NULL) { if (hb->head == NULL) {
DRLOCK_UNLOCK(hb); DRLOCK_UNLOCK(hb);
continue; continue;
} }
/* we have a tracker, or more than one */ /* we have a tracker, or more than one */
cnt += DefragTrackerHashRowTimeout(hb, hb->tail, ts); cnt += DefragTrackerHashRowTimeout(hb, hb->head, ts);
DRLOCK_UNLOCK(hb); DRLOCK_UNLOCK(hb);
} }

Loading…
Cancel
Save