diff options
author | Rebecca Schultz Zavin <rebecca@android.com> | 2010-11-15 17:02:16 -0800 |
---|---|---|
committer | Dan Willemsen <dwillemsen@nvidia.com> | 2011-11-30 21:36:47 -0800 |
commit | b1274588c28c91004badef369317db52475be780 (patch) | |
tree | e162fed0de04dbe6d4b735baac52414d5f7760d8 /drivers/video/tegra/nvmap/nvmap_handle.c | |
parent | a7bc81e66214385d936bec95599aefcce99801ae (diff) |
video: tegra: nvmap: Fix per client accounting
Fix the way the total number of carveout allocations is
managed per client.
Change-Id: I3e12e2a98a74cafc1f4c51a48e3c3c549e930160
Signed-off-by: Rebecca Schultz Zavin <rebecca@android.com>
Diffstat (limited to 'drivers/video/tegra/nvmap/nvmap_handle.c')
-rw-r--r-- | drivers/video/tegra/nvmap/nvmap_handle.c | 18 |
1 files changed, 13 insertions, 5 deletions
diff --git a/drivers/video/tegra/nvmap/nvmap_handle.c b/drivers/video/tegra/nvmap/nvmap_handle.c index 09502bff4883..4455c8d1cce1 100644 --- a/drivers/video/tegra/nvmap/nvmap_handle.c +++ b/drivers/video/tegra/nvmap/nvmap_handle.c @@ -81,11 +81,6 @@ void _nvmap_handle_free(struct nvmap_handle *h) goto out; if (!h->heap_pgalloc) { - mutex_lock(&h->lock); - nvmap_carveout_commit_subtract(h->owner, - nvmap_heap_to_arg(nvmap_block_to_heap(h->carveout)), - h->size); - mutex_unlock(&h->lock); nvmap_heap_free(h->carveout); goto out; } @@ -213,6 +208,9 @@ static void alloc_handle(struct nvmap_client *client, size_t align, h->carveout = b; h->heap_pgalloc = false; h->alloc = true; + nvmap_carveout_commit_add(client, + nvmap_heap_to_arg(nvmap_block_to_heap(b)), + h->size); } } else if (type & NVMAP_HEAP_IOVMM) { size_t reserved = PAGE_ALIGN(h->size); @@ -367,6 +365,11 @@ void nvmap_free_handle_id(struct nvmap_client *client, unsigned long id) if (h->alloc && h->heap_pgalloc && !h->pgalloc.contig) atomic_sub(h->size, &client->iovm_commit); + if (h->alloc && !h->heap_pgalloc) + nvmap_carveout_commit_subtract(client, + nvmap_heap_to_arg(nvmap_block_to_heap(h->carveout)), + h->size); + nvmap_ref_unlock(client); if (pins) @@ -499,6 +502,11 @@ struct nvmap_handle_ref *nvmap_duplicate_handle_id(struct nvmap_client *client, return ERR_PTR(-ENOMEM); } + if (!h->heap_pgalloc) + nvmap_carveout_commit_add(client, + nvmap_heap_to_arg(nvmap_block_to_heap(h->carveout)), + h->size); + atomic_set(&ref->dupes, 1); ref->handle = h; atomic_set(&ref->pin, 0); |