diff mbox series

[rt-tests,v4,02/16] cyclictest: Mimic --smp behavior with --affinity

Message ID 20210210133450.6991-3-dwagner@suse.de
State New
Headers show
Series rt-numa.h cleanups | expand

Commit Message

Daniel Wagner Feb. 10, 2021, 1:34 p.m. UTC
Let --affinity without an argument behave in the same way as
--smp. Run a thread on each CPU. This makes cyclictest behave as the
rest of the rt-tests when --affinity is used.

Signed-off-by: Daniel Wagner <dwagner@suse.de>
---
 src/cyclictest/cyclictest.c | 2 ++
 1 file changed, 2 insertions(+)

Comments

John Kacur Feb. 17, 2021, 3:49 a.m. UTC | #1
On Wed, 10 Feb 2021, Daniel Wagner wrote:

> Let --affinity without an argument behave in the same way as

> --smp. Run a thread on each CPU. This makes cyclictest behave as the

> rest of the rt-tests when --affinity is used.

> 

> Signed-off-by: Daniel Wagner <dwagner@suse.de>

> ---

>  src/cyclictest/cyclictest.c | 2 ++

>  1 file changed, 2 insertions(+)

> 

> diff --git a/src/cyclictest/cyclictest.c b/src/cyclictest/cyclictest.c

> index 6009ff2a83bc..4c02f067fbad 100644

> --- a/src/cyclictest/cyclictest.c

> +++ b/src/cyclictest/cyclictest.c

> @@ -1019,6 +1019,8 @@ static void process_options(int argc, char *argv[], int max_cpus)

>  				    argv[optind][0] == '0' ||

>  				    argv[optind][0] == '!')) {

>  				parse_cpumask(argv[optind], max_cpus, &affinity_mask);

> +			} else {

> +				num_threads = -1;

>  			}

>  			break;

>  		case 'A':

> -- 

> 2.30.0

> 

> 


This doesn't look right. num_threads = -1 will get the number of cpus 
after parsing, so that's okay, it should imply use all available cpus,
and also the priorities of all threads are the same.

As I've explained though, I'm not ready to drop the possibility to compile
without numa, and then we need to think what this implies to the smp 
option. I do like the way you are simplifying things here, we maybe able
to drop smp altogether in the future, or have it just an option that keeps 
the priorities the same.

Need to look at it more, not applying right now. I want to get the JSON 
code applied, this stuff is holding it up.
diff mbox series

Patch

diff --git a/src/cyclictest/cyclictest.c b/src/cyclictest/cyclictest.c
index 6009ff2a83bc..4c02f067fbad 100644
--- a/src/cyclictest/cyclictest.c
+++ b/src/cyclictest/cyclictest.c
@@ -1019,6 +1019,8 @@  static void process_options(int argc, char *argv[], int max_cpus)
 				    argv[optind][0] == '0' ||
 				    argv[optind][0] == '!')) {
 				parse_cpumask(argv[optind], max_cpus, &affinity_mask);
+			} else {
+				num_threads = -1;
 			}
 			break;
 		case 'A':