Messages in this thread | | | Date | Fri, 7 Nov 2014 19:41:03 +0100 | From | Oleg Nesterov <> | Subject | Re: [PATCH]: kthread: Fix memory ordering in __kthread_parkme |
| |
On 11/07, Peter Zijlstra wrote: > > static void __kthread_parkme(struct kthread *self) > { > - __set_current_state(TASK_PARKED); > + set_current_state(TASK_PARKED); > while (test_bit(KTHREAD_SHOULD_PARK, &self->flags)) { > if (!test_and_set_bit(KTHREAD_IS_PARKED, &self->flags)) > complete(&self->parked); > schedule(); > - __set_current_state(TASK_PARKED); > + set_current_state(TASK_PARKED); > }
Perhaps it makses sense to do set_current_state(PARKED) once at the start of "for (;;)" loop, but this is cosmetic.
What if kthread_unpark() is called right after test_bit(KTHREAD_SHOULD_PARK) and KTHREAD_IS_PARKED is not set? It seems that __kthread_unpark() should call wake_up_state() unconditionally ?
Oleg.
| |