Skip to content

Commit

Permalink
rhashtable: Allow other tasks to be scheduled in large lookup loops
Browse files Browse the repository at this point in the history
Depending on system speed, the large lookup/insert/delete loops of the testsuite can
take a considerable amount of time to complete causing watchdog warnings to appear.
Allow other tasks to be scheduled throughout the loops.

Reported-by: Meelis Roos <mroos@linux.ee>
Signed-off-by: Thomas Graf <tgraf@suug.ch>
Acked-by: Eric Dumazet <edumazet@google.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
  • Loading branch information
Thomas Graf authored and David S. Miller committed Jul 21, 2015
1 parent f61687c commit 685a015
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions lib/test_rhashtable.c
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@
#include <linux/rcupdate.h>
#include <linux/rhashtable.h>
#include <linux/slab.h>
#include <linux/sched.h>

#define MAX_ENTRIES 1000000
#define TEST_INSERT_FAIL INT_MAX
Expand Down Expand Up @@ -87,6 +88,8 @@ static int __init test_rht_lookup(struct rhashtable *ht)
return -EINVAL;
}
}

cond_resched_rcu();
}

return 0;
Expand Down Expand Up @@ -160,6 +163,8 @@ static s64 __init test_rhashtable(struct rhashtable *ht)
} else if (err) {
return err;
}

cond_resched();
}

if (insert_fails)
Expand All @@ -183,6 +188,8 @@ static s64 __init test_rhashtable(struct rhashtable *ht)

rhashtable_remove_fast(ht, &obj->node, test_rht_params);
}

cond_resched();
}

end = ktime_get_ns();
Expand Down

0 comments on commit 685a015

Please sign in to comment.