From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1756762AbcGIQAx (ORCPT ); Sat, 9 Jul 2016 12:00:53 -0400 Received: from out1134-201.mail.aliyun.com ([42.120.134.201]:19306 "EHLO out1134-201.mail.aliyun.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751539AbcGIQAw (ORCPT ); Sat, 9 Jul 2016 12:00:52 -0400 X-Greylist: delayed 303 seconds by postgrey-1.27 at vger.kernel.org; Sat, 09 Jul 2016 12:00:50 EDT X-Alimail-AntiSpam: AC=CONTINUE;BC=0.09903639|-1;FP=0|0|0|0|0|-1|-1|-1;HT=e02c03285;MF=chengang@emindsoft.com.cn;NM=1;PH=DS;RN=14;RT=13;SR=0;TI=SMTPD_----5.lkoAa_1468079708; From: chengang@emindsoft.com.cn To: akpm@linux-foundation.org, minchan@kernel.org, vbabka@suse.cz, mgorman@techsingularity.net, mhocko@suse.com Cc: gi-oh.kim@profitbricks.com, iamjoonsoo.kim@lge.com, hillf.zj@alibaba-inc.com, rientjes@google.com, linux-mm@kvack.org, linux-kernel@vger.kernel.org, Chen Gang , Chen Gang Subject: [PATCH] mm: migrate: Use bool instead of int for the return value of PageMovable Date: Sat, 9 Jul 2016 23:55:04 +0800 Message-Id: <1468079704-5477-1-git-send-email-chengang@emindsoft.com.cn> X-Mailer: git-send-email 1.9.3 Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Chen Gang 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 --- 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