Skip to contentSkip to conversation

mm/page_alloc: use free_area_empty() instead of open-coding

PATCH Superseded [email protected] 2 participants 3 messages Mar 8, 2020

Subsystems (2)

v1 of 2 Superseded Latest is v2 →

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 mm/page_alloc: use free_area_empty() instead of open-coding

From: chenqiwu <[email protected]>

Use free_area_empty() API to replace list_empty() for better code readability.

---
 mm/page_alloc.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
mm/page_alloc.c +1 -1
index 79e950d..6ae7142 100644
@@ -3534,7 +3534,7 @@ bool __zone_watermark_ok(struct zone *z, unsigned int order, unsigned long mark,
 		}
 #endif
 		if (alloc_harder &&
-			!list_empty(&area->free_list[MIGRATE_HIGHATOMIC]))
+		    !free_area_empty(area, MIGRATE_HIGHATOMIC))
 			return true;
 	}
 	return false;
Signature · 1 line
1.9.1
#1 lore raw

mm/page_alloc.c bool __zone_watermark_ok(struct zone *z, unsigned int order, unsigned long mark, · line 3537

Quoted 3 lines · On Sun, Mar 08, 2020 at 08:01:45PM +0800, [email protected] wrote:
mm/page_alloc.c +1 -1
 		if (alloc_harder &&
-			!list_empty(&area->free_list[MIGRATE_HIGHATOMIC]))
+		    !free_area_empty(area, MIGRATE_HIGHATOMIC))

I think these can now be one line?

Also, I think free_area_empty() and a number of related functions can move from mmzone.h to mm/internal.h. This will benefit all of us since mmzone.h is included from mm.h and so is widely seen throughout the kernel.

author
#2 lore raw
Quoted 10 lines · Matthew Wilcox

mm/page_alloc.c bool __zone_watermark_ok(struct zone *z, unsigned int order, unsigned long mark, · line 3537

Quoted 3 lines · On Sun, Mar 08, 2020 at 08:01:45PM +0800, [email protected] wrote:
mm/page_alloc.c +1 -1
 		if (alloc_harder &&
-			!list_empty(&area->free_list[MIGRATE_HIGHATOMIC]))
+		    !free_area_empty(area, MIGRATE_HIGHATOMIC))

I think these can now be one line?

Also, I think free_area_empty() and a number of related functions can move from mmzone.h to mm/internal.h. This will benefit all of us since mmzone.h is included from mm.h and so is widely seen throughout the kernel.

I agree.
Qiwu