From: Sergei Shtylyov <sergei.shtylyov@gmail.com>
To: Davidlohr Bueso <dave@stgolabs.net>, jacmet@sunsite.dk
Cc: gregkh@linuxfoundation.org, linux-usb@vger.kernel.org,
linux-kernel@vger.kernel.org, Davidlohr Bueso <dbueso@suse.de>
Subject: Re: [PATCH] usb/c67x00: Replace tasklet with work
Date: Mon, 11 Jan 2021 11:37:47 +0300 [thread overview]
Message-ID: <87dfaf4f-8a53-2840-c68c-fe10de1408e8@gmail.com> (raw)
In-Reply-To: <20210111044050.86763-1-dave@stgolabs.net>
Hello!
On 11.01.2021 7:40, Davidlohr Bueso wrote:
> Tasklets have long been deprecated as being too heavy on the system
> by running in irq context - and this is not a performance critical
> path. If a higher priority process wants to run, it must wait for
> the tasklet to finish before doing so.
>
> c67x00_do_work() will now run in process context and have further
> concurrency (tasklets being serialized among themselves), but this
> is done holding the c67x00->lock, so it should be fine. Furthermore,
> this patch fixes the usage of the lock in the callback as otherwise
> it would need to be irq-safe.
>
> Signed-off-by: Davidlohr Bueso <dbueso@suse.de>
[...]
> diff --git a/drivers/usb/c67x00/c67x00-sched.c b/drivers/usb/c67x00/c67x00-sched.c
> index e65f1a0ae80b..af60f4fdd340 100644
> --- a/drivers/usb/c67x00/c67x00-sched.c
> +++ b/drivers/usb/c67x00/c67x00-sched.c
> @@ -1123,24 +1123,26 @@ static void c67x00_do_work(struct c67x00_hcd *c67x00)
>
> /* -------------------------------------------------------------------------- */
>
> -static void c67x00_sched_tasklet(struct tasklet_struct *t)
> +static void c67x00_sched_work(struct work_struct *work)
> {
> - struct c67x00_hcd *c67x00 = from_tasklet(c67x00, t, tasklet);
> + struct c67x00_hcd *c67x00;
> +
> + c67x00 = container_of(work, struct c67x00_hcd, work);
> c67x00_do_work(c67x00);
> }
>
> void c67x00_sched_kick(struct c67x00_hcd *c67x00)
> {
> - tasklet_hi_schedule(&c67x00->tasklet);
> + queue_work(system_highpri_wq, &c67x00->work);
Use a tab to indent, please.
> }
>
> int c67x00_sched_start_scheduler(struct c67x00_hcd *c67x00)
> {
> - tasklet_setup(&c67x00->tasklet, c67x00_sched_tasklet);
> + INIT_WORK(&c67x00->work, c67x00_sched_work);
Here as well.
> return 0;
> }
>
> void c67x00_sched_stop_scheduler(struct c67x00_hcd *c67x00)
> {
> - tasklet_kill(&c67x00->tasklet);
> + cancel_work_sync(&c67x00->work);
And here.
[...]
MBR, Sergei
next prev parent reply other threads:[~2021-01-11 8:38 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-01-11 4:40 Davidlohr Bueso
2021-01-11 8:37 ` Sergei Shtylyov [this message]
[not found] ` <20210111090533.1450-1-hdanton@sina.com>
2021-01-11 19:22 ` Davidlohr Bueso
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=87dfaf4f-8a53-2840-c68c-fe10de1408e8@gmail.com \
--to=sergei.shtylyov@gmail.com \
--cc=dave@stgolabs.net \
--cc=dbueso@suse.de \
--cc=gregkh@linuxfoundation.org \
--cc=jacmet@sunsite.dk \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-usb@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
all inboxes | Powered by JetHome®