From: Sergey Senozhatsky <senozhatsky@chromium.org>
To: kernel test robot <lkp@intel.com>
Cc: Sergey Senozhatsky <senozhatsky@chromium.org>,
oe-kbuild-all@lists.linux.dev,
Linux Memory Management List <linux-mm@kvack.org>,
Andrew Morton <akpm@linux-foundation.org>
Subject: Re: [linux-next:master 3853/4127] mm/zsmalloc.c:2220:69: warning: right shift count >= width of type
Date: Mon, 31 Oct 2022 11:11:19 +0900 [thread overview]
Message-ID: <Y18uxz6+U/Jqxfx1@google.com> (raw)
In-Reply-To: <202210291926.676Ue2l1-lkp@intel.com>
On (22/10/29 19:33), kernel test robot wrote:
> tree: https://git.kernel.org/pub/scm/linux/kernel/git/next/linux-next.git master
> head: fd8dab197cca2746e1fcd399a218eec5164726d4
> commit: 280bbecded35eea30bbb5537f4f0a8a7e0e1b784 [3853/4127] zsmalloc: turn zspage order into runtime variable
> config: parisc-randconfig-r023-20221029
> compiler: hppa64-linux-gcc (GCC) 12.1.0
> reproduce (this is a W=1 build):
> wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross
> chmod +x ~/bin/make.cross
> # https://git.kernel.org/pub/scm/linux/kernel/git/next/linux-next.git/commit/?id=280bbecded35eea30bbb5537f4f0a8a7e0e1b784
> git remote add linux-next https://git.kernel.org/pub/scm/linux/kernel/git/next/linux-next.git
> git fetch --no-tags linux-next master
> git checkout 280bbecded35eea30bbb5537f4f0a8a7e0e1b784
> # save the config file
> mkdir build_dir && cp config build_dir/.config
> COMPILER_INSTALL_PATH=$HOME/0day COMPILER=gcc-12.1.0 make.cross W=1 O=build_dir ARCH=parisc64 SHELL=/bin/bash
>
> If you fix the issue, kindly add following tag where applicable
> | Reported-by: kernel test robot <lkp@intel.com>
>
> All warnings (new ones prefixed by >>):
>
> mm/zsmalloc.c: In function 'zs_create_pool':
> >> mm/zsmalloc.c:2220:69: warning: right shift count >= width of type [-Wshift-count-overflow]
> 2220 | pool->min_alloc_size = (max_pages_per_zspage << PAGE_SHIFT) >>
> | ^~
Haven't seen any warnings on my side. I guess the following should do
the trick:
---
mm/zsmalloc.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/mm/zsmalloc.c b/mm/zsmalloc.c
index 0bc9ed1f1a5d..181bfc66249b 100644
--- a/mm/zsmalloc.c
+++ b/mm/zsmalloc.c
@@ -2211,6 +2211,7 @@ struct zs_pool *zs_create_pool(const char *name, u32 max_pages_per_zspage)
int i;
struct zs_pool *pool;
struct size_class *prev_class = NULL;
+ unsigned long num_pages = max_pages_per_zspage;
if (WARN_ON(max_pages_per_zspage < ZS_MIN_PAGES_PER_ZSPAGE ||
max_pages_per_zspage > ZS_MAX_PAGES_PER_ZSPAGE))
@@ -2221,8 +2222,7 @@ struct zs_pool *zs_create_pool(const char *name, u32 max_pages_per_zspage)
return NULL;
/* min_alloc_size must be multiple of ZS_ALIGN */
- pool->min_alloc_size = (max_pages_per_zspage << PAGE_SHIFT) >>
- OBJ_INDEX_BITS;
+ pool->min_alloc_size = num_pages << PAGE_SHIFT >> OBJ_INDEX_BITS;
pool->min_alloc_size = max(pool->min_alloc_size, ZS_MIN_ALLOC_SIZE);
pool->num_size_classes =
--
2.38.1.273.g43a17bfeac-goog
prev parent reply other threads:[~2022-10-31 2:11 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-10-29 11:33 kernel test robot
2022-10-31 2:11 ` Sergey Senozhatsky [this message]
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=Y18uxz6+U/Jqxfx1@google.com \
--to=senozhatsky@chromium.org \
--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