vlib: queue_hi_thresh fix to avoid deadlock 00/28400/1
authorElias Rudberg <elias.rudberg@bahnhof.net>
Thu, 16 Apr 2020 14:01:52 +0000 (16:01 +0200)
committerAndrew Yourtchenko <ayourtch@gmail.com>
Thu, 13 Aug 2020 17:20:47 +0000 (17:20 +0000)
commit99c6344d75ef002d9288d9c8d485fb961aee4de9
treefb8e264bc0022c782b072988cb16d6d4544ad2be
parent2bd7f560c6377b3e48e69cfddd0c5b22abb9acd4
vlib: queue_hi_thresh fix to avoid deadlock

Adapt queue_hi_thresh value using num_threads to avoid risk of deadlock
between threads which could happen for example when different NAT
threads try to handoff work to each other at the same time when their
frame queues are congested. This change ensures that each thread can
reserve a queue entry without causing problems even in the most extreme
case when all threads attempt to add to the same queue simultaneously
when the queue is nearly full.

Type: fix

Signed-off-by: Elias Rudberg <elias.rudberg@bahnhof.net>
Change-Id: I9e02f753bd00833d8dd500d181b0d4f9a454d703
(cherry picked from commit 368104d06ad6d667a8cce152426916fc654b6627)
src/vlib/threads.c