Re: workqueues - how to use them correctly

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Tue, Feb 10, 2015 at 9:24 AM, Anish Kumar
<anish198519851985@xxxxxxxxx> wrote:
>
>
>
>
>> On Feb 10, 2015, at 12:50 AM, Roshan A <roshan.len@xxxxxxxxx> 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.
>
> Post the code snippet and why are you using
> Mutex? If you want to synchronize between
> Interrupt handler and workqueue then you should
> use spinlocks.

To clarify : the critical section is in the workitem-function. There
is no sharing between the interrupt handler and the bottom half.


>>
>> 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.
>
> And precisely the reason not to use mutex locks.
>>
>> is this particular scenario considered bad or discouraged ?
>
> Now what do you think?
>>
>> Thank you,
>> -Roshan
>>
>> _______________________________________________
>> Kernelnewbies mailing list
>> Kernelnewbies@xxxxxxxxxxxxxxxxx
>> http://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies

_______________________________________________
Kernelnewbies mailing list
Kernelnewbies@xxxxxxxxxxxxxxxxx
http://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies




[Index of Archives]     [Newbies FAQ]     [Linux Kernel Mentors]     [Linux Kernel Development]     [IETF Annouce]     [Git]     [Networking]     [Security]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux RAID]     [Linux SCSI]     [Linux ACPI]
  Powered by Linux