Re: [PATCH] workqueue: Drop the NOT_RUNNING check to flags in worker_{set,clr}_flags

From: Tejun Heo
Date: Thu Mar 23 2023 - 21:58:33 EST


On Mon, Mar 20, 2023 at 05:26:52PM +0800, Yue Hu wrote:
> From: Yue Hu <huyue2@xxxxxxxxxxx>
>
> We know whether the worker flags are belong to WORKER_NOT_RUNNING or not
> when we are setting and clearing them. So check the flags not running
> related is unnecessary for both the cases.
>
> Currently, worker_{set,clr}_flags() are all used for WORKER_NOT_RUNNING
> except for clearing WORKER_IDLE. Let's change to directly clear it
> instead. Also, update the comment a little in worker_clr_flags().

I'm not sure this is better. Semantically, the existing code seems clearer
and less error-prone to me and this isn't gonna make any meaningful perf
difference. Lai, what do you think?

Thanks.

--
tejun