[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <CAFLxGvy-RRksDvPcB6z8GQUoMFZ_NRGxk9aM2FuTZ22UWU6Knw@mail.gmail.com>
Date: Fri, 7 Aug 2020 21:29:43 +0200
From: Richard Weinberger <richard.weinberger@...il.com>
To: Zhihao Cheng <chengzhihao1@...wei.com>
Cc: linux-mtd@...ts.infradead.org, LKML <linux-kernel@...r.kernel.org>,
Richard Weinberger <richard@....at>,
"zhangyi (F)" <yi.zhang@...wei.com>
Subject: Re: [PATCH] ubi: check kthread_should_stop() after the setting of
task state
On Fri, Aug 7, 2020 at 4:18 AM Zhihao Cheng <chengzhihao1@...wei.com> wrote:
> That's where we hold different views. I have 3 viewpoints(You can point
> out which one you disagree.):
>
> 1. If kthread_stop() happens at line 12, ubi thread is *marked* with
> stop flag, it will stop at kthread_should_stop() as long as it can reach
> the next iteration.
>
> 2. If task A is on runqueue and its state is TASK_RUNNING, task A will
> be scheduled to execute.
>
> 3. If kthread_stop() happens at line 12, after program counter going to
> line 14, ubi thead is on runqueue and its state is TASK_RUNNING. I have
> explained this in situation 1 in last session.
>
>
> I mean ubi thread is on runqueue with TASK_RUNNING state & stop flag
> after the process you described.
>
> Line 12 kthread_stop()
>
> set_bit(mark stop flag) && wake_up_process(enqueue &&
> set TASK_RUNNING ) => TASK_RUNNING & stop flag & on runqueue
>
> Line 13 schedule()
>
> Do nothing but pick next task to execute
You are perfectly right! I failed to concentrate on the state changes.
Now all makes sense, also your comment before the if statement.
So I don't know how to make this more clear in the code.
Maybe it's just me being dense and in need for a vacation. ;-)
--
Thanks,
//richard
Powered by blists - more mailing lists