Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1274293

[PATCH v2 1/4] rhashtable-test: add cond_resched() to thread test

From Phil Sutter <phil@nwl.cc>
Newsgroups linux.kernel
Subject [PATCH v2 1/4] rhashtable-test: add cond_resched() to thread test
Date 2015-11-20 18:20 +0100
Message-ID <qwXvQ-1JB-33@gated-at.bofh.it> (permalink)
References <qwXvP-1JB-15@gated-at.bofh.it>
Organization linux.* mail to news gateway

Show all headers | View raw


This should fix for soft lockup bugs triggered on slow systems.

Signed-off-by: Phil Sutter <phil@nwl.cc>
---
 lib/test_rhashtable.c | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/lib/test_rhashtable.c b/lib/test_rhashtable.c
index 8c1ad1c..63654e3 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) {
-- 
2.1.2

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Back to linux.kernel | Previous | NextPrevious in thread | Next in thread | Find similar | Unroll thread


Thread

[PATCH v2 0/4] improve fault-tolerance of rhashtable runtime-test Phil Sutter <phil@nwl.cc> - 2015-11-20 18:20 +0100
  [PATCH v2 1/4] rhashtable-test: add cond_resched() to thread test Phil Sutter <phil@nwl.cc> - 2015-11-20 18:20 +0100
  Re: [PATCH v2 0/4] improve fault-tolerance of rhashtable  runtime-test David Miller <davem@davemloft.net> - 2015-11-23 18:40 +0100
  Re: [PATCH v2 0/4] improve fault-tolerance of rhashtable runtime-test Herbert Xu <herbert@gondor.apana.org.au> - 2015-11-30 10:40 +0100
    Re: [PATCH v2 0/4] improve fault-tolerance of rhashtable runtime-test Phil Sutter <phil@nwl.cc> - 2015-11-30 11:20 +0100
      Re: [PATCH v2 0/4] improve fault-tolerance of rhashtable runtime-test Herbert Xu <herbert@gondor.apana.org.au> - 2015-11-30 11:20 +0100

csiph-web