linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] mm/page_alloc: use free_area_empty() instead of open-coding
@ 2020-03-08 12:01 qiwuchen55
  2020-03-08 12:29 ` Matthew Wilcox
  0 siblings, 1 reply; 3+ messages in thread
From: qiwuchen55 @ 2020-03-08 12:01 UTC (permalink / raw)
  To: akpm; +Cc: linux-mm, chenqiwu

From: chenqiwu <chenqiwu@xiaomi.com>

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

Signed-off-by: chenqiwu <chenqiwu@xiaomi.com>
---
 mm/page_alloc.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/mm/page_alloc.c b/mm/page_alloc.c
index 79e950d..6ae7142 100644
--- a/mm/page_alloc.c
+++ b/mm/page_alloc.c
@@ -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;
-- 
1.9.1



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

* Re: [PATCH] mm/page_alloc: use free_area_empty() instead of open-coding
  2020-03-08 12:01 [PATCH] mm/page_alloc: use free_area_empty() instead of open-coding qiwuchen55
@ 2020-03-08 12:29 ` Matthew Wilcox
  2020-03-08 13:27   ` chenqiwu
  0 siblings, 1 reply; 3+ messages in thread
From: Matthew Wilcox @ 2020-03-08 12:29 UTC (permalink / raw)
  To: qiwuchen55; +Cc: akpm, linux-mm, chenqiwu

On Sun, Mar 08, 2020 at 08:01:45PM +0800, qiwuchen55@gmail.com wrote:
>  		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.


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

* Re: [PATCH] mm/page_alloc: use free_area_empty() instead of open-coding
  2020-03-08 12:29 ` Matthew Wilcox
@ 2020-03-08 13:27   ` chenqiwu
  0 siblings, 0 replies; 3+ messages in thread
From: chenqiwu @ 2020-03-08 13:27 UTC (permalink / raw)
  To: Matthew Wilcox; +Cc: akpm, linux-mm, chenqiwu

On Sun, Mar 08, 2020 at 05:29:55AM -0700, Matthew Wilcox wrote:
> On Sun, Mar 08, 2020 at 08:01:45PM +0800, qiwuchen55@gmail.com wrote:
> >  		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


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

end of thread, other threads:[~2020-03-08 13:27 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-03-08 12:01 [PATCH] mm/page_alloc: use free_area_empty() instead of open-coding qiwuchen55
2020-03-08 12:29 ` Matthew Wilcox
2020-03-08 13:27   ` chenqiwu

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).