public inbox for linux-rt-users@vger.kernel.org
 help / color / mirror / Atom feed
From: Marcelo Tosatti <mtosatti@redhat.com>
To: Sebastian Andrzej Siewior <bigeasy@linutronix.de>
Cc: linux-rt-users@vger.kernel.org, John Kacur <jkacur@redhat.com>
Subject: Re: [PATCH] rt-numa: optionally ignore runtime cpumask
Date: Mon, 24 Jan 2022 14:50:39 -0300	[thread overview]
Message-ID: <Ye7m71SHlJ+ZdJeQ@fuller.cnet> (raw)
In-Reply-To: <Ye7c2cWSNJvdegmq@linutronix.de>

On Mon, Jan 24, 2022 at 06:07:37PM +0100, Sebastian Andrzej Siewior wrote:
> On 2022-01-24 13:40:49 [-0300], Marcelo Tosatti wrote:
> > > Uses the $CPU (mask) specified. If $CPU is not part of the current CPU
> > > mask, why shouldn't it work?
> > 
> >        -a, --affinity[=PROC-SET]
> >               Run threads on the set of processors given by PROC-SET.  If PROC-SET is not specified, all processors will be used.  Threads will be assigned to processors
> >               in the set in numeric order, in a round-robin fashion.
> >               The set of processors can be specified as A,B,C, or A-C, or A-B,D-F, and so on*.  The ! character can be used to negate a set.  For example, !B-D means to
> >               use all available CPUs except B through D.  The cpu numbers are the same as shown in the processor field in /proc/cpuinfo.  See numa(3) for more
> >               information on specifying CPU sets.  * Support for CPU sets requires libnuma version >= 2.  For libnuma v1, PROC-SET, if specified, must be a single CPU
> >               number.
> > 
> > 
> > /*
> >  * After this function is called, affinity_mask is the intersection of
> >  * the user supplied affinity mask and the affinity mask from the run
> >  * time environment
> >  */
> > static void use_current_cpuset(int max_cpus, struct bitmask *cpumask)
> > {
> >         struct bitmask *curmask;
> >         int i;
> > 
> >         curmask = numa_allocate_cpumask();
> >         numa_sched_getaffinity(getpid(), curmask);
> > 
> >         /*
> >          * Clear bits that are not set in both the cpuset from the
> >          * environment, and in the user specified affinity.
> >          */
> >         for (i = 0; i < max_cpus; i++) {
> >                 if ((!numa_bitmask_isbitset(cpumask, i)) ||
> >                     (!numa_bitmask_isbitset(curmask, i)))
> >                         numa_bitmask_clearbit(cpumask, i);
> >         }
> > 
> >         numa_bitmask_free(curmask);
> > }
> > 
> > Consider 8 CPU system booted with isolcpus=3-7, and execution of 
> > "cyclictest -a 3-7".
> > 
> > sched_getaffinity() returns mask with bits set for CPUs 0 and 1.
> > The user supplied mask has bits 3-7 set.
> > 
> > The intersection between the user supplied mask and the affinity mask
> > from the run time environment has no bits set.
> 
> Okay. But does this make to keep? I understand that the current CPU-mask
> needs to be kept for masks like !B or !B-D. But is there a need to use
> the current CPU-mask when a specific mask has been specified by the user?

Ok, then:

1) If user specifies -a CPULIST, ignore sched_getaffinity().

2) If user specifies -a, or -a !CPULIST, use sched_getaffinity().

Will send a patch.


  reply	other threads:[~2022-01-24 17:51 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-01-21 14:16 [PATCH] rt-numa: optionally ignore runtime cpumask Marcelo Tosatti
2022-01-21 18:16 ` Sebastian Andrzej Siewior
2022-01-24 12:58   ` Marcelo Tosatti
2022-01-24 16:26     ` Sebastian Andrzej Siewior
2022-01-24 16:40       ` Marcelo Tosatti
2022-01-24 16:44         ` Marcelo Tosatti
2022-01-24 17:07         ` Sebastian Andrzej Siewior
2022-01-24 17:50           ` Marcelo Tosatti [this message]
2022-01-25 18:40 ` [PATCH] rt-numa: ignore runtime cpumask if -a CPULIST is specified Marcelo Tosatti
2022-01-25 18:46   ` [PATCH v2] " Marcelo Tosatti
2022-01-26  7:21     ` Sebastian Andrzej Siewior
2022-01-28 17:44     ` John Kacur
2022-01-28 18:17       ` Sebastian Andrzej Siewior
2022-01-28 21:08         ` John Kacur
2022-01-28 18:39       ` [PATCH v3] " Marcelo Tosatti
2022-01-28 21:11         ` John Kacur

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=Ye7m71SHlJ+ZdJeQ@fuller.cnet \
    --to=mtosatti@redhat.com \
    --cc=bigeasy@linutronix.de \
    --cc=jkacur@redhat.com \
    --cc=linux-rt-users@vger.kernel.org \
    /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