From b3d16ddfc98550586b5c2534532bf4bfc8941a83 Mon Sep 17 00:00:00 2001 From: Vitaly Prosyak Date: Mon, 11 Jan 2016 14:19:10 -0500 Subject: [PATCH 0685/1110] drm/amd/dal: Avoid flood kernel with storm of work items Add work item to system only when handler is available. The change decrease the boot time and improve system performance by not overload the system thread pool with thousands of empty work items. Signed-off-by: Vitaly Prosyak Acked-by: Jordan Lazare --- drivers/gpu/drm/amd/dal/amdgpu_dm/amdgpu_dm_irq.c | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/drivers/gpu/drm/amd/dal/amdgpu_dm/amdgpu_dm_irq.c b/drivers/gpu/drm/amd/dal/amdgpu_dm/amdgpu_dm_irq.c index ab6df66..7cfb754 100644 --- a/drivers/gpu/drm/amd/dal/amdgpu_dm/amdgpu_dm_irq.c +++ b/drivers/gpu/drm/amd/dal/amdgpu_dm/amdgpu_dm_irq.c @@ -558,15 +558,21 @@ static void amdgpu_dm_irq_schedule_work( enum dc_irq_source irq_source) { unsigned long irq_table_flags; + struct work_struct *work = NULL; DM_IRQ_TABLE_LOCK(adev, irq_table_flags); - /* Since the caller is interested in 'work_struct' then - * the irq will be post-processed at "INTERRUPT_LOW_IRQ_CONTEXT". */ - - schedule_work(&adev->dm.irq_handler_list_low_tab[irq_source].work); + if (!list_empty(&adev->dm.irq_handler_list_low_tab[irq_source].head)) + work = &adev->dm.irq_handler_list_low_tab[irq_source].work; DM_IRQ_TABLE_UNLOCK(adev, irq_table_flags); + + if (work) { + if (!schedule_work(work)) + DRM_INFO("amdgpu_dm_irq_schedule_work FAILED src %d\n", + irq_source); + } + } /** amdgpu_dm_irq_immediate_work -- 2.7.4