diff mbox series

[v2] drm/buddy: Fix the warn on's during force merge

Message ID 20240517135015.17565-1-Arunpravin.PaneerSelvam@amd.com (mailing list archive)
State New, archived
Headers show
Series [v2] drm/buddy: Fix the warn on's during force merge | expand

Commit Message

Paneer Selvam, Arunpravin May 17, 2024, 1:50 p.m. UTC
Move the fallback and block incompatible checks
above, so that we dont unnecessarily split the blocks
and leaving the unmerged. This resolves the unnecessary
warn on's thrown during force_merge call.

v2:(Matthew)
  - Move the fallback and block incompatible checks above
    the contains check.

Signed-off-by: Arunpravin Paneer Selvam <Arunpravin.PaneerSelvam@amd.com>
Fixes: 96950929eb23 ("drm/buddy: Implement tracking clear page feature")
---
 drivers/gpu/drm/drm_buddy.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

Comments

Paneer Selvam, Arunpravin May 17, 2024, 1:53 p.m. UTC | #1
Hi Matthew,
This fixes the problem.

Regards,
Arun.

On 5/17/2024 7:20 PM, Arunpravin Paneer Selvam wrote:
> Move the fallback and block incompatible checks
> above, so that we dont unnecessarily split the blocks
> and leaving the unmerged. This resolves the unnecessary
> warn on's thrown during force_merge call.
>
> v2:(Matthew)
>    - Move the fallback and block incompatible checks above
>      the contains check.
>
> Signed-off-by: Arunpravin Paneer Selvam <Arunpravin.PaneerSelvam@amd.com>
> Fixes: 96950929eb23 ("drm/buddy: Implement tracking clear page feature")
> ---
>   drivers/gpu/drm/drm_buddy.c | 6 +++---
>   1 file changed, 3 insertions(+), 3 deletions(-)
>
> diff --git a/drivers/gpu/drm/drm_buddy.c b/drivers/gpu/drm/drm_buddy.c
> index 1daf778cf6fa..94f8c34fc293 100644
> --- a/drivers/gpu/drm/drm_buddy.c
> +++ b/drivers/gpu/drm/drm_buddy.c
> @@ -524,11 +524,11 @@ __alloc_range_bias(struct drm_buddy *mm,
>   				continue;
>   		}
>   
> +		if (!fallback && block_incompatible(block, flags))
> +			continue;
> +
>   		if (contains(start, end, block_start, block_end) &&
>   		    order == drm_buddy_block_order(block)) {
> -			if (!fallback && block_incompatible(block, flags))
> -				continue;
> -
>   			/*
>   			 * Find the free block within the range.
>   			 */
Matthew Auld May 17, 2024, 2 p.m. UTC | #2
On 17/05/2024 14:50, Arunpravin Paneer Selvam wrote:
> Move the fallback and block incompatible checks
> above, so that we dont unnecessarily split the blocks
> and leaving the unmerged. This resolves the unnecessary
> warn on's thrown during force_merge call.
> 
> v2:(Matthew)
>    - Move the fallback and block incompatible checks above
>      the contains check.
> 
> Signed-off-by: Arunpravin Paneer Selvam <Arunpravin.PaneerSelvam@amd.com>
> Fixes: 96950929eb23 ("drm/buddy: Implement tracking clear page feature")
Reviewed-by: Matthew Auld <matthew.auld@intel.com>

A follow up unit test to catch this edge case would be lovely.

> ---
>   drivers/gpu/drm/drm_buddy.c | 6 +++---
>   1 file changed, 3 insertions(+), 3 deletions(-)
> 
> diff --git a/drivers/gpu/drm/drm_buddy.c b/drivers/gpu/drm/drm_buddy.c
> index 1daf778cf6fa..94f8c34fc293 100644
> --- a/drivers/gpu/drm/drm_buddy.c
> +++ b/drivers/gpu/drm/drm_buddy.c
> @@ -524,11 +524,11 @@ __alloc_range_bias(struct drm_buddy *mm,
>   				continue;
>   		}
>   
> +		if (!fallback && block_incompatible(block, flags))
> +			continue;
> +
>   		if (contains(start, end, block_start, block_end) &&
>   		    order == drm_buddy_block_order(block)) {
> -			if (!fallback && block_incompatible(block, flags))
> -				continue;
> -
>   			/*
>   			 * Find the free block within the range.
>   			 */
Paneer Selvam, Arunpravin May 17, 2024, 2:34 p.m. UTC | #3
On 5/17/2024 7:30 PM, Matthew Auld wrote:
> On 17/05/2024 14:50, Arunpravin Paneer Selvam wrote:
>> Move the fallback and block incompatible checks
>> above, so that we dont unnecessarily split the blocks
>> and leaving the unmerged. This resolves the unnecessary
>> warn on's thrown during force_merge call.
>>
>> v2:(Matthew)
>>    - Move the fallback and block incompatible checks above
>>      the contains check.
>>
>> Signed-off-by: Arunpravin Paneer Selvam 
>> <Arunpravin.PaneerSelvam@amd.com>
>> Fixes: 96950929eb23 ("drm/buddy: Implement tracking clear page feature")
> Reviewed-by: Matthew Auld <matthew.auld@intel.com>
>
> A follow up unit test to catch this edge case would be lovely.
Yes, I will follow up on this.

Thanks,
Arun.
>
>> ---
>>   drivers/gpu/drm/drm_buddy.c | 6 +++---
>>   1 file changed, 3 insertions(+), 3 deletions(-)
>>
>> diff --git a/drivers/gpu/drm/drm_buddy.c b/drivers/gpu/drm/drm_buddy.c
>> index 1daf778cf6fa..94f8c34fc293 100644
>> --- a/drivers/gpu/drm/drm_buddy.c
>> +++ b/drivers/gpu/drm/drm_buddy.c
>> @@ -524,11 +524,11 @@ __alloc_range_bias(struct drm_buddy *mm,
>>                   continue;
>>           }
>>   +        if (!fallback && block_incompatible(block, flags))
>> +            continue;
>> +
>>           if (contains(start, end, block_start, block_end) &&
>>               order == drm_buddy_block_order(block)) {
>> -            if (!fallback && block_incompatible(block, flags))
>> -                continue;
>> -
>>               /*
>>                * Find the free block within the range.
>>                */
diff mbox series

Patch

diff --git a/drivers/gpu/drm/drm_buddy.c b/drivers/gpu/drm/drm_buddy.c
index 1daf778cf6fa..94f8c34fc293 100644
--- a/drivers/gpu/drm/drm_buddy.c
+++ b/drivers/gpu/drm/drm_buddy.c
@@ -524,11 +524,11 @@  __alloc_range_bias(struct drm_buddy *mm,
 				continue;
 		}
 
+		if (!fallback && block_incompatible(block, flags))
+			continue;
+
 		if (contains(start, end, block_start, block_end) &&
 		    order == drm_buddy_block_order(block)) {
-			if (!fallback && block_incompatible(block, flags))
-				continue;
-
 			/*
 			 * Find the free block within the range.
 			 */