hash: fix scaling by reducing contention
authorPablo de Lara <pablo.de.lara.guarch@intel.com>
Fri, 30 Oct 2015 14:37:28 +0000 (14:37 +0000)
committerThomas Monjalon <thomas.monjalon@6wind.com>
Wed, 4 Nov 2015 00:04:10 +0000 (01:04 +0100)
commit5915699153d788c5cb3c449635eca46f1da6f2fe
treecbafcb84db40795bf6f8744d8102ca51a81cd7ad
parent9fd0052ee6102618701d4bb2faf7bc8ed1b5c97d
hash: fix scaling by reducing contention

If using multiple cores on a system with hardware transactional
memory support, thread scaling does not work, as there was a single
point in the hash library which is a bottleneck for all threads,
which is the "free_slots" ring, which stores all the indices of
the free slots in the table.

This patch fixes the problem, by creating a local cache per logical core,
which stores locally indices of free slots,
so most times, writer threads will not interfere each other.

Fixes: 48a399119619 ("hash: replace with cuckoo hash implementation")

Signed-off-by: Pablo de Lara <pablo.de.lara.guarch@intel.com>
Acked-by: Bruce Richardson <bruce.richardson@intel.com>
app/test/test_hash_scaling.c
doc/guides/rel_notes/release_2_2.rst
lib/librte_hash/rte_cuckoo_hash.c
lib/librte_hash/rte_hash.h