diff mbox series

drm/mm: remove invalid entry based optimization

Message ID 20200608151550.1315-1-christian.koenig@amd.com (mailing list archive)
State New, archived
Headers show
Series drm/mm: remove invalid entry based optimization | expand

Commit Message

Christian König June 8, 2020, 3:15 p.m. UTC
When the current entry is rejected as candidate for the search
it does not mean that we can abort the subtree search.

It is perfectly possible that only the alignment, but not the
size is the reason for the rejection.

Signed-off-by: Christian König <christian.koenig@amd.com>
---
 drivers/gpu/drm/drm_mm.c | 6 ++----
 1 file changed, 2 insertions(+), 4 deletions(-)

Comments

Nirmoy June 8, 2020, 4:42 p.m. UTC | #1
On 6/8/20 5:15 PM, Christian König wrote:
> When the current entry is rejected as candidate for the search
> it does not mean that we can abort the subtree search.
>
> It is perfectly possible that only the alignment, but not the
> size is the reason for the rejection.


I know why I  did that, I was testing with 8k alignment. So this was 
biased to optimize my test case.


>
> Signed-off-by: Christian König <christian.koenig@amd.com>


Reviewed-by: Nirmoy Das <nirmoy.das@amd.com>


> ---
>   drivers/gpu/drm/drm_mm.c | 6 ++----
>   1 file changed, 2 insertions(+), 4 deletions(-)
>
> diff --git a/drivers/gpu/drm/drm_mm.c b/drivers/gpu/drm/drm_mm.c
> index 60e9a9c91e9d..82d2888eb7fe 100644
> --- a/drivers/gpu/drm/drm_mm.c
> +++ b/drivers/gpu/drm/drm_mm.c
> @@ -406,8 +406,7 @@ next_hole_high_addr(struct drm_mm_node *entry, u64 size)
>   		parent_rb_node = rb_parent(rb_node);
>   		left_node = rb_entry(left_rb_node,
>   				     struct drm_mm_node, rb_hole_addr);
> -		if ((left_node->subtree_max_hole < size ||
> -		     HOLE_SIZE(entry) == entry->subtree_max_hole) &&
> +		if (left_node->subtree_max_hole < size &&
>   		    parent_rb_node && parent_rb_node->rb_left != rb_node)
>   			return rb_hole_addr_to_node(parent_rb_node);
>   	}
> @@ -446,8 +445,7 @@ next_hole_low_addr(struct drm_mm_node *entry, u64 size)
>   		parent_rb_node = rb_parent(rb_node);
>   		right_node = rb_entry(right_rb_node,
>   				      struct drm_mm_node, rb_hole_addr);
> -		if ((right_node->subtree_max_hole < size ||
> -		     HOLE_SIZE(entry) == entry->subtree_max_hole) &&
> +		if (right_node->subtree_max_hole < size &&
>   		    parent_rb_node && parent_rb_node->rb_right != rb_node)
>   			return rb_hole_addr_to_node(parent_rb_node);
>   	}
diff mbox series

Patch

diff --git a/drivers/gpu/drm/drm_mm.c b/drivers/gpu/drm/drm_mm.c
index 60e9a9c91e9d..82d2888eb7fe 100644
--- a/drivers/gpu/drm/drm_mm.c
+++ b/drivers/gpu/drm/drm_mm.c
@@ -406,8 +406,7 @@  next_hole_high_addr(struct drm_mm_node *entry, u64 size)
 		parent_rb_node = rb_parent(rb_node);
 		left_node = rb_entry(left_rb_node,
 				     struct drm_mm_node, rb_hole_addr);
-		if ((left_node->subtree_max_hole < size ||
-		     HOLE_SIZE(entry) == entry->subtree_max_hole) &&
+		if (left_node->subtree_max_hole < size &&
 		    parent_rb_node && parent_rb_node->rb_left != rb_node)
 			return rb_hole_addr_to_node(parent_rb_node);
 	}
@@ -446,8 +445,7 @@  next_hole_low_addr(struct drm_mm_node *entry, u64 size)
 		parent_rb_node = rb_parent(rb_node);
 		right_node = rb_entry(right_rb_node,
 				      struct drm_mm_node, rb_hole_addr);
-		if ((right_node->subtree_max_hole < size ||
-		     HOLE_SIZE(entry) == entry->subtree_max_hole) &&
+		if (right_node->subtree_max_hole < size &&
 		    parent_rb_node && parent_rb_node->rb_right != rb_node)
 			return rb_hole_addr_to_node(parent_rb_node);
 	}