linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
From: Juan Yescas <jyescas@google.com>
To: kernel test robot <lkp@intel.com>
Cc: oe-kbuild-all@lists.linux.dev,
	Andrew Morton <akpm@linux-foundation.org>,
	 Linux Memory Management List <linux-mm@kvack.org>
Subject: Re: [akpm-mm:mm-unstable 333/334] include/linux/mmzone.h:1816:8: warning: left shift count is negative
Date: Fri, 9 May 2025 13:43:33 -0700	[thread overview]
Message-ID: <CAJDx_rg6QHsLK8=i-6D5=B=OL50-RUPP=e9JZgRiAfE3sgwRMg@mail.gmail.com> (raw)
In-Reply-To: <202505091548.FuKO4b4v-lkp@intel.com>

On Fri, May 9, 2025 at 12:49 AM kernel test robot <lkp@intel.com> wrote:
>
> tree:   https://git.kernel.org/pub/scm/linux/kernel/git/akpm/mm.git mm-unstable
> head:   930c125f685d7e8eef566fcd563390b76a28d824
> commit: 16994f2b09a22523885d371caa59f17999686805 [333/334] mm: add CONFIG_PAGE_BLOCK_ORDER to select page block order
> config: powerpc64-randconfig-003-20250509 (https://download.01.org/0day-ci/archive/20250509/202505091548.FuKO4b4v-lkp@intel.com/config)
> compiler: powerpc64-linux-gcc (GCC) 10.5.0
> reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20250509/202505091548.FuKO4b4v-lkp@intel.com/reproduce)
>
> If you fix the issue in a separate patch/commit (i.e. not just a new version of
> the same patch/commit), kindly add following tags
> | Reported-by: kernel test robot <lkp@intel.com>
> | Closes: https://lore.kernel.org/oe-kbuild-all/202505091548.FuKO4b4v-lkp@intel.com/
>
> All warnings (new ones prefixed by >>):
>
>    In file included from include/vdso/const.h:5,
>                     from include/linux/const.h:4,
>                     from include/linux/bits.h:5,
>                     from include/linux/ratelimit_types.h:5,
>                     from include/linux/printk.h:9,
>                     from include/asm-generic/bug.h:22,
>                     from arch/powerpc/include/asm/bug.h:116,
>                     from include/linux/bug.h:5,
>                     from include/linux/mmdebug.h:5,
>                     from include/linux/mm.h:6,
>                     from mm/sparse.c:5:
>    mm/sparse.c: In function 'usemap_size':
> >> include/linux/mmzone.h:1816:8: warning: left shift count is negative [-Wshift-count-negative]
>     1816 |  ((1UL << (PFN_SECTION_SHIFT - pageblock_order)) * NR_PAGEBLOCK_BITS)
>          |        ^~
>    include/uapi/linux/const.h:51:40: note: in definition of macro '__KERNEL_DIV_ROUND_UP'
>       51 | #define __KERNEL_DIV_ROUND_UP(n, d) (((n) + (d) - 1) / (d))
>          |                                        ^
>    mm/sparse.c:301:9: note: in expansion of macro 'BITS_TO_LONGS'
>      301 |  return BITS_TO_LONGS(SECTION_BLOCKFLAGS_BITS) * sizeof(unsigned long);
>          |         ^~~~~~~~~~~~~
>    mm/sparse.c:301:23: note: in expansion of macro 'SECTION_BLOCKFLAGS_BITS'
>      301 |  return BITS_TO_LONGS(SECTION_BLOCKFLAGS_BITS) * sizeof(unsigned long);
>          |                       ^~~~~~~~~~~~~~~~~~~~~~~
>
>
> vim +1816 include/linux/mmzone.h
>
> d41dee369bff3b Andy Whitcroft 2005-06-23  1814
> 835c134ec4dd75 Mel Gorman     2007-10-16  1815  #define SECTION_BLOCKFLAGS_BITS \
> d9c2340052278d Mel Gorman     2007-10-16 @1816          ((1UL << (PFN_SECTION_SHIFT - pageblock_order)) * NR_PAGEBLOCK_BITS)
> 835c134ec4dd75 Mel Gorman     2007-10-16  1817
>

Thanks for testing,

The reason for the warning is because CONFIG_PAGE_BLOCK_ORDER >
CONFIG_ARCH_FORCE_MAX_ORDER.

This config: powerpc64-randconfig-003-20250509
(https://download.01.org/0day-ci/archive/20250509/202505091548.FuKO4b4v-lkp@intel.com/config)

is not respecting the range config below. Should the test make sure
that the ranges are valid?

config PAGE_BLOCK_ORDER
int "Page Block Order"
range 1 10 if !ARCH_FORCE_MAX_ORDER
default 10 if !ARCH_FORCE_MAX_ORDER
range 1 ARCH_FORCE_MAX_ORDER if ARCH_FORCE_MAX_ORDER
default ARCH_FORCE_MAX_ORDER if ARCH_FORCE_MAX_ORDER

I can add a check in include/linux/pageblock-flags.h

/*
 * The PAGE_BLOCK_ORDER, which defines the order for the number of pages
 * that can have a migrate type, must be less or equal to the MAX_PAGE_ORDER,
 * which defines the max order of pages to be allocated by the buddy allocator.
 */
BUILD_BUG_ON_MSG(PAGE_BLOCK_ORDER > MAX_PAGE_ORDER,
        "MAX_PAGE_ORDER must be >= PAGE_BLOCK_ORDER");

Is there any preference?

> :::::: The code at line 1816 was first introduced by commit
> :::::: d9c2340052278d8eb2ffb16b0484f8f794def4de Do not depend on MAX_ORDER when grouping pages by mobility
>
> :::::: TO: Mel Gorman <mel@csn.ul.ie>
> :::::: CC: Linus Torvalds <torvalds@woody.linux-foundation.org>
>
> --
> 0-DAY CI Kernel Test Service
> https://github.com/intel/lkp-tests/wiki


  reply	other threads:[~2025-05-09 20:43 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-05-09  7:48 kernel test robot
2025-05-09 20:43 ` Juan Yescas [this message]
2025-05-12  1:10   ` Philip Li
2025-05-12 19:06     ` Juan Yescas

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to='CAJDx_rg6QHsLK8=i-6D5=B=OL50-RUPP=e9JZgRiAfE3sgwRMg@mail.gmail.com' \
    --to=jyescas@google.com \
    --cc=akpm@linux-foundation.org \
    --cc=linux-mm@kvack.org \
    --cc=lkp@intel.com \
    --cc=oe-kbuild-all@lists.linux.dev \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox