Skip to content

Commit

Permalink
hash: fix doc about thread/process safety
Browse files Browse the repository at this point in the history
[ upstream commit c96b55d ]

rte_hash_hash is multi-thread safe but not multi-process safe
because of the use of function pointers. Previous document
and comment says the other way around. This commit fixes
the issue.

Fixes: fc1f275 ("doc: programmers guide")
Fixes: 48a3991 ("hash: replace with cuckoo hash implementation")

Reported-by: Andrey Nikolaev <gentoorion@gmail.com>
Suggested-by: Pablo de Lara <pablo.de.lara.guarch@intel.com>
Signed-off-by: Yipeng Wang <yipeng1.wang@intel.com>
Acked-by: Dharmik Thakkar <dharmik.thakkar@arm.com>
Acked-by: John McNamara <john.mcnamara@intel.com>
  • Loading branch information
yipengwa authored and kevintraynor committed May 8, 2019
1 parent ca4728b commit f26ab68
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion doc/guides/prog_guide/multi_proc_support.rst
Original file line number Diff line number Diff line change
Expand Up @@ -176,7 +176,7 @@ Some of these are documented below:

* The use of function pointers between multiple processes running based of different compiled binaries is not supported,
since the location of a given function in one process may be different to its location in a second.
This prevents the librte_hash library from behaving properly as in a multi-threaded instance,
This prevents the librte_hash library from behaving properly as in a multi-process instance,
since it uses a pointer to the hash function internally.

To work around this issue, it is recommended that multi-process applications perform the hash calculations by directly calling
Expand Down
2 changes: 1 addition & 1 deletion lib/librte_hash/rte_hash.h
Original file line number Diff line number Diff line change
Expand Up @@ -463,7 +463,7 @@ rte_hash_lookup_with_hash(const struct rte_hash *h,

/**
* Calc a hash value by key.
* This operation is not multi-thread safe.
* This operation is not multi-process safe.
*
* @param h
* Hash table to look in.
Expand Down

0 comments on commit f26ab68

Please sign in to comment.