linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] mm/page_alloc: remove unneeded current_order check
@ 2023-08-08  2:05 Miaohe Lin
  2023-08-08 12:16 ` Hugo Villeneuve
  0 siblings, 1 reply; 3+ messages in thread
From: Miaohe Lin @ 2023-08-08  2:05 UTC (permalink / raw)
  To: akpm; +Cc: linux-mm, linux-kernel, linmiaohe

current_order is guaranteed to '>=' min_order while min_order always '>='
order. So current_order must be '>=' order.

Signed-off-by: Miaohe Lin <linmiaohe@huawei.com>
---
 mm/page_alloc.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/mm/page_alloc.c b/mm/page_alloc.c
index 96b7c1a7d1f2..d37ec87515d0 100644
--- a/mm/page_alloc.c
+++ b/mm/page_alloc.c
@@ -2072,8 +2072,7 @@ __rmqueue_fallback(struct zone *zone, int order, int start_migratetype,
 		 * allocation falls back into a different pageblock than this
 		 * one, it won't cause permanent fragmentation.
 		 */
-		if (!can_steal && start_migratetype == MIGRATE_MOVABLE
-					&& current_order > order)
+		if (!can_steal && start_migratetype == MIGRATE_MOVABLE)
 			goto find_smallest;
 
 		goto do_steal;
-- 
2.33.0



^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH] mm/page_alloc: remove unneeded current_order check
  2023-08-08  2:05 [PATCH] mm/page_alloc: remove unneeded current_order check Miaohe Lin
@ 2023-08-08 12:16 ` Hugo Villeneuve
  2023-08-08 12:32   ` Miaohe Lin
  0 siblings, 1 reply; 3+ messages in thread
From: Hugo Villeneuve @ 2023-08-08 12:16 UTC (permalink / raw)
  To: Miaohe Lin; +Cc: akpm, linux-mm, linux-kernel

On Tue, 8 Aug 2023 10:05:55 +0800
Miaohe Lin <linmiaohe@huawei.com> wrote:

> current_order is guaranteed to '>=' min_order while min_order always '>='
> order. So current_order must be '>=' order.
> 
> Signed-off-by: Miaohe Lin <linmiaohe@huawei.com>
> ---
>  mm/page_alloc.c | 3 +--
>  1 file changed, 1 insertion(+), 2 deletions(-)
> 
> diff --git a/mm/page_alloc.c b/mm/page_alloc.c
> index 96b7c1a7d1f2..d37ec87515d0 100644
> --- a/mm/page_alloc.c
> +++ b/mm/page_alloc.c
> @@ -2072,8 +2072,7 @@ __rmqueue_fallback(struct zone *zone, int order, int start_migratetype,
>  		 * allocation falls back into a different pageblock than this
>  		 * one, it won't cause permanent fragmentation.
>  		 */
> -		if (!can_steal && start_migratetype == MIGRATE_MOVABLE
> -					&& current_order > order)
> +		if (!can_steal && start_migratetype == MIGRATE_MOVABLE)
>  			goto find_smallest;

Hi,
if my analysis is correct, min_order can be initialized to the value of
order before the loop begins.

In that case, in the last loop iteration, current_order will be
equal to min_order and also to order. The condition 'current_order >
order' will evaluate to false, and the 'if' block should not be
executed?

Hugo.


^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH] mm/page_alloc: remove unneeded current_order check
  2023-08-08 12:16 ` Hugo Villeneuve
@ 2023-08-08 12:32   ` Miaohe Lin
  0 siblings, 0 replies; 3+ messages in thread
From: Miaohe Lin @ 2023-08-08 12:32 UTC (permalink / raw)
  To: Hugo Villeneuve; +Cc: akpm, linux-mm, linux-kernel

On 2023/8/8 20:16, Hugo Villeneuve wrote:
> On Tue, 8 Aug 2023 10:05:55 +0800
> Miaohe Lin <linmiaohe@huawei.com> wrote:
> 
>> current_order is guaranteed to '>=' min_order while min_order always '>='
>> order. So current_order must be '>=' order.
>>
>> Signed-off-by: Miaohe Lin <linmiaohe@huawei.com>
>> ---
>>  mm/page_alloc.c | 3 +--
>>  1 file changed, 1 insertion(+), 2 deletions(-)
>>
>> diff --git a/mm/page_alloc.c b/mm/page_alloc.c
>> index 96b7c1a7d1f2..d37ec87515d0 100644
>> --- a/mm/page_alloc.c
>> +++ b/mm/page_alloc.c
>> @@ -2072,8 +2072,7 @@ __rmqueue_fallback(struct zone *zone, int order, int start_migratetype,
>>  		 * allocation falls back into a different pageblock than this
>>  		 * one, it won't cause permanent fragmentation.
>>  		 */
>> -		if (!can_steal && start_migratetype == MIGRATE_MOVABLE
>> -					&& current_order > order)
>> +		if (!can_steal && start_migratetype == MIGRATE_MOVABLE)
>>  			goto find_smallest;
> 
> Hi,
> if my analysis is correct, min_order can be initialized to the value of
> order before the loop begins.
> 
> In that case, in the last loop iteration, current_order will be
> equal to min_order and also to order. The condition 'current_order >
> order' will evaluate to false, and the 'if' block should not be
> executed?

Oh, that's my mistake. Thanks for pointing this out. Will drop this patch.

Thanks!


^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2023-08-08 12:32 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-08-08  2:05 [PATCH] mm/page_alloc: remove unneeded current_order check Miaohe Lin
2023-08-08 12:16 ` Hugo Villeneuve
2023-08-08 12:32   ` Miaohe Lin

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox