Skip to content

Commit

Permalink
rhashtable-test: add cond_resched() to thread test
Browse files Browse the repository at this point in the history
This should fix for soft lockup bugs triggered on slow systems.

Signed-off-by: Phil Sutter <phil@nwl.cc>
Signed-off-by: David S. Miller <davem@davemloft.net>
  • Loading branch information
Phil Sutter authored and David S. Miller committed Nov 23, 2015
1 parent 3d40e44 commit cd5b318
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions lib/test_rhashtable.c
Original file line number Diff line number Diff line change
Expand Up @@ -236,6 +236,8 @@ static int thread_lookup_test(struct thread_data *tdata)
obj->value, key);
err++;
}

cond_resched();
}
return err;
}
Expand All @@ -251,6 +253,7 @@ static int threadfunc(void *data)

for (i = 0; i < entries; i++) {
tdata->objs[i].value = (tdata->id << 16) | i;
cond_resched();
err = rhashtable_insert_fast(&ht, &tdata->objs[i].node,
test_rht_params);
if (err == -ENOMEM || err == -EBUSY) {
Expand Down Expand Up @@ -285,6 +288,8 @@ static int threadfunc(void *data)
goto out;
}
tdata->objs[i].value = TEST_INSERT_FAIL;

cond_resched();
}
err = thread_lookup_test(tdata);
if (err) {
Expand Down

0 comments on commit cd5b318

Please sign in to comment.