[PATCH] pi_stress: limit the number of inversion groups to the number of online cores

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

 



Each inversion group is three SCHED_FIFO threads, so the chances of more groups
than online cores actually getting to run is very slim. Limit the number of
groups requested to be <= the number of online cpus.

Signed-off-by: Clark Williams <williams@xxxxxxxxxx>
---
 src/pi_tests/pi_stress.c | 6 ++++++
 1 file changed, 6 insertions(+)

diff --git a/src/pi_tests/pi_stress.c b/src/pi_tests/pi_stress.c
index 0ed844c636cd..ce446d4ea037 100644
--- a/src/pi_tests/pi_stress.c
+++ b/src/pi_tests/pi_stress.c
@@ -1327,6 +1327,12 @@ void process_command_line(int argc, char **argv)
 			break;
 		case 'g':
 			ngroups = strtol(optarg, NULL, 10);
+			if (ngroups > num_processors) {
+				pi_error("the number of groups cannot exceed "
+					 "the number of online processors (%d)\n",
+					 num_processors);
+				exit(-1);
+			}
 			pi_info("number of groups set to %d\n", ngroups);
 			break;
 		case 'r':
-- 
2.26.2




[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