On 04/12, Robin Holt wrote:
>
> +void migrate_to_boot_cpu(void)
> +{
> +     /* The boot cpu is always logical cpu 0 */
> +     int reboot_cpu_id = 0;
> +
> +     /* Make certain the cpu I'm about to reboot on is online */
> +     if (!cpu_online(reboot_cpu_id))
> +             reboot_cpu_id = smp_processor_id();
> +
> +     /* Make certain I only run on the appropriate processor */
> +     set_cpus_allowed_ptr(current, cpumask_of(reboot_cpu_id));

This is only theoretical, but perhaps it makes sense to set
PF_THREAD_BOUND before set_cpus_allowed_ptr() ? To prevent the
race with another thread doing sched_setaffinity().

Oleg.

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Reply via email to