lkml.org 
[lkml]   [2014]   [Nov]   [7]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [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.



\
 
 \ /
  Last update: 2014-11-07 20:21    [W:0.085 / U:0.076 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site