Received: by 2002:a25:7ec1:0:0:0:0:0 with SMTP id z184csp4928659ybc; Fri, 15 Nov 2019 12:14:07 -0800 (PST) X-Google-Smtp-Source: APXvYqwJRU5rr/ZTS+MErbLddaMBIhn+c/j56fEA1y6I0F2uVf10H8zIA8MBxcYnMVA9JMMXG11r X-Received: by 2002:a17:906:8319:: with SMTP id j25mr3347523ejx.170.1573848847463; Fri, 15 Nov 2019 12:14:07 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1573848847; cv=none; d=google.com; s=arc-20160816; b=VbCBcxNEAtBDtgn/2w2n5O/DIYK3muNy171Px9omTsdYzU9hwzsoNMx7IJBGwmZaqw TjnkH/jAntP0UPPk3B7ZGXeb3WdCb/PVFKiru1IpoX3TFqR8uxwDAt9vMt9rJP0U1oTS OGpo6jFhRIdYBG8Mp9d/re/UCp/VThkSXyxn3CVqQXyCnG6Qsu4QCsj/Hrjf7gO4APAY KOjeEuTujiB5z7b87PHHTu/07ofP6uznIB529odhPlNWq1c3L5ueY4747uKEPgBDRLjL jya0QLoxjHDDyCldlYx3HBFxo6hqtk3V/6OTbge/3dG8PE9kHiwPUzB/TlHaAKihVuTb fVqw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:message-id:date:subject:cc:to:from :dkim-signature; bh=rK+VrpxQV4ZTcM3wBx6WIAo16VtCG97yuNEHzYaGRMU=; b=U3BUkWFHxdgJpr7ZQWRN5lLoYYhsT+4RselJ5JSOU0xnt8KaIvRNcpvwh3Ttv0FiC4 fGzfZydbIUoa++TG+TP5IjG/13FTJ/a0KoLT1Y96Gsbkm3HKlUZ2Vqn6qADwVBjOnZwP YZvY7V2zR7ZuW85aCeQckEhKunQ+p0bbwdQxg601LKMMxOijnWhoDWwXbV41xFBIJc7Z yKhzcYQGyLA4dyU2UGJ0BTlpSRwT9zUs64sedSGJIc5WxAJiGX0eDhNQ0tZLbR/tZFf2 XUFtaJaACl/S/k+WuBwLrnKks7i/1NAv0mgN/0PsWE4qN56xfUtvmUZHqz/ctpTX+bRL bU9g== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@lca.pw header.s=google header.b="Fae3n/Du"; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id k26si6342622eja.58.2019.11.15.12.13.42; Fri, 15 Nov 2019 12:14:07 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@lca.pw header.s=google header.b="Fae3n/Du"; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726992AbfKOULt (ORCPT + 99 others); Fri, 15 Nov 2019 15:11:49 -0500 Received: from mail-qk1-f193.google.com ([209.85.222.193]:36460 "EHLO mail-qk1-f193.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726323AbfKOULt (ORCPT ); Fri, 15 Nov 2019 15:11:49 -0500 Received: by mail-qk1-f193.google.com with SMTP id d13so9113808qko.3 for ; Fri, 15 Nov 2019 12:11:48 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=lca.pw; s=google; h=from:to:cc:subject:date:message-id; bh=rK+VrpxQV4ZTcM3wBx6WIAo16VtCG97yuNEHzYaGRMU=; b=Fae3n/DuTYTPRHB4hSz3cMXShYJQZSWaZ4R8pe8ItWpRUgKDRs22e+z3iKUqdTs2St r4G9QamAQcxlLYvzs2fII7SPvTkl+qu97rE/XURhL/zMW+FABXHZCDFF6n54HpE1ehoL BxBrzXgtmlRJZhtOh/RDFfuE9Q5hSFWvLgD1tyYTeOn/0+g3CPu46H0tBBMQXWOU6f64 HagAQS8mVQrLugSBdLnqFmr8PYpwX5Iq8Rj0v2pCgy6g20clMPQhdhtxJSFLgm/0cyPL 8au7DIzvzxqx9258O4VoWmfPV+0XPl+YUCPeP/iCiWXr0xYWfyi8XnFZRsaV2g32P2WG 8wsA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id; bh=rK+VrpxQV4ZTcM3wBx6WIAo16VtCG97yuNEHzYaGRMU=; b=nQDjrZi+3hhPB48nhfHaa/MIlKt/dqLkI/qnA3RK9j04sZ1Vf3Cn/7KsyXr2ByLT6J /HOz7dcpHsWtwx5eGxU2JNfrASrWuECb9Zip/ubDCxcPzA2T9QxFCZQBwhn/oOErjwUX b/9sn7b56muAC22KmQDPC+KsYclmDbZjJO5hVfnVtWbwLDIKg/i41zXD0SGOSzXV7QyE bjLFEGl/ObqC3qUfoipXNa5cKqiKKylR/utyVDT2zB42LHQXO+kO6CU/VHeDrqM5XC9C XDC6ZPDpfkjayTiYricxEsil0vWSENNkUpdqkATfnTgeNmK2fxyR7hVzATaXdhD6CrMX 8hHw== X-Gm-Message-State: APjAAAWUvxKR2RS6q2H+pZR4mUzPBapU7/oh9eLf7vsiM4XvFZbmBQlH U+KqisQ0L2K0NqPEQtBtI4+Qmg== X-Received: by 2002:a37:a5d3:: with SMTP id o202mr13122947qke.283.1573848707981; Fri, 15 Nov 2019 12:11:47 -0800 (PST) Received: from qcai.nay.com (nat-pool-bos-t.redhat.com. [66.187.233.206]) by smtp.gmail.com with ESMTPSA id m13sm4612267qka.109.2019.11.15.12.11.46 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 15 Nov 2019 12:11:47 -0800 (PST) From: Qian Cai To: akpm@linux-foundation.org Cc: hannes@cmpxchg.org, surenb@google.com, linux-mm@kvack.org, linux-kernel@vger.kernel.org, Qian Cai Subject: [PATCH -next v2] mm/vmscan: fix some -Wenum-conversion warnings Date: Fri, 15 Nov 2019 15:11:37 -0500 Message-Id: <1573848697-29262-1-git-send-email-cai@lca.pw> X-Mailer: git-send-email 1.8.3.1 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org The -next commit "mm: vmscan: enforce inactive:active ratio at the reclaim root" [1] introduced some Clang -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); ~~~~~~~~~~~~~~~~~ ^~~~~~~~~~~~~~~~~ Since it guarantees the relative order between the LRU items, fix it by using NR_LRU_BASE for the translation. [1] http://lkml.kernel.org/r/20191107205334.158354-4-hannes@cmpxchg.org Signed-off-by: Qian Cai --- v2: use NR_LRU_BASE/NR_INACTIVE_FILE per Johannes. mm/vmscan.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/mm/vmscan.c b/mm/vmscan.c index 122b3920aaa4..c8e88f4d9932 100644 --- a/mm/vmscan.c +++ b/mm/vmscan.c @@ -2213,8 +2213,8 @@ 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, NR_LRU_BASE + inactive_lru); + active = lruvec_page_state(lruvec, NR_LRU_BASE + active_lru); gb = (inactive + active) >> (30 - PAGE_SHIFT); if (gb) @@ -2743,7 +2743,7 @@ 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, NR_INACTIVE_FILE); if (file >> sc->priority && !(sc->may_deactivate & DEACTIVATE_FILE)) sc->cache_trim_mode = 1; else -- 1.8.3.1