linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
* 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'
       [not found] <201911160531.VrqGMTij%lkp@intel.com>
@ 2019-11-18 18:19 ` Nick Desaulniers
  2019-11-18 18:28   ` Johannes Weiner
  0 siblings, 1 reply; 3+ messages in thread
From: Nick Desaulniers @ 2019-11-18 18:19 UTC (permalink / raw)
  To: Johannes Weiner
  Cc: kbuild, clang-built-linux, kbuild-all, kbuild test robot,
	Suren Baghdasaryan, Andrew Morton, Linux Memory Management List

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 <lkp@intel.com> wrote:
>
> CC: kbuild-all@lists.01.org
> TO: Johannes Weiner <hannes@cmpxchg.org>
> CC: Suren Baghdasaryan <surenb@google.com>
> CC: Andrew Morton <akpm@linux-foundation.org>
> CC: Linux Memory Management List <linux-mm@kvack.org>
>
> 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 <lkp@intel.com>
>
> 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


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

* 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'
  2019-11-18 18:19 ` [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' Nick Desaulniers
@ 2019-11-18 18:28   ` Johannes Weiner
  2019-11-18 18:33     ` Nick Desaulniers
  0 siblings, 1 reply; 3+ messages in thread
From: Johannes Weiner @ 2019-11-18 18:28 UTC (permalink / raw)
  To: Nick Desaulniers
  Cc: kbuild, clang-built-linux, kbuild-all, kbuild test robot,
	Suren Baghdasaryan, Andrew Morton, Linux Memory Management List

Hello Nick,

On Mon, Nov 18, 2019 at 10:19:52AM -0800, Nick Desaulniers wrote:
> 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 <lkp@intel.com> wrote:
> >
> > CC: kbuild-all@lists.01.org
> > TO: Johannes Weiner <hannes@cmpxchg.org>
> > CC: Suren Baghdasaryan <surenb@google.com>
> > CC: Andrew Morton <akpm@linux-foundation.org>
> > CC: Linux Memory Management List <linux-mm@kvack.org>
> >
> > 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 <lkp@intel.com>
> >
> > 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);
> >                   ~~~~~~~~~~~~~~~~~                ^~~~~~~~~~~~~~~~~

A fix for this has been sent out and should make its way into into -next soon:
https://lore.kernel.org/linux-mm/1573848697-29262-1-git-send-email-cai@lca.pw/


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

* 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'
  2019-11-18 18:28   ` Johannes Weiner
@ 2019-11-18 18:33     ` Nick Desaulniers
  0 siblings, 0 replies; 3+ messages in thread
From: Nick Desaulniers @ 2019-11-18 18:33 UTC (permalink / raw)
  To: Johannes Weiner
  Cc: kbuild, clang-built-linux, kbuild-all, kbuild test robot,
	Suren Baghdasaryan, Andrew Morton, Linux Memory Management List,
	Qian Cai

On Mon, Nov 18, 2019 at 10:28 AM Johannes Weiner <hannes@cmpxchg.org> wrote:
>
> Hello Nick,
>
> On Mon, Nov 18, 2019 at 10:19:52AM -0800, Nick Desaulniers wrote:
> > 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 <lkp@intel.com> wrote:
> > >
> > > CC: kbuild-all@lists.01.org
> > > TO: Johannes Weiner <hannes@cmpxchg.org>
> > > CC: Suren Baghdasaryan <surenb@google.com>
> > > CC: Andrew Morton <akpm@linux-foundation.org>
> > > CC: Linux Memory Management List <linux-mm@kvack.org>
> > >
> > > 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 <lkp@intel.com>
> > >
> > > 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);
> > >                   ~~~~~~~~~~~~~~~~~                ^~~~~~~~~~~~~~~~~
>
> A fix for this has been sent out and should make its way into into -next soon:
> https://lore.kernel.org/linux-mm/1573848697-29262-1-git-send-email-cai@lca.pw/

Great, thank you, and sorry for the noise.
-- 
Thanks,
~Nick Desaulniers


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

end of thread, other threads:[~2019-11-18 18:33 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
     [not found] <201911160531.VrqGMTij%lkp@intel.com>
2019-11-18 18:19 ` [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' Nick Desaulniers
2019-11-18 18:28   ` Johannes Weiner
2019-11-18 18:33     ` Nick Desaulniers

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