lkml.org 
[lkml]   [2013]   [Oct]   [10]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [PATCH 0/6] Optimize the cpu hotplug locking -v2
On Thu, 10 Oct 2013 11:49:15 -0700
Linus Torvalds <torvalds@linux-foundation.org> wrote:

> Oh, and I'm sure there are several users that currently depend on
> being able to sleep over get_online_cpu's. But I'm pretty sure it's
> "several", not "hundreds", and I think we could fix them up.

I'm wondering if we can have a for_each_cpu() that only disables
preemption in the loop. That is, each iteration will enable preemption,
but the loop itself will guarantee that the current cpu to process
still exists.

rcu_read_lock();
for_each_cpu(cpu, mask) {
rcu_read_unlock();
rcu_read_lock();
if (!cpu_online(cpu))
continue;
[...]
}
rcu_read_unlock();

That way expensive loops wont stop the current CPU to process all
online CPUs.

Of course, it will miss a CPU that comes online. But it would still
need to handle the case of a CPU coming online after the final
put_online_cpus(), so I'm not sure that's a problem.

-- Steve


\
 
 \ /
  Last update: 2013-10-10 21:21    [W:0.738 / U:0.016 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site