[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20180426085719.GW4129@hirez.programming.kicks-ass.net>
Date: Thu, 26 Apr 2018 10:57:19 +0200
From: Peter Zijlstra <peterz@...radead.org>
To: Gaurav Kohli <gkohli@...eaurora.org>
Cc: tglx@...utronix.de, mpe@...erman.id.au, mingo@...nel.org,
bigeasy@...utronix.de, linux-kernel@...r.kernel.org,
linux-arm-msm@...r.kernel.org,
Neeraj Upadhyay <neeraju@...eaurora.org>,
Will Deacon <will.deacon@....com>,
Oleg Nesterov <oleg@...hat.com>
Subject: Re: [PATCH v1] kthread/smpboot: Serialize kthread parking against
wakeup
On Thu, Apr 26, 2018 at 10:41:31AM +0200, Peter Zijlstra wrote:
> diff --git a/kernel/kthread.c b/kernel/kthread.c
> index cd50e99202b0..4b6503c6a029 100644
> --- a/kernel/kthread.c
> +++ b/kernel/kthread.c
> @@ -177,12 +177,13 @@ void *kthread_probe_data(struct task_struct *task)
>
> static void __kthread_parkme(struct kthread *self)
> {
> - __set_current_state(TASK_PARKED);
> - while (test_bit(KTHREAD_SHOULD_PARK, &self->flags)) {
> + for (;;) {
> + __set_task_state(TASK_PARKED);
set_current_state(TASK_PARKED);
of course..
> + if (!test_bit(KTHREAD_SHOULD_PARK, &self->flags))
> + break;
> if (!test_and_set_bit(KTHREAD_IS_PARKED, &self->flags))
> complete(&self->parked);
> schedule();
> - __set_current_state(TASK_PARKED);
> }
> clear_bit(KTHREAD_IS_PARKED, &self->flags);
> __set_current_state(TASK_RUNNING);
>
Powered by blists - more mailing lists