[PATCH 1/2] drm/amdgpu: change job_list_lock to mutex

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

 



Am 28.06.2016 um 12:01 schrieb Huang Rui:
> On Tue, Jun 28, 2016 at 05:36:39PM +0800, Christian König wrote:
>> Am 28.06.2016 um 09:27 schrieb Huang Rui:
>>> On Tue, Jun 28, 2016 at 03:04:18PM +0800, Chunming Zhou wrote:
>>>> ring_mirror_list is only used kthread context, no need to spinlock.
>>>> otherwise deadlock happens when kthread_park.
>>>>
>>> Yes, in process context, we prefer to use mutex, because it avoids to
>>> grab the CPU all the time.
>>>
>>> Reviewed-by: Huang Rui <ray.huang at amd.com>
>> NAK, the patch won't apply because I've changed the irq save spin lock
>> to a normal one quite a while ago. But, I'm not sure if Alex picked up
>> that patch yet.
>>
>> You shouldn't use a mutex here when you don't have a reason to do so.
>> Spin locks have less overhead and we won't expect any contention here.
>>
> If the CPU core numbers are large, spinlock will grab the cpu and
> might cause some potential deaklock or busy waiting. I think it should
> be use mutex if it is not in interrupt context.

Clearly not a good idea.

Mutex should only be used if you expect contention on the lock or if you 
need to sleep while within the lock.

For things like protecting a linked list like in this case using a mutex 
is clearly the wrong approach.

Regards,
Christian.

>
> Thanks,
> Rui



[Index of Archives]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux