diff options
author | Rebecca Schultz Zavin <rebecca@android.com> | 2012-10-10 10:34:50 -0700 |
---|---|---|
committer | Nitin Garg <nitin.garg@freescale.com> | 2014-04-21 22:35:03 -0500 |
commit | e35d8efd5330e7ce4148607d0d063e709d2defc2 (patch) | |
tree | 755c66764f6708c804f6fdc01080beb194d00f0e /drivers/gpu | |
parent | 3d1ba9515aaf95ea075dfe37bdd644df69a76b0f (diff) |
gpu: ion: Fix lockdep issue in ion_page_pool
Currently the mutex is held while kmalloc is called, under a low memory
condition this might trigger the shrinker which also takes this mutex.
Refactor so the mutex is not held during allocation.
Change-Id: Ic1d3b2f69e61209191bac84724ba56f6b98e2bc4
Signed-off-by: Rebecca Schultz Zavin <rebecca@android.com>
Diffstat (limited to 'drivers/gpu')
-rw-r--r-- | drivers/gpu/ion/ion_page_pool.c | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/drivers/gpu/ion/ion_page_pool.c b/drivers/gpu/ion/ion_page_pool.c index b39663f4a1b7..3f3d2091dc82 100644 --- a/drivers/gpu/ion/ion_page_pool.c +++ b/drivers/gpu/ion/ion_page_pool.c @@ -53,6 +53,8 @@ static int ion_page_pool_add(struct ion_page_pool *pool, struct page *page) item = kmalloc(sizeof(struct ion_page_pool_item), GFP_KERNEL); if (!item) return -ENOMEM; + + mutex_lock(&pool->mutex); item->page = page; if (PageHighMem(page)) { list_add_tail(&item->list, &pool->high_items); @@ -61,6 +63,7 @@ static int ion_page_pool_add(struct ion_page_pool *pool, struct page *page) list_add_tail(&item->list, &pool->low_items); pool->low_count++; } + mutex_unlock(&pool->mutex); return 0; } @@ -110,9 +113,7 @@ void ion_page_pool_free(struct ion_page_pool *pool, struct page* page) { int ret; - mutex_lock(&pool->mutex); ret = ion_page_pool_add(pool, page); - mutex_unlock(&pool->mutex); if (ret) ion_page_pool_free_pages(pool, page); } |