workqueues - how to use them correctly
Roshan A
roshan.len at gmail.com
Wed Feb 11 14:55:35 EST 2015
Thanks Arun for the link. This clears up things for me.
On Wed, Feb 11, 2015 at 3:28 AM, Arun KS <getarunks at gmail.com> wrote:
> Hello Roshan,
>
> On Tue, Feb 10, 2015 at 2:20 PM, 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.
>>
>> is this particular scenario considered bad or discouraged ?
>
> This should not happen if you are using the same work item.
> All workqueues are now non-reentrant - any work item is guaranteed to
> be executed by at most one worker system-wide at any given time.
>
> https://git.kernel.org/cgit/linux/kernel/git/torvalds/linux.git/commit/kernel/workqueue.c?id=dbf2576e37da0fcc7aacbfbb9fd5d3de7888a3c1
>
> Thanks,
> Arun
>>
>>
>> Thank you,
>> -Roshan
>>
>> _______________________________________________
>> Kernelnewbies mailing list
>> Kernelnewbies at kernelnewbies.org
>> http://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies
More information about the Kernelnewbies
mailing list