diff options
author | vdumpa <vdumpa@nvidia.com> | 2011-06-08 17:42:19 -0700 |
---|---|---|
committer | Dan Willemsen <dwillemsen@nvidia.com> | 2011-11-30 21:45:05 -0800 |
commit | 54d09469336fea21862966b1e82ad20fe8cb63b2 (patch) | |
tree | 8cd6308ea40f5c8106fdbeca89bd6ab60ccb5c0f /drivers/video/tegra/nvmap/nvmap_handle.c | |
parent | 68254f1b66474c210bb4ba0e12c6513c9630d512 (diff) |
video: tegra: nvmap: Fix iovm_commit accounting issue.
Bug 835748
Original-Change-Id: I67766cc94496162816cbef4689fa806553d6edfa
Reviewed-on: http://git-master/r/35792
Reviewed-by: Yu-Huan Hsu <yhsu@nvidia.com>
Reviewed-by: Krishna Reddy <vdumpa@nvidia.com>
Tested-by: Krishna Reddy <vdumpa@nvidia.com>
Rebase-Id: Ree8a45408d5763ec8db2cc4072add4c347326f99
Diffstat (limited to 'drivers/video/tegra/nvmap/nvmap_handle.c')
-rw-r--r-- | drivers/video/tegra/nvmap/nvmap_handle.c | 11 |
1 files changed, 7 insertions, 4 deletions
diff --git a/drivers/video/tegra/nvmap/nvmap_handle.c b/drivers/video/tegra/nvmap/nvmap_handle.c index 0c77e8a23035..21f50b1c98b0 100644 --- a/drivers/video/tegra/nvmap/nvmap_handle.c +++ b/drivers/video/tegra/nvmap/nvmap_handle.c @@ -266,13 +266,15 @@ static void alloc_handle(struct nvmap_client *client, } else if (type & __NVMAP_HEAP_IOVMM) { size_t reserved = PAGE_ALIGN(h->size); - int commit; + int commit = 0; int ret; /* increment the committed IOVM space prior to allocation * to avoid race conditions with other threads simultaneously * allocating. */ - commit = atomic_add_return(reserved, &client->iovm_commit); + if (!client->super) + commit = atomic_add_return(reserved, + &client->iovm_commit); if (commit < client->iovm_limit) ret = handle_page_alloc(client, h, false); @@ -283,7 +285,8 @@ static void alloc_handle(struct nvmap_client *client, h->heap_pgalloc = true; h->alloc = true; } else { - atomic_sub(reserved, &client->iovm_commit); + if (!client->super) + atomic_sub(reserved, &client->iovm_commit); } } else if (type & NVMAP_HEAP_SYSMEM) { @@ -441,7 +444,7 @@ void nvmap_free_handle_id(struct nvmap_client *client, unsigned long id) pins = atomic_read(&ref->pin); rb_erase(&ref->node, &client->handle_refs); - if (h->alloc && h->heap_pgalloc && !h->pgalloc.contig) + if (h->alloc && h->heap_pgalloc && !h->pgalloc.contig && !client->super) atomic_sub(h->size, &client->iovm_commit); if (h->alloc && !h->heap_pgalloc) { |