linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
* [PATCH -next] mm/vmscan: fix some -Wenum-conversion warnings
@ 2019-11-15 14:04 Qian Cai
  2019-11-15 16:17 ` Johannes Weiner
  0 siblings, 1 reply; 3+ messages in thread
From: Qian Cai @ 2019-11-15 14:04 UTC (permalink / raw)
  To: akpm; +Cc: hannes, surenb, linux-mm, linux-kernel, Qian Cai

The -next commit "mm: vmscan: enforce inactive:active ratio at the
reclaim root" [1] introduced some GCC -Wenum-conversion warnings,

mm/vmscan.c:2216:39: warning: implicit conversion from enumeration type
'enum lru_list' to different enumeration type 'enum node_stat_item'
[-Wenum-conversion]
        inactive = lruvec_page_state(lruvec, inactive_lru);
                   ~~~~~~~~~~~~~~~~~         ^~~~~~~~~~~~
mm/vmscan.c:2217:37: warning: implicit conversion from enumeration type
'enum lru_list' to different enumeration type 'enum node_stat_item'
[-Wenum-conversion]
        active = lruvec_page_state(lruvec, active_lru);
                 ~~~~~~~~~~~~~~~~~         ^~~~~~~~~~
mm/vmscan.c:2746:42: warning: implicit conversion from enumeration type
'enum lru_list' to different enumeration type 'enum node_stat_item'
[-Wenum-conversion]
        file = lruvec_page_state(target_lruvec, LRU_INACTIVE_FILE);
               ~~~~~~~~~~~~~~~~~                ^~~~~~~~~~~~~~~~~

Fix them by adding casts where it is safe.

[1] http://lkml.kernel.org/r/20191107205334.158354-4-hannes@cmpxchg.org

Signed-off-by: Qian Cai <cai@lca.pw>
---
 mm/vmscan.c | 8 +++++---
 1 file changed, 5 insertions(+), 3 deletions(-)

diff --git a/mm/vmscan.c b/mm/vmscan.c
index 122b3920aaa4..16c005ddfd9e 100644
--- a/mm/vmscan.c
+++ b/mm/vmscan.c
@@ -2213,8 +2213,9 @@ static bool inactive_is_low(struct lruvec *lruvec, enum lru_list inactive_lru)
 	unsigned long inactive_ratio;
 	unsigned long gb;
 
-	inactive = lruvec_page_state(lruvec, inactive_lru);
-	active = lruvec_page_state(lruvec, active_lru);
+	inactive = lruvec_page_state(lruvec,
+				     (enum node_stat_item)inactive_lru);
+	active = lruvec_page_state(lruvec, (enum node_stat_item)active_lru);
 
 	gb = (inactive + active) >> (30 - PAGE_SHIFT);
 	if (gb)
@@ -2743,7 +2744,8 @@ static bool shrink_node(pg_data_t *pgdat, struct scan_control *sc)
 	 * thrashing, try to reclaim those first before touching
 	 * anonymous pages.
 	 */
-	file = lruvec_page_state(target_lruvec, LRU_INACTIVE_FILE);
+	file = lruvec_page_state(target_lruvec,
+				 (enum node_stat_item)LRU_INACTIVE_FILE);
 	if (file >> sc->priority && !(sc->may_deactivate & DEACTIVATE_FILE))
 		sc->cache_trim_mode = 1;
 	else
-- 
1.8.3.1



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

end of thread, other threads:[~2019-11-15 16:22 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-11-15 14:04 [PATCH -next] mm/vmscan: fix some -Wenum-conversion warnings Qian Cai
2019-11-15 16:17 ` Johannes Weiner
2019-11-15 16:22   ` Qian Cai

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox