On 07/28/2017 12:02 AM, Mathieu Desnoyers wrote:
----- On Jul 27, 2017, at 4:58 PM, Mathieu Desnoyers 
[email protected] wrote:

----- On Jul 27, 2017, at 4:37 PM, Paul E. McKenney [email protected]
wrote:

On Thu, Jul 27, 2017 at 11:04:13PM +0300, Avi Kivity wrote:
[...]
+
+       this_cpu = raw_smp_processor_id();
+       for_each_online_cpu(cpu) {
+               struct task_struct *p;
+
+               if (cpu == this_cpu)
+                       continue;
+               rcu_read_lock();
+               p = task_rcu_dereference(&cpu_rq(cpu)->curr);
+               if (p && p->mm == current->mm)
+                       __cpumask_set_cpu(cpu, tmpmask);
This gets you some false positives, if the CPU idled then mm will
not have changed.
Good point!  The battery-powered embedded guys would probably prefer
we not needlessly IPI idle CPUs.  We cannot rely on RCU's dyntick-idle
state in nohz_full cases.  Not sure if is_idle_task() can be used
safely, given things like play_idle().
Would changing the check in this loop to:

if (p && !is_idle_task(p) && p->mm == current->mm) {

work for you ?
Avi, is there an optimization that allows current->mm to be non-null
when the idle task is scheduled that I am missing ?

I would have expected current->mm to be always NULL for idle
tasks.



I remembered that current->mm does not change when switching to a kernel task, but my Kernlish is very rusty, or maybe it has changed.

Reply via email to