From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-13.3 required=3.0 tests=DKIMWL_WL_MED,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI, MENTIONS_GIT_HOSTING,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED,USER_IN_DEF_DKIM_WL autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id A8C2BC432C0 for ; Mon, 18 Nov 2019 18:20:06 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id 52EC2222AC for ; Mon, 18 Nov 2019 18:20:06 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=google.com header.i=@google.com header.b="LOmfDMUE" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 52EC2222AC Authentication-Results: mail.kernel.org; dmarc=fail (p=reject dis=none) header.from=google.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=owner-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix) id B15386B0003; Mon, 18 Nov 2019 13:20:05 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id AC6A36B0006; Mon, 18 Nov 2019 13:20:05 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 9DB586B0007; Mon, 18 Nov 2019 13:20:05 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0043.hostedemail.com [216.40.44.43]) by kanga.kvack.org (Postfix) with ESMTP id 84F186B0003 for ; Mon, 18 Nov 2019 13:20:05 -0500 (EST) Received: from smtpin12.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay04.hostedemail.com (Postfix) with SMTP id 35B425DF9 for ; Mon, 18 Nov 2019 18:20:05 +0000 (UTC) X-FDA: 76170212370.12.soda98_1dc9b0b41a454 X-HE-Tag: soda98_1dc9b0b41a454 X-Filterd-Recvd-Size: 7906 Received: from mail-pl1-f193.google.com (mail-pl1-f193.google.com [209.85.214.193]) by imf04.hostedemail.com (Postfix) with ESMTP for ; Mon, 18 Nov 2019 18:20:04 +0000 (UTC) Received: by mail-pl1-f193.google.com with SMTP id w7so10219271plz.12 for ; Mon, 18 Nov 2019 10:20:04 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20161025; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=xHxaepY/XsExcaoO9ZBZCDqbAjqKRJghjQ9vW9q/pQY=; b=LOmfDMUEAssjbfLI9x7+vfR3vpfhzGbhVkwoIghllIc4aOQMTrHlq5mXnwujpgdvvH 5IbzUe1n3OZgXoYib1raFohMcx4urU2QZvgYkxNgvCd3CSO8ZX5v427VYnrLMh17ygLQ I+s+P3SlDXe+Yd0I3446W0WVuNSQckTh39AnxGCTsMfkZMaFUhZxFCos/Mo0kHlXJm1N cUtknw2XBmE0SEaXy/7s8/fv9VhV2zgaOG5Cls9E7MLdN6WcurKsO7Bd/ujYx8FoZ43G h5NIHsGzqqynQhA2A0awPzjtZhtPN5vIwPwTrica/gUFF3triicMQmc8Gj6tiwJt2QOi Pk2Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=xHxaepY/XsExcaoO9ZBZCDqbAjqKRJghjQ9vW9q/pQY=; b=bjQjaIVvH7tVeUnkajEdT+rpwoY76D+OzT2ClhKZ3JyEQjpBEZWJNSvtKew3htNfYb cqxni3qV4TPWkpEQpVpPlAPqdfcvj1HMAp+I9/icbo55xHeY688dxaaXVLn4CNhWsJzu mtLliSBhNMxKd9pLDbbyYVzzVD/v1kdQiKmPW5rPWZYbHrBBsNHFWXGWwAVzESnjRoUi PShVQYdx3Ni7FRIWXxEvlqWoSID/O8kTKNxe0c76yb3qIu7+uz67z8aATIQGb8xKnXS0 /9ZqjKxMYoHgnIovyLiRnGLY8ehvEBX96Y37g33B4oZHB4rSUw8MSvMG7HFuPKx0I8Wt H6mQ== X-Gm-Message-State: APjAAAXSvVy07mal3mOd/ttgTBr7vUdAzbAeBp4EAdEXx0CNNUq9mj1f mpfF5buzgFEXdLhyOiH0KrdJViNHdWQUHYX0bM0ETQ== X-Google-Smtp-Source: APXvYqy1MtAIV3PPN4zCEPWGsKj8kXrsiivbyIpLLOFC6BcclyB3iGels4ow3fLEWepsytg5/OafSY8dxKo7foduWi4= X-Received: by 2002:a17:90a:be05:: with SMTP id a5mr387048pjs.73.1574101202963; Mon, 18 Nov 2019 10:20:02 -0800 (PST) MIME-Version: 1.0 References: <201911160531.VrqGMTij%lkp@intel.com> In-Reply-To: <201911160531.VrqGMTij%lkp@intel.com> From: Nick Desaulniers Date: Mon, 18 Nov 2019 10:19:52 -0800 Message-ID: Subject: Re: [linux-next:master 11878/12136] mm/vmscan.c:2216:39: warning: implicit conversion from enumeration type 'enum lru_list' to different enumeration type 'enum node_stat_item' To: Johannes Weiner Cc: kbuild@lists.01.org, clang-built-linux , kbuild-all@lists.01.org, kbuild test robot , Suren Baghdasaryan , Andrew Morton , Linux Memory Management List Content-Type: text/plain; charset="UTF-8" X-Bogosity: Ham, tests=bogofilter, spamicity=0.000000, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: Hi Johannes, Below is a 0day report from a build with Clang, can you please take a look? On Fri, Nov 15, 2019 at 1:44 PM kbuild test robot wrote: > > CC: kbuild-all@lists.01.org > TO: Johannes Weiner > CC: Suren Baghdasaryan > CC: Andrew Morton > CC: Linux Memory Management List > > tree: https://git.kernel.org/pub/scm/linux/kernel/git/next/linux-next.git master > head: 5a6fcbeabe3e20459ed8504690b2515dacc5246f > commit: 07976d367592d6613370c93706795b4ebc0850f1 [11878/12136] mm: vmscan: enforce inactive:active ratio at the reclaim root > config: arm64-defconfig (attached as .config) > compiler: clang version 10.0.0 (git://gitmirror/llvm_project f7e9d81a8e222f3c9d4f57e0817f19bbb795e5b6) > reproduce: > wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross > chmod +x ~/bin/make.cross > git checkout 07976d367592d6613370c93706795b4ebc0850f1 > # save the attached .config to linux build tree > make.cross ARCH=arm64 > > If you fix the issue, kindly add following tag > Reported-by: kbuild test robot > > All warnings (new ones prefixed by >>): > > >> 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); > ~~~~~~~~~~~~~~~~~ ^~~~~~~~~~~~~~~~~ > 3 warnings generated. > > vim +2216 mm/vmscan.c > > 2180 > 2181 /* > 2182 * The inactive anon list should be small enough that the VM never has > 2183 * to do too much work. > 2184 * > 2185 * The inactive file list should be small enough to leave most memory > 2186 * to the established workingset on the scan-resistant active list, > 2187 * but large enough to avoid thrashing the aggregate readahead window. > 2188 * > 2189 * Both inactive lists should also be large enough that each inactive > 2190 * page has a chance to be referenced again before it is reclaimed. > 2191 * > 2192 * If that fails and refaulting is observed, the inactive list grows. > 2193 * > 2194 * The inactive_ratio is the target ratio of ACTIVE to INACTIVE pages > 2195 * on this LRU, maintained by the pageout code. An inactive_ratio > 2196 * of 3 means 3:1 or 25% of the pages are kept on the inactive list. > 2197 * > 2198 * total target max > 2199 * memory ratio inactive > 2200 * ------------------------------------- > 2201 * 10MB 1 5MB > 2202 * 100MB 1 50MB > 2203 * 1GB 3 250MB > 2204 * 10GB 10 0.9GB > 2205 * 100GB 31 3GB > 2206 * 1TB 101 10GB > 2207 * 10TB 320 32GB > 2208 */ > 2209 static bool inactive_is_low(struct lruvec *lruvec, enum lru_list inactive_lru) > 2210 { > 2211 enum lru_list active_lru = inactive_lru + LRU_ACTIVE; > 2212 unsigned long inactive, active; > 2213 unsigned long inactive_ratio; > 2214 unsigned long gb; > 2215 > > 2216 inactive = lruvec_page_state(lruvec, inactive_lru); > 2217 active = lruvec_page_state(lruvec, active_lru); Look like lruvec_page_state() defined in include/linux/memcontrol.h takes an `enum node_stat_item` for its second parameter, but `enum lru_list`'s are being passed instead? I see what's going on with the definitions, but a function should be used to safely convert between the two different enums in case their definitions ever change, otherwise we'll continue to see this warning. > 2218 > 2219 gb = (inactive + active) >> (30 - PAGE_SHIFT); > 2220 if (gb) > 2221 inactive_ratio = int_sqrt(10 * gb); > 2222 else > 2223 inactive_ratio = 1; > 2224 > 2225 return inactive * inactive_ratio < active; > 2226 } > 2227 > > --- > 0-DAY kernel test infrastructure Open Source Technology Center > https://lists.01.org/hyperkitty/list/kbuild-all@lists.01.org Intel Corporation -- Thanks, ~Nick Desaulniers