diff mbox series

[v2,3/3] mm/page_alloc: remove unnecessary next_page in break_down_buddy_pages

Message ID 20230826154745.4019371-4-shikemeng@huaweicloud.com (mailing list archive)
State New
Headers show
Series Fixes and cleanups to break_down_buddy_pages | expand

Commit Message

Kemeng Shi Aug. 26, 2023, 3:47 p.m. UTC
The next_page is only used to forward page in case target is in second
harf range. Move forward page directly to remove unnecessary next_page.

Signed-off-by: Kemeng Shi <shikemeng@huaweicloud.com>
---
 mm/page_alloc.c | 6 ++----
 1 file changed, 2 insertions(+), 4 deletions(-)

Comments

Naoya Horiguchi Sept. 26, 2023, 11:34 a.m. UTC | #1
On Sat, Aug 26, 2023 at 11:47:45PM +0800, Kemeng Shi wrote:
> The next_page is only used to forward page in case target is in second
> harf range. Move forward page directly to remove unnecessary next_page.

s/harf/half/

> 
> Signed-off-by: Kemeng Shi <shikemeng@huaweicloud.com>

Acked-by: Naoya Horiguchi <naoya.horiguchi@nec.com>

> ---
>  mm/page_alloc.c | 6 ++----
>  1 file changed, 2 insertions(+), 4 deletions(-)
> 
> diff --git a/mm/page_alloc.c b/mm/page_alloc.c
> index bb74b40dc195..1c35ee022dde 100644
> --- a/mm/page_alloc.c
> +++ b/mm/page_alloc.c
> @@ -6492,20 +6492,18 @@ static void break_down_buddy_pages(struct zone *zone, struct page *page,
>  				   int migratetype)
>  {
>  	unsigned long size = 1 << high;
> -	struct page *current_buddy, *next_page;
> +	struct page *current_buddy;
>  
>  	while (high > low) {
>  		high--;
>  		size >>= 1;
>  
>  		if (target >= &page[size]) {
> -			next_page = page + size;
>  			current_buddy = page;
> +			page = page + size;
>  		} else {
> -			next_page = page;
>  			current_buddy = page + size;
>  		}
> -		page = next_page;
>  
>  		if (set_page_guard(zone, current_buddy, high, migratetype))
>  			continue;
> -- 
> 2.30.0
> 
> 
>
diff mbox series

Patch

diff --git a/mm/page_alloc.c b/mm/page_alloc.c
index bb74b40dc195..1c35ee022dde 100644
--- a/mm/page_alloc.c
+++ b/mm/page_alloc.c
@@ -6492,20 +6492,18 @@  static void break_down_buddy_pages(struct zone *zone, struct page *page,
 				   int migratetype)
 {
 	unsigned long size = 1 << high;
-	struct page *current_buddy, *next_page;
+	struct page *current_buddy;
 
 	while (high > low) {
 		high--;
 		size >>= 1;
 
 		if (target >= &page[size]) {
-			next_page = page + size;
 			current_buddy = page;
+			page = page + size;
 		} else {
-			next_page = page;
 			current_buddy = page + size;
 		}
-		page = next_page;
 
 		if (set_page_guard(zone, current_buddy, high, migratetype))
 			continue;