[dpdk-dev] [PATCH] hash: fix incorrect eviction counter

Bruce Richardson bruce.richardson at intel.com
Fri Sep 22 10:35:57 CEST 2017


On Thu, Sep 21, 2017 at 01:46:46PM +0100, Pablo de Lara wrote:
> When adding a new entry in a hash table, there is
> a maximum number of evictions that can be
> performed. When the counter of these evictions reaches
> this maximum, the entry cannot be added, as it is considered
> that the algorithm has encountered an infinite loop.
> 
> The problem with the current implementation, is that this
> counter was declared as a static variable.
> If there are multiple threads adding entries in the same table
> or in different tables, they should access different counters,
> one per core and per table.
> 
> Therefore, an array of counter has been added to the
> hash table structure.
> 
> Fixes: 243e93a5046f ("hash: fix unlimited cuckoo path")
> Cc: stable at dpdk.org
> 
> Signed-off-by: Pablo de Lara <pablo.de.lara.guarch at intel.com>
> ---
Since you appear to be passing this counter through the different
function calls as parameter, and it gets reset to zero at the start, do
you even need an array. Can you not just have a non-static local
variable in the function?

/Bruce


More information about the dev mailing list