Re: [PATCH 1/3] io-wq: clean code of task state setting

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



在 2021/8/5 下午10:23, Jens Axboe 写道:
On 8/5/21 4:05 AM, Hao Xu wrote:
We don't need to set task state to TASK_INTERRUPTIBLE at the beginning
of while() in io_wqe_worker(), which causes state resetting to
TASK_RUNNING in other place. Move it to above schedule_timeout() and
remove redundant task state settings.

Not sure that is safe - the reason why the state is manipulated is to
guard from races where we do:

A				B
if (!work_available)
				Work inserted
schedule();

You are right, the patch does bring in races. Though B will then create an io-worker in that race condition, but that causes delay. Thanks Jens!
As long as setting the task runnable is part of the work being inserted,
then the above race is fine, as the schedule() turns into a no-op.





[Index of Archives]     [Linux Samsung SoC]     [Linux Rockchip SoC]     [Linux Actions SoC]     [Linux for Synopsys ARC Processors]     [Linux NFS]     [Linux NILFS]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]


  Powered by Linux