Thread (63 messages) 63 messages, 7 authors, 2012-12-28

Re: [PATCH 2/7] freezer: add missing mb's to freezer_count() and freezer_should_skip()

From: Oleg Nesterov <hidden>
Date: 2012-10-23 15:38:14
Also in: lkml

Hi Tejun,

On 10/22, Tejun Heo wrote:
On Mon, Oct 22, 2012 at 07:44:04PM +0200, Oleg Nesterov wrote:
quoted
We probably have another similar race. If ptrace_stop()->may_ptrace_stop()
returns false, the task does

	__set_current_state(TASK_RUNNING);
	// no mb in between
	try_to_freeze();

And this can race with task_is_stopped_or_traced() check in the same way.
(of course this is only theoretical).

do_signal_stop() is probably fine, we can rely on ->siglock.
Hmm....  Guess we should drop __ from set_current_state.
Yes.

Or we can change ptrace_stop() and do_signal_stop() to use freezer_do_not_count/
freezer_count and remove task_is_stopped_or_traced() from update_if_frozen()
and try_to_freeze_tasks(). But this means that do_signal_stop() will call
try_to_freeze() twice, unless we add __freezer_count() which only clears
PF_FREEZER_SKIP.
I wonder
whether we should just add mb to freezing()?  What do you think?
Yes, I thought about this too. I just do not know what would be better.

Oleg.
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help