Re: [PATCH v1] kthread/smpboot: Serialize kthread parking against wakeup

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On 04/26, Peter Zijlstra wrote:
>
> For the others, I think we want to do something like the below. I still
> need to look at TASK_TRACED, which I suspect is also special,

Yes, and TASK_STOPPED.

ptrace_freeze_traced() and ptrace_unfreeze_traced() should be fine, but
ptrace_stop() wants set_special_state() too, I think.

> but ptrace always hurts my brain.

mine too ;)

> +/*
> + * set_special_state() should be used for those states when the blocking task
> + * can not use the regular condition based wait-loop. In that case we must
> + * serialize against wakeups such that any possible in-flight TASK_RUNNING stores
> + * will not collide with out state change.
> + */
> +#define set_special_state(state_value)					\
> +	do {								\
> +		unsigned long flags; /* may shadow */			\
> +		raw_spin_lock_irqsave(&current->pi_lock, flags);	\
> +		current->state = (state_value);				\
> +		raw_spin_unlock_irqrestore(&current->pi_lock, flags);	\
> +	} while (0)
> +

Agreed.

I thought that perhaps we can change ttwu_do_wakeup() cmpxchg() instead of
plain p->state = TASK_RUNNING, but this helper looks much more clear and simple.

Oleg.

--
To unsubscribe from this list: send the line "unsubscribe linux-arm-msm" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html



[Index of Archives]     [Linux ARM Kernel]     [Linux ARM]     [Linux Omap]     [Fedora ARM]     [Linux for Sparc]     [IETF Annouce]     [Security]     [Bugtraq]     [Linux MIPS]     [ECOS]     [Asterisk Internet PBX]     [Linux API]

  Powered by Linux