Messages in this thread | | | Date | Thu, 10 Oct 2013 15:04:44 -0400 | From | Steven Rostedt <> | Subject | Re: [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
| |