From: Andrew Morton <akpm@linux-foundation.org>
To: Frederic Weisbecker <fweisbec@gmail.com>
Cc: dmitry.torokhov@gmail.com, dtor@mail.ru,
linux-kernel@vger.kernel.org, mingo@elte.hu,
linux-input@vger.kernel.org,
Arjan van de Ven <arjan@linux.intel.com>
Subject: Re: [PATCH] psmouse: run kpsmoused only while needed
Date: Mon, 2 Feb 2009 23:03:35 -0800 [thread overview]
Message-ID: <20090202230335.9e31c97f.akpm@linux-foundation.org> (raw)
In-Reply-To: <20090128230837.GA7631@nowhere>
On Thu, 29 Jan 2009 00:08:39 +0100 Frederic Weisbecker <fweisbec@gmail.com> wrote:
> > > @@ -1131,7 +1155,13 @@ static void psmouse_disconnect(struct serio *serio)
> > >
> > > /* make sure we don't have a resync in progress */
> > > mutex_unlock(&psmouse_mutex);
> > > - flush_workqueue(kpsmoused_wq);
> > > +
> > > + prepare_to_wait(&psmouse->recync_pending_queue, &wait,
> > > + TASK_UNINTERRUPTIBLE);
> > > + if (atomic_read(&psmouse->nb_recync_pending))
> > > + schedule();
> > > + finish_wait(&psmouse->recync_pending_queue, &wait);
> >
> > So... we're requiring that nb_recync_pending is zero at this stage?
> >
> > I wonder if the code manages to do that. A little WARN_ON(), maybe?
> >
> > > mutex_lock(&psmouse_mutex);
> > >
> >
>
> After reading how work the async jobs (kernel/async.c), I think it would be better
> to actually use it instead of creating a thread through a workqueue and wait for a
> counter to be zero to be sure all is flushed.
>
> The async functions provide local execution and synchronisation domains through special cookies,
> which means long tasks of mouse resync will not starve other works.
>
> What do you think about it?
Yes, it would be better to use the async infrastructure.
If only to see how the code ends up looking - it _should_ be simpler/cleaner
than the open-coded implementation. If it isn't, we should ask the async code
"why not?".
next prev parent reply other threads:[~2009-02-03 7:03 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2009-01-16 0:16 [PATCH] psmouse: run kpsmoused only while needed Frederic Weisbecker
2009-01-22 20:36 ` Frédéric Weisbecker
2009-01-26 22:32 ` Andrew Morton
2009-01-27 0:34 ` Frederic Weisbecker
2009-01-28 23:08 ` Frederic Weisbecker
2009-02-03 7:03 ` Andrew Morton [this message]
2009-02-03 9:49 ` Frederic Weisbecker
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=20090202230335.9e31c97f.akpm@linux-foundation.org \
--to=akpm@linux-foundation.org \
--cc=arjan@linux.intel.com \
--cc=dmitry.torokhov@gmail.com \
--cc=dtor@mail.ru \
--cc=fweisbec@gmail.com \
--cc=linux-input@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=mingo@elte.hu \
/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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.