workqueues - how to use them correctly
Pranay Srivastava
pranjas at gmail.com
Tue Feb 10 05:15:55 EST 2015
On Tue, Feb 10, 2015 at 1:50 AM, Roshan A <roshan.len at gmail.com> wrote:
> hi all,
>
> My question is regarding the correct use of workqueues. I have a
> driver which queues a work item in the interrupt handler. The bottom
> half function ( the workitem -function ) does have proper locking (
> mutex ) in place for atomicity.
>
> With this setup, since the interrupts are enabled, it's possible to
> have a scenario where, when one workitem is being executed, another
> can be queued up, which results in the workitems being executed in
> parallel, however since there is a mutex, one thread will sleep.
>
You gain when most work items execute without contention. So perhaps
you can redesign that your work handlers would execute most of the
time without needing to lock.
Perhaps you can send data to handler func exclusively from top-half.
If you've anything global to maintain see if you can minimize the
contention code.
> is this particular scenario considered bad or discouraged ?
>
> Thank you,
> -Roshan
>
> _______________________________________________
> Kernelnewbies mailing list
> Kernelnewbies at kernelnewbies.org
> http://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies
--
---P.K.S
More information about the Kernelnewbies
mailing list