diff mbox

[2/2] drm/amdgpu: remove sorting of CS BOs

Message ID 1460638497-2450-2-git-send-email-deathsimple@vodafone.de (mailing list archive)
State New, archived
Headers show

Commit Message

Christian König April 14, 2016, 12:54 p.m. UTC
From: Christian König <christian.koenig@amd.com>

Not needed any more.

Signed-off-by: Christian König <christian.koenig@amd.com>
---
 drivers/gpu/drm/amd/amdgpu/amdgpu_cs.c | 23 -----------------------
 1 file changed, 23 deletions(-)

Comments

Ayyappa Ch April 15, 2016, 5:21 a.m. UTC | #1
Hello Christian ,

As per below comment  large buffer eviction is more expensive. So
removing this code will solve the same problem?

-               /* Sort the buffer list from the smallest to largest buffer,
-                * which affects the order of buffers in the LRU list.
-                * This assures that the smallest buffers are added first
-                * to the LRU list, so they are likely to be later evicted
-                * first, instead of large buffers whose eviction is more
-                * expensive.
-                *
-                * This slightly lowers the number of bytes moved by TTM
-                * per frame under memory pressure.
-                */
-               list_sort(NULL, &parser->validated, cmp_size_smaller_first);
-

Thanks,
Ayyappa.

On Thu, Apr 14, 2016 at 6:24 PM, Christian König
<deathsimple@vodafone.de> wrote:
> From: Christian König <christian.koenig@amd.com>
>
> Not needed any more.
>
> Signed-off-by: Christian König <christian.koenig@amd.com>
> ---
>  drivers/gpu/drm/amd/amdgpu/amdgpu_cs.c | 23 -----------------------
>  1 file changed, 23 deletions(-)
>
> diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_cs.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_cs.c
> index 9392e50..00cf74a 100644
> --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_cs.c
> +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_cs.c
> @@ -24,7 +24,6 @@
>   * Authors:
>   *    Jerome Glisse <glisse@freedesktop.org>
>   */
> -#include <linux/list_sort.h>
>  #include <linux/pagemap.h>
>  #include <drm/drmP.h>
>  #include <drm/amdgpu_drm.h>
> @@ -527,16 +526,6 @@ static int amdgpu_cs_sync_rings(struct amdgpu_cs_parser *p)
>         return 0;
>  }
>
> -static int cmp_size_smaller_first(void *priv, struct list_head *a,
> -                                 struct list_head *b)
> -{
> -       struct amdgpu_bo_list_entry *la = list_entry(a, struct amdgpu_bo_list_entry, tv.head);
> -       struct amdgpu_bo_list_entry *lb = list_entry(b, struct amdgpu_bo_list_entry, tv.head);
> -
> -       /* Sort A before B if A is smaller. */
> -       return (int)la->robj->tbo.num_pages - (int)lb->robj->tbo.num_pages;
> -}
> -
>  /**
>   * cs_parser_fini() - clean parser states
>   * @parser:    parser structure holding parsing context.
> @@ -553,18 +542,6 @@ static void amdgpu_cs_parser_fini(struct amdgpu_cs_parser *parser, int error, bo
>         if (!error) {
>                 amdgpu_vm_move_pt_bos_in_lru(parser->adev, &fpriv->vm);
>
> -               /* Sort the buffer list from the smallest to largest buffer,
> -                * which affects the order of buffers in the LRU list.
> -                * This assures that the smallest buffers are added first
> -                * to the LRU list, so they are likely to be later evicted
> -                * first, instead of large buffers whose eviction is more
> -                * expensive.
> -                *
> -                * This slightly lowers the number of bytes moved by TTM
> -                * per frame under memory pressure.
> -                */
> -               list_sort(NULL, &parser->validated, cmp_size_smaller_first);
> -
>                 ttm_eu_fence_buffer_objects(&parser->ticket,
>                                             &parser->validated,
>                                             parser->fence);
> --
> 2.5.0
>
> _______________________________________________
> dri-devel mailing list
> dri-devel@lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/dri-devel
diff mbox

Patch

diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_cs.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_cs.c
index 9392e50..00cf74a 100644
--- a/drivers/gpu/drm/amd/amdgpu/amdgpu_cs.c
+++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_cs.c
@@ -24,7 +24,6 @@ 
  * Authors:
  *    Jerome Glisse <glisse@freedesktop.org>
  */
-#include <linux/list_sort.h>
 #include <linux/pagemap.h>
 #include <drm/drmP.h>
 #include <drm/amdgpu_drm.h>
@@ -527,16 +526,6 @@  static int amdgpu_cs_sync_rings(struct amdgpu_cs_parser *p)
 	return 0;
 }
 
-static int cmp_size_smaller_first(void *priv, struct list_head *a,
-				  struct list_head *b)
-{
-	struct amdgpu_bo_list_entry *la = list_entry(a, struct amdgpu_bo_list_entry, tv.head);
-	struct amdgpu_bo_list_entry *lb = list_entry(b, struct amdgpu_bo_list_entry, tv.head);
-
-	/* Sort A before B if A is smaller. */
-	return (int)la->robj->tbo.num_pages - (int)lb->robj->tbo.num_pages;
-}
-
 /**
  * cs_parser_fini() - clean parser states
  * @parser:	parser structure holding parsing context.
@@ -553,18 +542,6 @@  static void amdgpu_cs_parser_fini(struct amdgpu_cs_parser *parser, int error, bo
 	if (!error) {
 		amdgpu_vm_move_pt_bos_in_lru(parser->adev, &fpriv->vm);
 
-		/* Sort the buffer list from the smallest to largest buffer,
-		 * which affects the order of buffers in the LRU list.
-		 * This assures that the smallest buffers are added first
-		 * to the LRU list, so they are likely to be later evicted
-		 * first, instead of large buffers whose eviction is more
-		 * expensive.
-		 *
-		 * This slightly lowers the number of bytes moved by TTM
-		 * per frame under memory pressure.
-		 */
-		list_sort(NULL, &parser->validated, cmp_size_smaller_first);
-
 		ttm_eu_fence_buffer_objects(&parser->ticket,
 					    &parser->validated,
 					    parser->fence);