]> rtime.felk.cvut.cz Git - sojka/nv-tegra/linux-3.10.git/commitdiff
video: tegra: nvmap: remove carveout commit accounting
authorKrishna Reddy <vdumpa@nvidia.com>
Fri, 20 Jun 2014 21:40:52 +0000 (14:40 -0700)
committerWinnie Hsu <whsu@nvidia.com>
Fri, 8 Aug 2014 21:48:19 +0000 (14:48 -0700)
Remove obsolete carveout commit accounting.

Bug 1529015

Change-Id: If7e25ca2ef43c036558c9c9ead5f67ee8eef6b42
Signed-off-by: Krishna Reddy <vdumpa@nvidia.com>
Reviewed-on: http://git-master/r/426734
(cherry picked from commit c1ddad1b13332386857f9f2964aa8968094e7e8c)
Reviewed-on: http://git-master/r/448554
Tested-by: Winnie Hsu <whsu@nvidia.com>
drivers/video/tegra/nvmap/nvmap_dev.c
drivers/video/tegra/nvmap/nvmap_handle.c
drivers/video/tegra/nvmap/nvmap_priv.h

index 332f92e2b69cd15180f36dd9fc86ccc3366d12f6..0b93cc346c6a302410f7c1d4fefadd250db721e1 100644 (file)
@@ -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);
 
index d3f0244806150cdc855006eab0799c211503f52c..2b37c35d09183d61ad9218e37eeb5269493082b6 100644 (file)
@@ -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);
index fefe949c88b176f8b8db549f0eb2499f30e9d13c..8dda14986ec8f9a476b3f627a13cb935db0d4076 100644 (file)
@@ -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);