From: Sebastian Andrzej Siewior <bigeasy@linutronix.de>
To: Ingo Molnar <mingo@kernel.org>
Cc: linux-kernel@vger.kernel.org,
Peter Zijlstra <peterz@infradead.org>,
Thomas Gleixner <tglx@linutronix.de>,
Mike Galbraith <efault@gmx.de>, Ingo Molnar <mingo@elte.hu>,
"Rafael J . Wysocki" <rjw@rjwysocki.net>
Subject: Re: [RFC PATCH] kernel: sched: Provide a pointer to the valid CPU mask
Date: Wed, 5 Apr 2017 10:37:53 +0200 [thread overview]
Message-ID: <20170405083753.7eszej2njds4ovdb@linutronix.de> (raw)
In-Reply-To: <20170405073943.GA17266@gmail.com>
On 2017-04-05 09:39:43 [+0200], Ingo Molnar wrote:
>
> So maybe we could add the following facility:
>
> ptr = sched_migrate_to_cpu_save(cpu);
>
> ...
>
> sched_migrate_to_cpu_restore(ptr);
>
> ... and use it in the cpufreq code. Then -rt could simply define migrate_disable()
> to be:
>
> ptr = sched_migrate_to_cpu_save(raw_smp_processor_id());
>
> and define migrate_enable() as:
>
> sched_migrate_to_cpu_restore(ptr);
>
> ... or such.
>
> In the cpu == current_cpu case it would be super fast - otherwise it would migrate
> over to the target CPU first. Also note that this facility is strictly a special
> case for single-CPU masks and migrations - i.e. the constant pointer cpumask
> optimization would always apply.
>
> Note that due to the use of the 'ptr' local variable the interface nests
> naturally, so this would be a legitimate use:
>
> ptr = sched_migrate_to_cpu_save(cpu);
>
> ...
> migrate_disable();
> ...
> migrate_enable();
> ...
>
> sched_migrate_to_cpu_restore(ptr);
>
> I.e. my proposal would be to essentially upstream the -rt migrate_disable()
> facility in a slightly more generic form that would fit the cpufreq usecase.
>
> I bet a number of the current driver's mucking with cpumask would also fit this
> new API.
>
> Does this make sense?
It kind of does. If you want to allow migration to different CPU then it
will might make things little complicated because we need to supported
nested migrate_disable() and we can't (must not) change the mask while
nesting.
Other than that, I am not sure the cpufreq usecase is valid.
schedule_work_on() looks better but maybe not as fast as the proposed
sched_migrate_to_cpu_save(). Also, some users look wrong:
[PATCH] CPUFREQ: Loongson2: drop set_cpus_allowed_ptr()
https://www.linux-mips.org/archives/linux-mips/2017-04/msg00042.html
and I received offlist mail pointing to the other cpufreq users. So here
I am waiting for some feedback from the cpufreq maintainer.
But I get your point. Other than super-fast switching to a specific CPU
for $reason we could replace a few preempt_disable() invocation which
are only there due to per-CPU variables. So let me hack this into -RT
and come back…
> Thanks,
>
> Ingo
Sebastian
next prev parent reply other threads:[~2017-04-05 8:38 UTC|newest]
Thread overview: 27+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-04-04 18:42 Sebastian Andrzej Siewior
2017-04-05 7:39 ` Ingo Molnar
2017-04-05 8:37 ` Sebastian Andrzej Siewior [this message]
2017-04-06 6:16 ` Ingo Molnar
2017-04-06 7:38 ` Sebastian Andrzej Siewior
2017-04-06 8:01 ` Ingo Molnar
2017-04-06 9:25 ` Sebastian Andrzej Siewior
2017-04-06 9:46 ` Peter Zijlstra
2017-04-06 10:58 ` Thomas Gleixner
2017-04-06 11:41 ` Peter Zijlstra
2017-04-06 9:35 ` Peter Zijlstra
2017-04-06 9:42 ` Peter Zijlstra
2017-04-06 10:36 ` Thomas Gleixner
2017-04-06 11:02 ` Ingo Molnar
2017-04-06 11:10 ` Thomas Gleixner
2017-04-07 7:13 ` Ingo Molnar
2017-04-06 9:34 ` Peter Zijlstra
2017-04-06 9:32 ` Peter Zijlstra
2017-04-06 9:46 ` Sebastian Andrzej Siewior
2017-04-06 10:35 ` Peter Zijlstra
2017-04-06 10:47 ` Thomas Gleixner
2017-04-06 10:57 ` Peter Zijlstra
2017-04-06 11:03 ` Thomas Gleixner
2017-04-06 11:50 ` Peter Zijlstra
2017-04-06 11:56 ` Thomas Gleixner
2017-04-06 12:31 ` Peter Zijlstra
2017-04-11 1:38 ` [lkp-robot] [kernel] c1f943ee40: kernel_BUG_at_kernel/smpboot.c kernel test robot
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=20170405083753.7eszej2njds4ovdb@linutronix.de \
--to=bigeasy@linutronix.de \
--cc=efault@gmx.de \
--cc=linux-kernel@vger.kernel.org \
--cc=mingo@elte.hu \
--cc=mingo@kernel.org \
--cc=peterz@infradead.org \
--cc=rjw@rjwysocki.net \
--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
all inboxes | Powered by JetHome®