Re: [RFC v2 07/18] kthread: Allow to cancel kthread work
From: Petr Mladek
Date: Wed Oct 14 2015 - 06:20:32 EST
On Wed 2015-10-07 07:24:46, Tejun Heo wrote:
> At each turn, you come up with non-issues and declare that it needs to
> be full workqueue-like implementation but the issues you're raising
> seem all rather irrelevant. Can you please try to take a step back
> and put some distance from the implementation details of workqueue?
JFYI, I do a step back and am trying to convert more kthreads to
the kthread worker API. It helps me to get better insight into
the problematic.
I am still not sure where you see the difference between
workqueues and the kthread worker API. My view is that
the main differences are:
Workqueues Kthread worker
+ pool of kthreads + dedicated kthread
+ kthreads created and + kthread created and
destroyed on demand destroyed with the worker
+ can proceed more works + one work is proceed at a time
in parallel from one queue
Otherwise, similar basic set of operations would be useful:
+ create_worker
+ queue_work, queue_delayed_work
+ mod_delayed_work
+ cancel_work, cancel_delayed_work
+ flush_work
+ flush_worker
+ drain_worker
+ destroy_worker
, where queue, mod, cancel operations should work also from IRQ
context.
There are few potentially complicated and sensitive users of the
kthread workers API, e.g. handling nfs callbacks, some kthreads
used for handling network packets, eventually the rcu stuff.
Here the operations need to be secure and rather fast.
IMHO, it would be great if it is easy to convert between the
kthread worker and workqueues API. It will allow to choose
the most effective variant for a given purpose. IMHO, this is
sometimes hard to say without real life testing.
I wonder if I miss some important angle of view.
In each case, it is still not clear if the API will be acceptable
for the affected parties. Therefore I do not want to spend too
much time on perfectionalizing the API implementation at this
point. Is it OK, please?
Thanks for feedback.
Best Regards,
Petr
PS: I am not convinced that all my concerns were non-issues.
For example, I agree that a race when queuing the same work
to more kthread workers might look theoretical. On the other
hand, the API allows it and it might be hard to debug. IMHO,
it might be an acceptable trade off if the implementation is
much easier and more secure in other areas. But my draft
implementation did not suggested this.
For example, there were more situations when I needed to double
check that the work was still connected with the locked worker
after taking the lock. I know that it will not happen when
the API is used a reasonable way but...
Ah, I am back in the details. I have to stop it for now ;-)
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/