linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
* [PATCH v2 1/2] mm/page_alloc: remove unnecessary check in break_down_buddy_pages
       [not found] <20230927103514.98281-1-shikemeng@huaweicloud.com>
@ 2023-09-27 10:35 ` Kemeng Shi
  2023-09-27 10:35 ` [PATCH v2 2/2] mm/page_alloc: remove unnecessary next_page " Kemeng Shi
  1 sibling, 0 replies; 2+ messages in thread
From: Kemeng Shi @ 2023-09-27 10:35 UTC (permalink / raw)
  To: akpm, naoya.horiguchi, osalvador, willy; +Cc: linux-mm, linux-kernel

1. We always have target in range started with next_page and full free
range started with current_buddy.
2. The last split range size is 1 << low and low should be >= 0, then
size >= 1. So page + size != page is always true (because size > 0).
As summary, current_page will not equal to target page.

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 e18e0e20eff8..bad979493dde 100644
--- a/mm/page_alloc.c
+++ b/mm/page_alloc.c
@@ -6696,10 +6696,8 @@ static void break_down_buddy_pages(struct zone *zone, struct page *page,
 		if (set_page_guard(zone, current_buddy, high, migratetype))
 			continue;
 
-		if (current_buddy != target) {
-			add_to_free_list(current_buddy, zone, high, migratetype);
-			set_buddy_order(current_buddy, high);
-		}
+		add_to_free_list(current_buddy, zone, high, migratetype);
+		set_buddy_order(current_buddy, high);
 	}
 }
 
-- 
2.30.0



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

* [PATCH v2 2/2] mm/page_alloc: remove unnecessary next_page in break_down_buddy_pages
       [not found] <20230927103514.98281-1-shikemeng@huaweicloud.com>
  2023-09-27 10:35 ` [PATCH v2 1/2] mm/page_alloc: remove unnecessary check in break_down_buddy_pages Kemeng Shi
@ 2023-09-27 10:35 ` Kemeng Shi
  1 sibling, 0 replies; 2+ messages in thread
From: Kemeng Shi @ 2023-09-27 10:35 UTC (permalink / raw)
  To: akpm, naoya.horiguchi, osalvador, willy; +Cc: linux-mm, linux-kernel

The next_page is only used to forward page in case target is in second
half range. Move forward page directly to remove unnecessary next_page.

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 bad979493dde..7df77b58a961 100644
--- a/mm/page_alloc.c
+++ b/mm/page_alloc.c
@@ -6678,20 +6678,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



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

end of thread, other threads:[~2023-09-27  2:51 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
     [not found] <20230927103514.98281-1-shikemeng@huaweicloud.com>
2023-09-27 10:35 ` [PATCH v2 1/2] mm/page_alloc: remove unnecessary check in break_down_buddy_pages Kemeng Shi
2023-09-27 10:35 ` [PATCH v2 2/2] mm/page_alloc: remove unnecessary next_page " Kemeng Shi

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