diff options
author | Krishna Reddy <vdumpa@nvidia.com> | 2014-06-19 16:10:23 -0700 |
---|---|---|
committer | Winnie Hsu <whsu@nvidia.com> | 2014-08-08 14:44:13 -0700 |
commit | cdfe41cc63e630168a2e7e256bd990c2110c5a4d (patch) | |
tree | 52bab486d655932534d23caed6552b2c6602a97e /drivers/video/tegra/nvmap/nvmap_dev.c | |
parent | 8bfcc61d2587b9f13192653ebad24e01d2c95d2c (diff) |
video: tegra: nvmap: don't count shared memory in full
Don't count shared memory in full in iovmm stats.
Add SHARE field to allocations info to show how many
processes are sharing the handle.
Update few comments in the code.
Remove unnecessary iovm_commit accounting.
Bug 1529015
Change-Id: I49650bf081d652dedc7139f639aae6da06965ecd
Signed-off-by: Krishna Reddy <vdumpa@nvidia.com>
Reviewed-on: http://git-master/r/426274
(cherry picked from commit 92d47c10fbf7a315d4c953bafb71ee23032b7f65)
Reviewed-on: http://git-master/r/448533
Tested-by: Winnie Hsu <whsu@nvidia.com>
Diffstat (limited to 'drivers/video/tegra/nvmap/nvmap_dev.c')
-rw-r--r-- | drivers/video/tegra/nvmap/nvmap_dev.c | 33 |
1 files changed, 25 insertions, 8 deletions
diff --git a/drivers/video/tegra/nvmap/nvmap_dev.c b/drivers/video/tegra/nvmap/nvmap_dev.c index 9b874d3fb8e1..c0281fd0fafc 100644 --- a/drivers/video/tegra/nvmap/nvmap_dev.c +++ b/drivers/video/tegra/nvmap/nvmap_dev.c @@ -386,8 +386,6 @@ struct nvmap_client *__nvmap_create_client(struct nvmap_device *dev, client->kernel_client = true; client->handle_refs = RB_ROOT; - atomic_set(&client->iovm_commit, 0); - for (i = 0; i < dev->nr_carveouts; i++) { INIT_LIST_HEAD(&client->carveout_commit[i].list); client->carveout_commit[i].commit = 0; @@ -837,6 +835,25 @@ static void allocations_stringify(struct nvmap_client *client, nvmap_ref_unlock(client); } +static void nvmap_get_client_mss(struct nvmap_client *client, + u64 *total, bool iovmm) +{ + struct rb_node *n; + + *total = 0; + nvmap_ref_lock(client); + n = rb_first(&client->handle_refs); + for (; n != NULL; n = rb_next(n)) { + struct nvmap_handle_ref *ref = + rb_entry(n, struct nvmap_handle_ref, node); + struct nvmap_handle *handle = ref->handle; + if (handle->alloc && handle->heap_pgalloc == iovmm) + *total += handle->size / + atomic_read(&handle->share_count); + } + nvmap_ref_unlock(client); +} + static int nvmap_debug_allocations_show(struct seq_file *s, void *unused) { struct nvmap_carveout_node *node = s->private; @@ -945,14 +962,14 @@ static int nvmap_debug_iovmm_clients_show(struct seq_file *s, void *unused) seq_printf(s, "%-18s %18s %8s %11s\n", "CLIENT", "PROCESS", "PID", "SIZE"); list_for_each_entry(client, &dev->clients, list) { - int iovm_commit = atomic_read(&client->iovm_commit); + u64 client_total; client_stringify(client, s); - seq_printf(s, " %10uK\n", K(iovm_commit)); + nvmap_get_client_mss(client, &client_total, true); + seq_printf(s, " %10lluK\n", K(client_total)); } spin_unlock(&dev->clients_lock); nvmap_iovmm_get_total_mss(NULL, NULL, &total); seq_printf(s, "%-18s %18s %8s %10lluK\n", "total", "", "", K(total)); - PRINT_MEM_STATS_NOTE(SIZE); return 0; } @@ -971,16 +988,16 @@ static int nvmap_debug_iovmm_allocations_show(struct seq_file *s, void *unused) "", "", "BASE", "SIZE", "FLAGS", "REFS", "DUPES", "PINS", "SHARE", "UID"); list_for_each_entry(client, &dev->clients, list) { - int iovm_commit = atomic_read(&client->iovm_commit); + u64 client_total; client_stringify(client, s); - seq_printf(s, " %10uK\n", K(iovm_commit)); + nvmap_get_client_mss(client, &client_total, true); + seq_printf(s, " %10lluK\n", K(client_total)); allocations_stringify(client, s, true); seq_printf(s, "\n"); } spin_unlock(&dev->clients_lock); nvmap_iovmm_get_total_mss(NULL, NULL, &total); seq_printf(s, "%-18s %-18s %8s %10lluK\n", "total", "", "", K(total)); - PRINT_MEM_STATS_NOTE(SIZE); return 0; } |