linux-input.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Tejun Heo <htejun@gmail.com>
To: Dmitry Torokhov <dmitry.torokhov@gmail.com>
Cc: Linux Input <linux-input@vger.kernel.org>
Subject: Re: [RFC] Input: serio - convert to use workqueue instead of a thread
Date: Wed, 15 Sep 2010 11:50:53 +0200	[thread overview]
Message-ID: <4C9096FD.4060708@gmail.com> (raw)
In-Reply-To: <4C9095EC.4030008@kernel.org>

On 09/15/2010 11:46 AM, Tejun Heo wrote:
> Hello,
> 
> On 09/15/2010 07:16 AM, Dmitry Torokhov wrote:
>> Instead of creating an exclusive thread to handle serio events (which
>> happen rarely), let's switch to using a workqueue. With the arrival of
>> concurrency-managed workqueue infrastructure it should reduce total
>> number of threads in the system.
>>
>> Signed-off-by: Dmitry Torokhov <dtor@mail.ru>
>> ---
>>
>> If this makes sense I have a similar patch for gameport... Hopefully
>> this will allow to get rid of kseriod, kgameportd, kpsmoused and
>> ipolldevd...
> 
> Generally looks good to me.  Just some deatils.
> 
>> +	serio_wq = alloc_workqueue("kseriod", WQ_UNBOUND, 1);
> 
> I don't think there's any need to use WQ_UNBOUND + @max_active of 1.
> The event handler seems to be handling synchornization itself and the
> there's single work item.
> 
> Also, there's no reason to use a separate workqueue at all.  Just
> schedule_work() and do cancel_work_sync() on serio_exit().  With the
> worker pool sharing, there's no latency or execution advantage to
> using a separate workqueue anymore unless you need a rescuer or want
> to have a separate flush / attribute domain (not the case here).  I'll
> soon push workqueue document upstream and also am preparing more
> helpers (alloc_ordered_workqueue() and flush_work_sync()) and
> conversions of various users for the next cycle.  Hopefully, what to
> use when will get clearer with those.

Ooh, it looks like the driver would need flushing rather than
cancelling before exiting as the handler needs to clear the allocated
event items.  I'll prep a branch which contains flush_work_sync()
later today so that you can pull and work on it.

Thank you.

-- 
tejun

      reply	other threads:[~2010-09-15  9:50 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-09-15  5:16 [RFC] Input: serio - convert to use workqueue instead of a thread Dmitry Torokhov
2010-09-15  9:46 ` Tejun Heo
2010-09-15  9:50   ` Tejun Heo [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=4C9096FD.4060708@gmail.com \
    --to=htejun@gmail.com \
    --cc=dmitry.torokhov@gmail.com \
    --cc=linux-input@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).