Re: get_online_cpus() && workqueues

Previous message: [thread] [date] [author]
Next message: [thread] [date] [author]
From: Gautham R Shenoy
Date: Monday, April 28, 2008 - 12:02 am

On Sat, Apr 26, 2008 at 06:43:30PM +0400, Oleg Nesterov wrote:

Sorry for the late reply.

Haven't looked at the patch yet, but I am okay with the idea,
since it is useful for subsystems that need the cpu_online_map
to be consistent while performing some operation and aren't really
concerned with serialization wrt entire CPU-Hotplug operation.

However, subsystems such as cpufreq require serialization with respect
to the whole CPU-Hotplug operation since they do initialization and
cleanup pre and  post the change of the cpu_online_map.
The current code, or this patch doesn't help in such cases
when such subsystems have multithreaded workqueues!

Case in point:
the ondemand governor code. If you look at the problems mentioned in the
earlier mails, we have a dependency between the cpufreq per_cpu rwsem
and the cpu_hotplug lock, as on the read-path, we aren't nesting
the rwsem with get_online_cpus(), but on the write path we are.

However, the solution is not as simple as nesting the
down_read/write(per_cpu(cpufreq_rwsem) with get_online_cpus(), since it
may deadlock with the do_dbs_timer() ondemand governor workitem code.

One of the thoughts I have is to provide an API along the lines of
try_get_online_cpus() which will return 1 if there is no CPU Hotplug
operation in progress and will return 0 otherwise. In case where
a cpu-hotplug operation is in progress, the workitem could simply
do nothing other than requeue itself and wait for the cpu-hotplug
operation to complete.

Else, we might want to do something like what slab.c does.
It sets the per-cpu work.func of the cpu-going down to NULL in
CPU_DOWN_PREPARE.

Thoughts?

--
Thanks and Regards
gautham.
--
Previous message: [thread] [date] [author]
Next message: [thread] [date] [author]

Messages in current thread:
get_online_cpus() && workqueues, Oleg Nesterov, (Sat Apr 26, 7:43 am)
Re: get_online_cpus() && workqueues, Heiko Carstens, (Sun Apr 27, 5:22 am)
Re: get_online_cpus() && workqueues, Oleg Nesterov, (Sun Apr 27, 7:25 am)
Re: get_online_cpus() && workqueues, Gautham R Shenoy, (Mon Apr 28, 12:02 am)
Re: get_online_cpus() && workqueues, Oleg Nesterov, (Mon Apr 28, 3:56 am)
Re: get_online_cpus() && workqueues, Gautham R Shenoy, (Mon Apr 28, 4:57 am)
Re: get_online_cpus() && workqueues, Gautham R Shenoy, (Mon Apr 28, 5:03 am)
Re: get_online_cpus() && workqueues, Oleg Nesterov, (Mon Apr 28, 5:40 am)