Message ID | 20180719084842.11385-5-ying.huang@intel.com (mailing list archive) |
---|---|
State | New, archived |
Headers | show |
> static inline bool cluster_is_huge(struct swap_cluster_info *info) > { > - return info->flags & CLUSTER_FLAG_HUGE; > + if (IS_ENABLED(CONFIG_THP_SWAP)) > + return info->flags & CLUSTER_FLAG_HUGE; > + else > + return false; Nitpick: no need for an else after a return: if (IS_ENABLED(CONFIG_THP_SWAP)) return info->flags & CLUSTER_FLAG_HUGE; return false;
Christoph Hellwig <hch@infradead.org> writes: >> static inline bool cluster_is_huge(struct swap_cluster_info *info) >> { >> - return info->flags & CLUSTER_FLAG_HUGE; >> + if (IS_ENABLED(CONFIG_THP_SWAP)) >> + return info->flags & CLUSTER_FLAG_HUGE; >> + else >> + return false; > > Nitpick: no need for an else after a return: > > if (IS_ENABLED(CONFIG_THP_SWAP)) > return info->flags & CLUSTER_FLAG_HUGE; > return false; Sure. Will change this in next version. Best Regards, Huang, Ying
diff --git a/mm/swapfile.c b/mm/swapfile.c index cb0bc54e99c0..96018207b582 100644 --- a/mm/swapfile.c +++ b/mm/swapfile.c @@ -270,7 +270,10 @@ static inline void cluster_set_null(struct swap_cluster_info *info) static inline bool cluster_is_huge(struct swap_cluster_info *info) { - return info->flags & CLUSTER_FLAG_HUGE; + if (IS_ENABLED(CONFIG_THP_SWAP)) + return info->flags & CLUSTER_FLAG_HUGE; + else + return false; } static inline void cluster_clear_huge(struct swap_cluster_info *info) @@ -1493,9 +1496,6 @@ static bool swap_page_trans_huge_swapped(struct swap_info_struct *si, int i; bool ret = false; - if (!IS_ENABLED(CONFIG_THP_SWAP)) - return swap_swapcount(si, entry) != 0; - ci = lock_cluster_or_swap_info(si, offset); if (!ci || !cluster_is_huge(ci)) { if (swap_count(map[roffset]))