From ff171e6f371f3c50d3898c648800ba74fe4cb7ea Mon Sep 17 00:00:00 2001 From: Krishna Reddy Date: Fri, 20 Jun 2014 14:40:52 -0700 Subject: [PATCH] video: tegra: nvmap: remove carveout commit accounting Remove obsolete carveout commit accounting. Bug 1529015 Change-Id: If7e25ca2ef43c036558c9c9ead5f67ee8eef6b42 Signed-off-by: Krishna Reddy Reviewed-on: http://git-master/r/426734 (cherry picked from commit c1ddad1b13332386857f9f2964aa8968094e7e8c) Reviewed-on: http://git-master/r/448554 Tested-by: Winnie Hsu --- drivers/video/tegra/nvmap/nvmap_dev.c | 47 +----------------------- drivers/video/tegra/nvmap/nvmap_handle.c | 16 -------- drivers/video/tegra/nvmap/nvmap_priv.h | 12 ------ 3 files changed, 1 insertion(+), 74 deletions(-) diff --git a/drivers/video/tegra/nvmap/nvmap_dev.c b/drivers/video/tegra/nvmap/nvmap_dev.c index 332f92e2b69..0b93cc346c6 100644 --- a/drivers/video/tegra/nvmap/nvmap_dev.c +++ b/drivers/video/tegra/nvmap/nvmap_dev.c @@ -223,40 +223,6 @@ out: return 0; } -void nvmap_carveout_commit_add(struct nvmap_client *client, - struct nvmap_carveout_node *node, - size_t len) -{ - spin_lock(&node->clients_lock); - BUG_ON(list_empty(&client->carveout_commit[node->index].list) && - client->carveout_commit[node->index].commit != 0); - - client->carveout_commit[node->index].commit += len; - /* if this client isn't already on the list of nodes for this heap, - add it */ - if (list_empty(&client->carveout_commit[node->index].list)) { - list_add(&client->carveout_commit[node->index].list, - &node->clients); - } - spin_unlock(&node->clients_lock); -} - -void nvmap_carveout_commit_subtract(struct nvmap_client *client, - struct nvmap_carveout_node *node, - size_t len) -{ - if (!client) - return; - - spin_lock(&node->clients_lock); - BUG_ON(client->carveout_commit[node->index].commit < len); - client->carveout_commit[node->index].commit -= len; - /* if no more allocation in this carveout for this node, delete it */ - if (!client->carveout_commit[node->index].commit) - list_del_init(&client->carveout_commit[node->index].list); - spin_unlock(&node->clients_lock); -} - static struct nvmap_heap_block *do_nvmap_carveout_alloc(struct nvmap_client *client, struct nvmap_handle *handle, @@ -364,13 +330,11 @@ struct nvmap_client *__nvmap_create_client(struct nvmap_device *dev, { struct nvmap_client *client; struct task_struct *task; - int i; if (WARN_ON(!dev)) return NULL; - client = kzalloc(sizeof(*client) + (sizeof(struct nvmap_carveout_commit) - * dev->nr_carveouts), GFP_KERNEL); + client = kzalloc(sizeof(*client), GFP_KERNEL); if (!client) return NULL; @@ -378,11 +342,6 @@ struct nvmap_client *__nvmap_create_client(struct nvmap_device *dev, client->kernel_client = true; client->handle_refs = RB_ROOT; - for (i = 0; i < dev->nr_carveouts; i++) { - INIT_LIST_HEAD(&client->carveout_commit[i].list); - client->carveout_commit[i].commit = 0; - } - get_task_struct(current->group_leader); task_lock(current->group_leader); /* don't bother to store task struct for kernel threads, @@ -408,7 +367,6 @@ struct nvmap_client *__nvmap_create_client(struct nvmap_device *dev, static void destroy_client(struct nvmap_client *client) { struct rb_node *n; - int i; if (!client) return; @@ -443,9 +401,6 @@ static void destroy_client(struct nvmap_client *client) kfree(ref); } - for (i = 0; i < nvmap_dev->nr_carveouts; i++) - list_del(&client->carveout_commit[i].list); - if (client->task) put_task_struct(client->task); diff --git a/drivers/video/tegra/nvmap/nvmap_handle.c b/drivers/video/tegra/nvmap/nvmap_handle.c index d3f02448061..2b37c35d091 100644 --- a/drivers/video/tegra/nvmap/nvmap_handle.c +++ b/drivers/video/tegra/nvmap/nvmap_handle.c @@ -415,14 +415,6 @@ void nvmap_free_handle(struct nvmap_client *client, client->handle_count--; atomic_dec(&ref->handle->share_count); - if (h->alloc && !h->heap_pgalloc) { - mutex_lock(&h->lock); - nvmap_carveout_commit_subtract(client, - nvmap_heap_to_arg(nvmap_block_to_heap(h->carveout)), - h->size); - mutex_unlock(&h->lock); - } - nvmap_ref_unlock(client); if (pins) @@ -589,14 +581,6 @@ struct nvmap_handle_ref *nvmap_duplicate_handle(struct nvmap_client *client, return ERR_PTR(-ENOMEM); } - if (!h->heap_pgalloc) { - mutex_lock(&h->lock); - nvmap_carveout_commit_add(client, - nvmap_heap_to_arg(nvmap_block_to_heap(h->carveout)), - h->size); - mutex_unlock(&h->lock); - } - atomic_set(&ref->dupes, 1); ref->handle = h; atomic_set(&ref->pin, 0); diff --git a/drivers/video/tegra/nvmap/nvmap_priv.h b/drivers/video/tegra/nvmap/nvmap_priv.h index fefe949c88b..8dda14986ec 100644 --- a/drivers/video/tegra/nvmap/nvmap_priv.h +++ b/drivers/video/tegra/nvmap/nvmap_priv.h @@ -232,11 +232,6 @@ int nvmap_page_pool_clear(void); int nvmap_page_pool_debugfs_init(struct dentry *nvmap_root); #endif -struct nvmap_carveout_commit { - size_t commit; - struct list_head list; -}; - struct nvmap_client { const char *name; struct rb_root handle_refs; @@ -247,7 +242,6 @@ struct nvmap_client { struct list_head list; u32 handle_count; u32 next_fd; - struct nvmap_carveout_commit carveout_commit[0]; int warned; }; @@ -361,12 +355,6 @@ unsigned long nvmap_carveout_usage(struct nvmap_client *c, struct nvmap_heap_block *b); struct nvmap_carveout_node; -void nvmap_carveout_commit_add(struct nvmap_client *client, - struct nvmap_carveout_node *node, size_t len); - -void nvmap_carveout_commit_subtract(struct nvmap_client *client, - struct nvmap_carveout_node *node, - size_t len); void nvmap_handle_put(struct nvmap_handle *h); -- 2.39.2