[PATCH] rt-tests: cyclictest: try not to share the same cpu with main thread

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



The main thread will interfere with the test thread and try not to share
the same CPU with the main thread when the number of thread is less than
max_cpus.

Signed-off-by: yeyunfeng <yeyunfeng@xxxxxxxxxx>
---
 src/cyclictest/cyclictest.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/src/cyclictest/cyclictest.c b/src/cyclictest/cyclictest.c
index 989113fb3483..b3d72caa10ce 100644
--- a/src/cyclictest/cyclictest.c
+++ b/src/cyclictest/cyclictest.c
@@ -1080,7 +1080,8 @@ static int cpu_for_thread_sp(int thread_num, int max_cpus)
 		fatal("No allowable cpus to run on\n");
 	}

-	m = thread_num % num_cpus;
+	/* just don't try to share the same cpu with main thread */
+	m = (thread_num + 1) % num_cpus;

 	/* there are num_cpus bits set, we want position of m'th one */
 	for (i = 0, cpu = 0; i < max_cpus; i++) {
-- 
1.8.3.1




[Index of Archives]     [RT Stable]     [Kernel Newbies]     [IDE]     [Security]     [Git]     [Netfilter]     [Bugtraq]     [Yosemite]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux ATA RAID]     [Samba]     [Video 4 Linux]     [Device Mapper]

  Powered by Linux