rhashtable: accept GFP flags in rhashtable_walk_init
In certain cases, the 802.11 mesh pathtable code wants to iterate over all of the entries in the forwarding table from the receive path, which is inside an RCU read-side critical section. Enable walks inside atomic sections by allowing GFP_ATOMIC allocations for the walker state. Change all existing callsites to pass in GFP_KERNEL. Acked-by: Thomas Graf <tgraf@suug.ch> Signed-off-by: Bob Copeland <me@bobcopeland.com> [also adjust gfs2/glock.c and rhashtable tests] Signed-off-by: Johannes Berg <johannes.berg@intel.com>
This commit is contained in:
committed by
Johannes Berg
parent
947c2a0ecc
commit
8f6fd83c6c
@ -487,6 +487,7 @@ EXPORT_SYMBOL_GPL(rhashtable_insert_slow);
|
||||
* rhashtable_walk_init - Initialise an iterator
|
||||
* @ht: Table to walk over
|
||||
* @iter: Hash table Iterator
|
||||
* @gfp: GFP flags for allocations
|
||||
*
|
||||
* This function prepares a hash table walk.
|
||||
*
|
||||
@ -504,14 +505,15 @@ EXPORT_SYMBOL_GPL(rhashtable_insert_slow);
|
||||
* You must call rhashtable_walk_exit if this function returns
|
||||
* successfully.
|
||||
*/
|
||||
int rhashtable_walk_init(struct rhashtable *ht, struct rhashtable_iter *iter)
|
||||
int rhashtable_walk_init(struct rhashtable *ht, struct rhashtable_iter *iter,
|
||||
gfp_t gfp)
|
||||
{
|
||||
iter->ht = ht;
|
||||
iter->p = NULL;
|
||||
iter->slot = 0;
|
||||
iter->skip = 0;
|
||||
|
||||
iter->walker = kmalloc(sizeof(*iter->walker), GFP_KERNEL);
|
||||
iter->walker = kmalloc(sizeof(*iter->walker), gfp);
|
||||
if (!iter->walker)
|
||||
return -ENOMEM;
|
||||
|
||||
|
Reference in New Issue
Block a user