Hello,
On 05/31/2010 04:39 PM, Oleg Nesterov wrote:
Yeap, I think so too. In vhost's case tho, as it exports a lot of
workqueue characteristics to vhost users, it's a bit more complex than
I wish it were. It can probably be simplified more if someone who
knows the code better takes a look or maybe we need to make this kind
of things easier by providing a generic helpers if more cases like
this spring up, but if that happens probably the RTTD would be somehow
teaching workqueue how to deal with cgroups. As this is the first
case, I guess open coding is okay for now.
Heh... right, I was looking at __wait_event() and thinking "ooh... we
can skip lock in the fast path". :-)
I might have slightly over engineered this part not knowing the
expected workload. ->queue_seq/->done_seq pair is to guarantee that
flushers never get starved. Without sequencing queueings and
executions, flushers should wait for !pending && !active which can
take some time to come if the poll in question is very busy.
So that either kthread_stop()'s should_stop = 1 in kthread_stop() is
visible to kthread_should_stop() or task state is set to RUNNING.
But then kthread_stop() can happen between kthread_should_stop() and
__set_current_state(TASK_INTERRUPTIBLE) and poller can just sleep in
schedule() not knowing that.
Thank you.
--
tejun
--