From: Peter Zijlstra <peterz@infradead.org>
To: Ingo Molnar <mingo@kernel.org>
Cc: Mike Galbraith <efault@gmx.de>, Ingo Molnar <mingo@elte.hu>,
Thomas Gleixner <tglx@linutronix.de>,
Sebastian Andrzej Siewior <bigeasy@linutronix.de>,
LKML <linux-kernel@vger.kernel.org>
Subject: Re: tip: demise of tsk_cpus_allowed() and tsk_nr_cpus_allowed()
Date: Mon, 6 Feb 2017 14:32:42 +0100 [thread overview]
Message-ID: <20170206133242.GK6515@twins.programming.kicks-ass.net> (raw)
In-Reply-To: <20170206122928.GB9404@gmail.com>
On Mon, Feb 06, 2017 at 01:29:28PM +0100, Ingo Molnar wrote:
> > +/* Future-safe accessor for struct task_struct's cpus_allowed. */
> > +static inline const struct cpumask *tsk_cpus_allowed(struct task_struct *p)
> > +{
> > + if (__migrate_disabled(p))
> > + return cpumask_of(task_cpu(p));
> > +
> > + return &p->cpus_allowed;
> > +}
> > +
> > +static inline int tsk_nr_cpus_allowed(struct task_struct *p)
> > +{
> > + if (__migrate_disabled(p))
> > + return 1;
> > + return p->nr_cpus_allowed;
> > +}
>
> So ... I think the cleaner approach in -rt would be to introduce
> ->cpus_allowed_saved, and when disabling/enabling migration then saving the
> current mask there and changing ->cpus_allowed - and then restoring it when
> re-enabling migration.
>
> This means ->cpus_allowed could be used by the scheduler directly, no wrappery
> would be required, AFAICS.
>
> ( Some extra care would be required in places that change ->cpus_allowed because
> they'd now have to be aware of ->cpus_allowed_saved. )
>
> Am I missing something?
cpumasks are a pain, the above avoids allocating more of them.
next prev parent reply other threads:[~2017-02-06 13:32 UTC|newest]
Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-02-06 4:23 Mike Galbraith
2017-02-06 10:31 ` Ingo Molnar
2017-02-06 12:18 ` Mike Galbraith
2017-02-06 12:29 ` Ingo Molnar
2017-02-06 12:47 ` Mike Galbraith
2017-02-06 13:32 ` Peter Zijlstra [this message]
2017-02-06 22:23 ` Ingo Molnar
2017-02-08 10:20 ` Thomas Gleixner
2017-02-08 11:40 ` Peter Zijlstra
2017-02-09 6:45 ` Ingo Molnar
2017-02-09 6:57 ` Ingo Molnar
2017-02-09 8:51 ` Peter Zijlstra
2017-02-09 8:59 ` Thomas Gleixner
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=20170206133242.GK6515@twins.programming.kicks-ass.net \
--to=peterz@infradead.org \
--cc=bigeasy@linutronix.de \
--cc=efault@gmx.de \
--cc=linux-kernel@vger.kernel.org \
--cc=mingo@elte.hu \
--cc=mingo@kernel.org \
--cc=tglx@linutronix.de \
/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
Powered by JetHome