From: lvqian <[email protected]>
The return value of this function has no meaning,
so the original int type is replaced with a void type,
which reduces the execution time of one return.
Signed-off-by: lvqian <[email protected]>
---
mm/page_alloc.c | 9 ++++-----
1 file changed, 4 insertions(+), 5 deletions(-)
diff --git a/mm/page_alloc.c b/mm/page_alloc.c
index 0745aedebb37..fffe16d854a9 100644
--- a/mm/page_alloc.c
+++ b/mm/page_alloc.c
@@ -828,17 +828,16 @@ static int __init early_debug_pagealloc(char *buf)
}
early_param("debug_pagealloc", early_debug_pagealloc);
-static int __init debug_guardpage_minorder_setup(char *buf)
+static void __init debug_guardpage_minorder_setup(char *buf)
{
unsigned long res;
if (kstrtoul(buf, 10, &res) < 0 || res > MAX_ORDER / 2) {
pr_err("Bad debug_guardpage_minorder value\n");
- return 0;
+ } else {
+ _debug_guardpage_minorder = res;
+ pr_info("Setting debug_guardpage_minorder to %lu\n", res);
}
- _debug_guardpage_minorder = res;
- pr_info("Setting debug_guardpage_minorder to %lu\n", res);
- return 0;
}
early_param("debug_guardpage_minorder", debug_guardpage_minorder_setup);
--
2.34.1
On 12/29/22 at 03:17pm, [email protected] wrote:
> From: lvqian <[email protected]>
>
> The return value of this function has no meaning,
> so the original int type is replaced with a void type,
> which reduces the execution time of one return.
>
> Signed-off-by: lvqian <[email protected]>
> ---
> mm/page_alloc.c | 9 ++++-----
> 1 file changed, 4 insertions(+), 5 deletions(-)
>
> diff --git a/mm/page_alloc.c b/mm/page_alloc.c
> index 0745aedebb37..fffe16d854a9 100644
> --- a/mm/page_alloc.c
> +++ b/mm/page_alloc.c
> @@ -828,17 +828,16 @@ static int __init early_debug_pagealloc(char *buf)
> }
> early_param("debug_pagealloc", early_debug_pagealloc);
>
> -static int __init debug_guardpage_minorder_setup(char *buf)
> +static void __init debug_guardpage_minorder_setup(char *buf)
> {
> unsigned long res;
>
> if (kstrtoul(buf, 10, &res) < 0 || res > MAX_ORDER / 2) {
> pr_err("Bad debug_guardpage_minorder value\n");
> - return 0;
This could be not right. Please see parse_args(), the returned value is
needed, otherwise you might get stuff you don't want in the switch case
handling.
parse_early_param()
-->parse_early_options()
-->parse_args()
> + } else {
> + _debug_guardpage_minorder = res;
> + pr_info("Setting debug_guardpage_minorder to %lu\n", res);
> }
> - _debug_guardpage_minorder = res;
> - pr_info("Setting debug_guardpage_minorder to %lu\n", res);
> - return 0;
> }
> early_param("debug_guardpage_minorder", debug_guardpage_minorder_setup);
>
> --
> 2.34.1
>
Hi,
Thank you for the patch! Yet something to improve:
[auto build test ERROR on akpm-mm/mm-everything]
url: https://github.com/intel-lab-lkp/linux/commits/lvqian-nfschina-com/mm-page_alloc-c-Remove-function-return-value/20221229-152005
base: https://git.kernel.org/pub/scm/linux/kernel/git/akpm/mm.git mm-everything
patch link: https://lore.kernel.org/r/20221229071730.174444-1-lvqian%40nfschina.com
patch subject: [PATCH] mm/page_alloc.c: Remove function return value
config: arm64-randconfig-r013-20221227
compiler: clang version 16.0.0 (https://github.com/llvm/llvm-project f5700e7b69048de958172fb513b336564e7f8709)
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
# install arm64 cross compiling tool for clang build
# apt-get install binutils-aarch64-linux-gnu
# https://github.com/intel-lab-lkp/linux/commit/1c571b39eb01c99e7832e61ccf5ab5e23ddf75d8
git remote add linux-review https://github.com/intel-lab-lkp/linux
git fetch --no-tags linux-review lvqian-nfschina-com/mm-page_alloc-c-Remove-function-return-value/20221229-152005
git checkout 1c571b39eb01c99e7832e61ccf5ab5e23ddf75d8
# save the config file
mkdir build_dir && cp config build_dir/.config
COMPILER_INSTALL_PATH=$HOME/0day COMPILER=clang make.cross W=1 O=build_dir ARCH=arm64 olddefconfig
COMPILER_INSTALL_PATH=$HOME/0day COMPILER=clang make.cross W=1 O=build_dir ARCH=arm64 SHELL=/bin/bash
If you fix the issue, kindly add following tag where applicable
| Reported-by: kernel test robot <[email protected]>
All errors (new ones prefixed by >>):
>> mm/page_alloc.c:842:41: error: incompatible function pointer types initializing 'int (*)(char *)' with an expression of type 'void (char *)' [-Wincompatible-function-pointer-types]
early_param("debug_guardpage_minorder", debug_guardpage_minorder_setup);
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
include/linux/init.h:341:25: note: expanded from macro 'early_param'
__setup_param(str, fn, fn, 1)
^~
include/linux/init.h:324:32: note: expanded from macro '__setup_param'
= { __setup_str_##unique_id, fn, early }
^~
1 error generated.
vim +842 mm/page_alloc.c
031bc5743f158b Joonsoo Kim 2014-12-12 830
1c571b39eb01c9 lvqian 2022-12-29 831 static void __init debug_guardpage_minorder_setup(char *buf)
c0a32fc5a2e470 Stanislaw Gruszka 2012-01-10 832 {
c0a32fc5a2e470 Stanislaw Gruszka 2012-01-10 833 unsigned long res;
c0a32fc5a2e470 Stanislaw Gruszka 2012-01-10 834
c0a32fc5a2e470 Stanislaw Gruszka 2012-01-10 835 if (kstrtoul(buf, 10, &res) < 0 || res > MAX_ORDER / 2) {
1170532bb49f94 Joe Perches 2016-03-17 836 pr_err("Bad debug_guardpage_minorder value\n");
1c571b39eb01c9 lvqian 2022-12-29 837 } else {
c0a32fc5a2e470 Stanislaw Gruszka 2012-01-10 838 _debug_guardpage_minorder = res;
1170532bb49f94 Joe Perches 2016-03-17 839 pr_info("Setting debug_guardpage_minorder to %lu\n", res);
1c571b39eb01c9 lvqian 2022-12-29 840 }
c0a32fc5a2e470 Stanislaw Gruszka 2012-01-10 841 }
f1c1e9f7b5b3dd Joonsoo Kim 2016-10-07 @842 early_param("debug_guardpage_minorder", debug_guardpage_minorder_setup);
c0a32fc5a2e470 Stanislaw Gruszka 2012-01-10 843
--
0-DAY CI Kernel Test Service
https://01.org/lkp
Hi,
Thank you for the patch! Yet something to improve:
[auto build test ERROR on akpm-mm/mm-everything]
url: https://github.com/intel-lab-lkp/linux/commits/lvqian-nfschina-com/mm-page_alloc-c-Remove-function-return-value/20221229-152005
base: https://git.kernel.org/pub/scm/linux/kernel/git/akpm/mm.git mm-everything
patch link: https://lore.kernel.org/r/20221229071730.174444-1-lvqian%40nfschina.com
patch subject: [PATCH] mm/page_alloc.c: Remove function return value
config: arc-randconfig-r043-20221225
compiler: arceb-elf-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://github.com/intel-lab-lkp/linux/commit/1c571b39eb01c99e7832e61ccf5ab5e23ddf75d8
git remote add linux-review https://github.com/intel-lab-lkp/linux
git fetch --no-tags linux-review lvqian-nfschina-com/mm-page_alloc-c-Remove-function-return-value/20221229-152005
git checkout 1c571b39eb01c99e7832e61ccf5ab5e23ddf75d8
# 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=arc olddefconfig
COMPILER_INSTALL_PATH=$HOME/0day COMPILER=gcc-12.1.0 make.cross W=1 O=build_dir ARCH=arc SHELL=/bin/bash
If you fix the issue, kindly add following tag where applicable
| Reported-by: kernel test robot <[email protected]>
All errors (new ones prefixed by >>):
In file included from include/linux/printk.h:6,
from include/asm-generic/bug.h:22,
from arch/arc/include/asm/bug.h:30,
from include/linux/bug.h:5,
from include/linux/mmdebug.h:5,
from include/linux/mm.h:6,
from mm/page_alloc.c:19:
>> mm/page_alloc.c:842:41: error: initialization of 'int (*)(char *)' from incompatible pointer type 'void (*)(char *)' [-Werror=incompatible-pointer-types]
842 | early_param("debug_guardpage_minorder", debug_guardpage_minorder_setup);
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
include/linux/init.h:324:46: note: in definition of macro '__setup_param'
324 | = { __setup_str_##unique_id, fn, early }
| ^~
mm/page_alloc.c:842:1: note: in expansion of macro 'early_param'
842 | early_param("debug_guardpage_minorder", debug_guardpage_minorder_setup);
| ^~~~~~~~~~~
mm/page_alloc.c:842:41: note: (near initialization for '__setup_debug_guardpage_minorder_setup.setup_func')
842 | early_param("debug_guardpage_minorder", debug_guardpage_minorder_setup);
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
include/linux/init.h:324:46: note: in definition of macro '__setup_param'
324 | = { __setup_str_##unique_id, fn, early }
| ^~
mm/page_alloc.c:842:1: note: in expansion of macro 'early_param'
842 | early_param("debug_guardpage_minorder", debug_guardpage_minorder_setup);
| ^~~~~~~~~~~
cc1: some warnings being treated as errors
vim +842 mm/page_alloc.c
031bc5743f158b Joonsoo Kim 2014-12-12 830
1c571b39eb01c9 lvqian 2022-12-29 831 static void __init debug_guardpage_minorder_setup(char *buf)
c0a32fc5a2e470 Stanislaw Gruszka 2012-01-10 832 {
c0a32fc5a2e470 Stanislaw Gruszka 2012-01-10 833 unsigned long res;
c0a32fc5a2e470 Stanislaw Gruszka 2012-01-10 834
c0a32fc5a2e470 Stanislaw Gruszka 2012-01-10 835 if (kstrtoul(buf, 10, &res) < 0 || res > MAX_ORDER / 2) {
1170532bb49f94 Joe Perches 2016-03-17 836 pr_err("Bad debug_guardpage_minorder value\n");
1c571b39eb01c9 lvqian 2022-12-29 837 } else {
c0a32fc5a2e470 Stanislaw Gruszka 2012-01-10 838 _debug_guardpage_minorder = res;
1170532bb49f94 Joe Perches 2016-03-17 839 pr_info("Setting debug_guardpage_minorder to %lu\n", res);
1c571b39eb01c9 lvqian 2022-12-29 840 }
c0a32fc5a2e470 Stanislaw Gruszka 2012-01-10 841 }
f1c1e9f7b5b3dd Joonsoo Kim 2016-10-07 @842 early_param("debug_guardpage_minorder", debug_guardpage_minorder_setup);
c0a32fc5a2e470 Stanislaw Gruszka 2012-01-10 843
--
0-DAY CI Kernel Test Service
https://01.org/lkp