提交 111fbc68 编写于 作者: F Fabian Frederick 提交者: Benjamin Herrenschmidt

powerpc/pmac: replace current->state by set_current_state()

Use helper functions to access current->state.
Direct assignments are prone to races and therefore buggy.

current->state = TASK_RUNNING can be replaced by __set_current_state()

Thanks to Peter Zijlstra for the exact definition of the problem.
Suggested-By: NPeter Zijlstra <peterz@infradead.org>
Signed-off-by: NFabian Frederick <fabf@skynet.be>
Signed-off-by: NBenjamin Herrenschmidt <benh@kernel.crashing.org>
上级 1f8c82ab
......@@ -2112,7 +2112,7 @@ pmu_read(struct file *file, char __user *buf,
spin_lock_irqsave(&pp->lock, flags);
add_wait_queue(&pp->wait, &wait);
current->state = TASK_INTERRUPTIBLE;
set_current_state(TASK_INTERRUPTIBLE);
for (;;) {
ret = -EAGAIN;
......@@ -2141,7 +2141,7 @@ pmu_read(struct file *file, char __user *buf,
schedule();
spin_lock_irqsave(&pp->lock, flags);
}
current->state = TASK_RUNNING;
__set_current_state(TASK_RUNNING);
remove_wait_queue(&pp->wait, &wait);
spin_unlock_irqrestore(&pp->lock, flags);
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册