linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] mm: migrate: Use bool instead of int for the return value of PageMovable
@ 2016-07-09 15:55 chengang
  2016-07-11  0:26 ` Minchan Kim
  0 siblings, 1 reply; 9+ messages in thread
From: chengang @ 2016-07-09 15:55 UTC (permalink / raw)
  To: akpm, minchan, vbabka, mgorman, mhocko
  Cc: gi-oh.kim, iamjoonsoo.kim, hillf.zj, rientjes, linux-mm,
	linux-kernel, Chen Gang, Chen Gang

From: Chen Gang <chengang@emindsoft.com.cn>

For pure bool function's return value, bool is a little better more or
less than int.

And return boolean result directly, since 'if' statement is also for
boolean checking, and return boolean result, too.

Signed-off-by: Chen Gang <gang.chen.5i5j@gmail.com>
---
 include/linux/migrate.h | 4 ++--
 mm/compaction.c         | 9 +++------
 2 files changed, 5 insertions(+), 8 deletions(-)

diff --git a/include/linux/migrate.h b/include/linux/migrate.h
index ae8d475..0e366f8 100644
--- a/include/linux/migrate.h
+++ b/include/linux/migrate.h
@@ -72,11 +72,11 @@ static inline int migrate_huge_page_move_mapping(struct address_space *mapping,
 #endif /* CONFIG_MIGRATION */
 
 #ifdef CONFIG_COMPACTION
-extern int PageMovable(struct page *page);
+extern bool PageMovable(struct page *page);
 extern void __SetPageMovable(struct page *page, struct address_space *mapping);
 extern void __ClearPageMovable(struct page *page);
 #else
-static inline int PageMovable(struct page *page) { return 0; };
+static inline bool PageMovable(struct page *page) { return false; };
 static inline void __SetPageMovable(struct page *page,
 				struct address_space *mapping)
 {
diff --git a/mm/compaction.c b/mm/compaction.c
index 0bd53fb..cfcfe88 100644
--- a/mm/compaction.c
+++ b/mm/compaction.c
@@ -95,19 +95,16 @@ static inline bool migrate_async_suitable(int migratetype)
 
 #ifdef CONFIG_COMPACTION
 
-int PageMovable(struct page *page)
+bool PageMovable(struct page *page)
 {
 	struct address_space *mapping;
 
 	VM_BUG_ON_PAGE(!PageLocked(page), page);
 	if (!__PageMovable(page))
-		return 0;
+		return false;
 
 	mapping = page_mapping(page);
-	if (mapping && mapping->a_ops && mapping->a_ops->isolate_page)
-		return 1;
-
-	return 0;
+	return mapping && mapping->a_ops && mapping->a_ops->isolate_page;
 }
 EXPORT_SYMBOL(PageMovable);
 
-- 
1.9.3

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

end of thread, other threads:[~2016-07-17  0:50 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-07-09 15:55 [PATCH] mm: migrate: Use bool instead of int for the return value of PageMovable chengang
2016-07-11  0:26 ` Minchan Kim
2016-07-11 19:47   ` Chen Gang
2016-07-12  7:15     ` Vlastimil Babka
2016-07-12 16:42       ` Chen Gang
2016-07-12  7:48     ` Michal Hocko
2016-07-12 16:50       ` Chen Gang
2016-07-13  7:53         ` Michal Hocko
2016-07-17  0:51           ` Chen Gang

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).