public inbox for linux-rt-users@vger.kernel.org
 help / color / mirror / Atom feed
From: Jonathan Schwender <schwenderjonathan@gmail.com>
To: John Kacur <jkacur@redhat.com>
Cc: williams@redhat.com, linux-rt-users@vger.kernel.org
Subject: Re: [PATCH v4 2/2] cyclictest: Add --mainaffinity=[CPUSET] option.
Date: Sat, 22 May 2021 09:57:48 +0200	[thread overview]
Message-ID: <ee07d8b0-756a-173c-e0de-10ebc1e8a420@gmail.com> (raw)
In-Reply-To: <db548620-e1a6-c4cb-3e48-3247865148eb@redhat.com>


Am 21.05.2021 um 22:24 schrieb John Kacur:
>
> On Tue, 18 May 2021, Jonathan Schwender wrote:
>
>> This allows the user to specify a separate cpuset for the main pid,
>> e.g. on a housekeeping CPU.
>> If --mainaffinity is not specified, but --affinity is, then the
>> current behaviour is preserved and the main thread is bound
>> to the cpuset specified by --affinity

>> @@ -1802,7 +1816,9 @@ int main(int argc, char **argv)
>>   	}
>>   
>>   	/* Restrict the main pid to the affinity specified by the user */
>> -	if (affinity_mask != NULL) {
>> +	if (main_affinity_mask != NULL) {
>> +		set_main_thread_affinity(main_affinity_mask);
> Am I missing something here, if there is a main_affinity_mask we set that
> but then skip over the affinity_mask. Don't we want to check both?

So the idea here is that if --mainaffinity is specified, then we set the 
affinity of  the main thread
to the specified value, _regardless_ of --affinity. E.g.:

cyclictest --affinity=1,2,3 --mainaffinity=0 [other options]

The intended behavior is that the main thread is bound to CPU 0, and the 
other threads to CPUs 1-3.
I don't see a reason why mainaffinity should be restricted to a subset 
of affinity. E.g., if for some reason
(e.g. cyclictest in a container) you spawn multiple cyclictest instances 
with non-overlapping affinity cpusets
but want to offload the main pids to a common CPU (e.g. CPU 0). 
Restricting mainaffinity to a subset of
affinity would mean that now every cyclictest instance also must spawn a 
measurement thread on CPU 0,
even if you aren't really interested in the latencies of the 
housekeeping CPU. Due to the (potentially) high priority of
the timer threads, they might even negatively influence isolated CPUs by 
delaying offloaded tasks.

Another way to look at it is that --mainaffinity (if present) overrides 
--affinity when determining the target affinity for the
main thread. The affinity for the measurement threads is not affected by 
this in any way.

>
>> +	} else if (affinity_mask != NULL) {
>>   		set_main_thread_affinity(affinity_mask);
>>   		if (verbose)
>>   			printf("Using %u cpus.\n",
>> -- 
>> 2.31.1
>>
>>

      reply	other threads:[~2021-05-22  7:57 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-05-18  8:37 [PATCH v4 0/2] rt-tests: cyclictest: Add option to specify main pid affinity Jonathan Schwender
2021-05-18  8:37 ` [PATCH v4 1/2] cyclictest: Move main pid setaffinity handling into a function Jonathan Schwender
2021-05-21 20:19   ` John Kacur
2021-05-22  7:35     ` Jonathan Schwender
2021-05-18  8:37 ` [PATCH v4 2/2] cyclictest: Add --mainaffinity=[CPUSET] option Jonathan Schwender
2021-05-19 15:55   ` Daniel Wagner
2021-05-22  8:13     ` Jonathan Schwender
2021-05-21 20:21   ` John Kacur
2021-05-21 20:24   ` John Kacur
2021-05-22  7:57     ` Jonathan Schwender [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=ee07d8b0-756a-173c-e0de-10ebc1e8a420@gmail.com \
    --to=schwenderjonathan@gmail.com \
    --cc=jkacur@redhat.com \
    --cc=linux-rt-users@vger.kernel.org \
    --cc=williams@redhat.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox