summary refs log tree commit diff
path: root/lib/test_rhashtable.c
diff options
context:
space:
mode:
authorPhil Sutter <phil@nwl.cc>2015-11-20 18:17:17 +0100
committerDavid S. Miller <davem@davemloft.net>2015-11-23 12:36:08 -0500
commitcd5b318daf4aecd249c3f07df93700c0f749484c (patch)
tree6a75d0824547703d363cf8527afbeee1db7f4759 /lib/test_rhashtable.c
parent3d40e44361eab3dd6c969241d12dac7466eb7174 (diff)
downloadlinux-cd5b318daf4aecd249c3f07df93700c0f749484c.tar.gz
rhashtable-test: add cond_resched() to thread test
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>
Diffstat (limited to 'lib/test_rhashtable.c')
-rw-r--r--lib/test_rhashtable.c5
1 files changed, 5 insertions, 0 deletions
diff --git a/lib/test_rhashtable.c b/lib/test_rhashtable.c
index 8c1ad1ced72c..63654e359256 100644
--- a/lib/test_rhashtable.c
+++ b/lib/test_rhashtable.c
@@ -236,6 +236,8 @@ static int thread_lookup_test(struct thread_data *tdata)
 			       obj->value, key);
 			err++;
 		}
+
+		cond_resched();
 	}
 	return err;
 }
@@ -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) {
@@ -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) {