diff options
author | Krishna Reddy <vdumpa@nvidia.com> | 2014-06-19 17:34:01 -0700 |
---|---|---|
committer | Winnie Hsu <whsu@nvidia.com> | 2014-08-08 14:40:07 -0700 |
commit | 97b7a88bcdd938ff4e3bf156f966b722b2b53eba (patch) | |
tree | 2baae98a1c457d2c9367b9151b67947e1c70a424 /drivers/video | |
parent | 7b18157d98306316ccdafd8e906b7858a7099bab (diff) |
video: tegra: nvmap: add handle share count to debug stats
handle share count provides info on how many processes are sharing
the handle. IOW, how many processes are holding a ref on handle.
Update the comments for umap/kmap_count.
Bug 1529015
Change-Id: I9f543ebf51842dad6ecd3bfeb7480496c98963be
Signed-off-by: Krishna Reddy <vdumpa@nvidia.com>
Reviewed-on: http://git-master/r/426302
(cherry picked from commit 244c41508be0705cc232942b9403e17611f63e45)
Reviewed-on: http://git-master/r/448521
Tested-by: Maneet Maneet Singh <mmaneetsingh@nvidia.com>
Diffstat (limited to 'drivers/video')
-rw-r--r-- | drivers/video/tegra/nvmap/nvmap_dev.c | 12 | ||||
-rw-r--r-- | drivers/video/tegra/nvmap/nvmap_handle.c | 2 | ||||
-rw-r--r-- | drivers/video/tegra/nvmap/nvmap_priv.h | 1 |
3 files changed, 10 insertions, 5 deletions
diff --git a/drivers/video/tegra/nvmap/nvmap_dev.c b/drivers/video/tegra/nvmap/nvmap_dev.c index 6ae8e7190855..9b874d3fb8e1 100644 --- a/drivers/video/tegra/nvmap/nvmap_dev.c +++ b/drivers/video/tegra/nvmap/nvmap_dev.c @@ -444,6 +444,7 @@ static void destroy_client(struct nvmap_client *client) dma_buf_put(ref->handle->dmabuf); rb_erase(&ref->node, &client->handle_refs); + atomic_dec(&ref->handle->share_count); dupes = atomic_read(&ref->dupes); while (dupes--) @@ -822,13 +823,14 @@ static void allocations_stringify(struct nvmap_client *client, phys_addr_t base = iovmm ? 0 : (handle->carveout->base); seq_printf(s, - "%-18s %-18s %8llx %10zuK %8x %6u %6u %6u %8p\n", + "%-18s %-18s %8llx %10zuK %8x %6u %6u %6u %6u %8p\n", "", "", (unsigned long long)base, K(handle->size), handle->userflags, atomic_read(&handle->ref), atomic_read(&ref->dupes), atomic_read(&ref->pin), + atomic_read(&handle->share_count), handle); } } @@ -844,9 +846,9 @@ static int nvmap_debug_allocations_show(struct seq_file *s, void *unused) spin_lock(&node->clients_lock); seq_printf(s, "%-18s %18s %8s %11s\n", "CLIENT", "PROCESS", "PID", "SIZE"); - seq_printf(s, "%-18s %18s %8s %11s %8s %6s %6s %6s %8s\n", + seq_printf(s, "%-18s %18s %8s %11s %8s %6s %6s %6s %6s %8s\n", "", "", "BASE", "SIZE", "FLAGS", "REFS", - "DUPES", "PINS", "UID"); + "DUPES", "PINS", "SHARE", "UID"); list_for_each_entry(commit, &node->clients, list) { struct nvmap_client *client = get_client_from_carveout_commit(node, commit); @@ -965,9 +967,9 @@ static int nvmap_debug_iovmm_allocations_show(struct seq_file *s, void *unused) spin_lock(&dev->clients_lock); seq_printf(s, "%-18s %18s %8s %11s\n", "CLIENT", "PROCESS", "PID", "SIZE"); - seq_printf(s, "%-18s %18s %8s %11s %8s %6s %6s %6s %8s\n", + seq_printf(s, "%-18s %18s %8s %11s %8s %6s %6s %6s %6s %8s\n", "", "", "BASE", "SIZE", "FLAGS", "REFS", - "DUPES", "PINS", "UID"); + "DUPES", "PINS", "SHARE", "UID"); list_for_each_entry(client, &dev->clients, list) { int iovm_commit = atomic_read(&client->iovm_commit); client_stringify(client, s); diff --git a/drivers/video/tegra/nvmap/nvmap_handle.c b/drivers/video/tegra/nvmap/nvmap_handle.c index 0959a98d5bf4..40ebbb089ab0 100644 --- a/drivers/video/tegra/nvmap/nvmap_handle.c +++ b/drivers/video/tegra/nvmap/nvmap_handle.c @@ -418,6 +418,7 @@ void nvmap_free_handle(struct nvmap_client *client, pins = atomic_read(&ref->pin); rb_erase(&ref->node, &client->handle_refs); client->handle_count--; + atomic_dec(&ref->handle->share_count); if (h->alloc && h->heap_pgalloc) atomic_sub(h->size, &client->iovm_commit); @@ -478,6 +479,7 @@ static void add_handle_ref(struct nvmap_client *client, client->handle_count++; if (client->handle_count > nvmap_max_handle_count) nvmap_max_handle_count = client->handle_count; + atomic_inc(&ref->handle->share_count); nvmap_ref_unlock(client); } diff --git a/drivers/video/tegra/nvmap/nvmap_priv.h b/drivers/video/tegra/nvmap/nvmap_priv.h index 7489263c8c62..a3c45d87c3cc 100644 --- a/drivers/video/tegra/nvmap/nvmap_priv.h +++ b/drivers/video/tegra/nvmap/nvmap_priv.h @@ -135,6 +135,7 @@ struct nvmap_handle { u32 userflags; /* flags passed from userspace */ void *vaddr; /* mapping used inside kernel */ struct list_head vmas; /* list of all user vma's */ + atomic_t share_count; /* number of processes sharing the handle */ struct mutex lock; void *nvhost_priv; /* nvhost private data */ void (*nvhost_priv_delete)(void *priv); |