Re: Fw: Re: [mm PATCH 4/6] RCU: (now) CPU hotplug

From: Gautham R Shenoy
Date: Tue Jan 30 2007 - 09:02:51 EST


On Mon, Jan 29, 2007 at 06:45:49PM -0800, Paul E. McKenney wrote:
>
> static int _cpu_down(unsigned int cpu)
> {
> int err;
> struct task_struct *p;
> cpumask_t old_allowed, tmp;
>
> if (num_online_cpus() == 1)
> return -EBUSY;
>
> if (!cpu_online(cpu))
> return -EINVAL;
>
> if (freeze_processes()) {
> err = -EBUSY;
> goto out_freeze_notify_failed;
> }
> err = raw_notifier_call_chain(&cpu_chain, CPU_DOWN_PREPARE,
> (void *)(long)cpu);
> if (err == NOTIFY_BAD) {
> printk("%s: attempt to take down CPU %u failed\n",
> __FUNCTION__, cpu);
> err = -EINVAL;
> goto out_freeze_notify_failed;
> }
>
> /* Ensure that we are not runnable on dying cpu */
> old_allowed = current->cpus_allowed;
> tmp = CPU_MASK_ALL;
> cpu_clear(cpu, tmp);
> set_cpus_allowed(current, tmp);
>
> mutex_lock(&cpu_bitmask_lock);

We won't be needing this lock either, since it forms the core of
the unpopular lock_cpu_hotplug :-)

> p = __stop_machine_run(take_cpu_down, NULL, cpu);
> mutex_unlock(&cpu_bitmask_lock);

Looks good.

I'm wondering if we'll need to try_to_freeze in the fork and exit code
as well :?

Thanks and Regards
gautham.
--
Gautham R Shenoy
Linux Technology Center
IBM India.
"Freedom comes with a price tag of responsibility, which is still a bargain,
because Freedom is priceless!"
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/