diff mbox series

mm: remove BUG_ON() in __isolate_free_page()

Message ID 20220901015043.189276-1-wangkefeng.wang@huawei.com (mailing list archive)
State New
Headers show
Series mm: remove BUG_ON() in __isolate_free_page() | expand

Commit Message

Kefeng Wang Sept. 1, 2022, 1:50 a.m. UTC
Drop unneed comment and blank, adjust the variable, and the most
important is to delete BUG_ON(). The page passed is always buddy
page into __isolate_free_page() from compaction, page_isolation
and page_reporting, and the caller also check the return, BUG_ON()
is a too drastic measure, remove it.

Signed-off-by: Kefeng Wang <wangkefeng.wang@huawei.com>
---
 mm/page_alloc.c | 14 +++-----------
 1 file changed, 3 insertions(+), 11 deletions(-)

Comments

David Hildenbrand Sept. 1, 2022, 7:37 a.m. UTC | #1
On 01.09.22 03:50, Kefeng Wang wrote:
> Drop unneed comment and blank, adjust the variable, and the most
> important is to delete BUG_ON(). The page passed is always buddy
> page into __isolate_free_page() from compaction, page_isolation
> and page_reporting, and the caller also check the return, BUG_ON()
> is a too drastic measure, remove it.

Why not WARN_ON_ONCE then? But yeah, maybe this really isn't of any
value anymore.
Kefeng Wang Sept. 1, 2022, 8 a.m. UTC | #2
On 2022/9/1 15:37, David Hildenbrand wrote:
> On 01.09.22 03:50, Kefeng Wang wrote:
>> Drop unneed comment and blank, adjust the variable, and the most
>> important is to delete BUG_ON(). The page passed is always buddy
>> page into __isolate_free_page() from compaction, page_isolation
>> and page_reporting, and the caller also check the return, BUG_ON()
>> is a too drastic measure, remove it.
> Why not WARN_ON_ONCE then? But yeah, maybe this really isn't of any
> value anymore.

or VM_WARN_ON(), but I think this bug_on is useless after check all 
calllers,

so let's drop it if no objection.
diff mbox series

Patch

diff --git a/mm/page_alloc.c b/mm/page_alloc.c
index 9f2e250c2589..7ad0c7b14ad2 100644
--- a/mm/page_alloc.c
+++ b/mm/page_alloc.c
@@ -3600,16 +3600,11 @@  EXPORT_SYMBOL_GPL(split_page);
 
 int __isolate_free_page(struct page *page, unsigned int order)
 {
-	unsigned long watermark;
-	struct zone *zone;
-	int mt;
-
-	BUG_ON(!PageBuddy(page));
-
-	zone = page_zone(page);
-	mt = get_pageblock_migratetype(page);
+	struct zone *zone = page_zone(page);
+	int mt = get_pageblock_migratetype(page);
 
 	if (!is_migrate_isolate(mt)) {
+		unsigned long watermark;
 		/*
 		 * Obey watermarks as if the page was being allocated. We can
 		 * emulate a high-order watermark check with a raised order-0
@@ -3623,8 +3618,6 @@  int __isolate_free_page(struct page *page, unsigned int order)
 		__mod_zone_freepage_state(zone, -(1UL << order), mt);
 	}
 
-	/* Remove page from free list */
-
 	del_page_from_free_list(page, zone, order);
 
 	/*
@@ -3645,7 +3638,6 @@  int __isolate_free_page(struct page *page, unsigned int order)
 		}
 	}
 
-
 	return 1UL << order;
 }