drm/msm: Use kmem_cache pool for struct vblank_work
These get allocated and freed millions of times on this kernel tree. Use a dedicated kmem_cache pool and avoid costly dynamic memory allocations. Signed-off-by: Park Ju Hyung <qkrwngud825@gmail.com> Signed-off-by: Pranav Vashi <neobuddy89@gmail.com>
This commit is contained in:
committed by
Pranav Vashi
parent
2ee241ec6c
commit
5570aaa915
@@ -66,6 +66,7 @@ static DEFINE_MUTEX(msm_release_lock);
|
||||
|
||||
atomic_t resume_pending;
|
||||
wait_queue_head_t resume_wait_q;
|
||||
static struct kmem_cache *kmem_vblank_work_pool;
|
||||
|
||||
static void msm_fb_output_poll_changed(struct drm_device *dev)
|
||||
{
|
||||
@@ -260,7 +261,7 @@ static void vblank_ctrl_worker(struct kthread_work *work)
|
||||
else
|
||||
kms->funcs->disable_vblank(kms, priv->crtcs[cur_work->crtc_id]);
|
||||
|
||||
kfree(cur_work);
|
||||
kmem_cache_free(kmem_vblank_work_pool, cur_work);
|
||||
}
|
||||
|
||||
static int vblank_ctrl_queue_work(struct msm_drm_private *priv,
|
||||
@@ -271,7 +272,7 @@ static int vblank_ctrl_queue_work(struct msm_drm_private *priv,
|
||||
if (!priv || crtc_id >= priv->num_crtcs)
|
||||
return -EINVAL;
|
||||
|
||||
cur_work = kzalloc(sizeof(*cur_work), GFP_ATOMIC);
|
||||
cur_work = kmem_cache_zalloc(kmem_vblank_work_pool, GFP_ATOMIC);
|
||||
if (!cur_work)
|
||||
return -ENOMEM;
|
||||
|
||||
@@ -2361,6 +2362,7 @@ static int __init msm_drm_register(void)
|
||||
return -EINVAL;
|
||||
|
||||
DBG("init");
|
||||
kmem_vblank_work_pool = KMEM_CACHE(vblank_work, SLAB_HWCACHE_ALIGN | SLAB_PANIC);
|
||||
msm_smmu_driver_init();
|
||||
msm_dsi_register();
|
||||
msm_edp_register();
|
||||
|
||||
Reference in New Issue
Block a user