2023-06-16 02:29:26

by zhangpeng (AS)

[permalink] [raw]
Subject: [PATCH] mm/memcg: remove return value of mem_cgroup_scan_tasks()

From: ZhangPeng <[email protected]>

No user checks the return value of mem_cgroup_scan_tasks(). Make the
return value void.

Signed-off-by: ZhangPeng <[email protected]>
---
include/linux/memcontrol.h | 6 +++---
mm/memcontrol.c | 9 ++++-----
2 files changed, 7 insertions(+), 8 deletions(-)

diff --git a/include/linux/memcontrol.h b/include/linux/memcontrol.h
index 7738d8c0fa4f..c20375a77c07 100644
--- a/include/linux/memcontrol.h
+++ b/include/linux/memcontrol.h
@@ -820,8 +820,8 @@ struct mem_cgroup *mem_cgroup_iter(struct mem_cgroup *,
struct mem_cgroup *,
struct mem_cgroup_reclaim_cookie *);
void mem_cgroup_iter_break(struct mem_cgroup *, struct mem_cgroup *);
-int mem_cgroup_scan_tasks(struct mem_cgroup *,
- int (*)(struct task_struct *, void *), void *);
+void mem_cgroup_scan_tasks(struct mem_cgroup *memcg,
+ int (*)(struct task_struct *, void *), void *arg);

static inline unsigned short mem_cgroup_id(struct mem_cgroup *memcg)
{
@@ -1366,7 +1366,7 @@ static inline void mem_cgroup_iter_break(struct mem_cgroup *root,
{
}

-static inline int mem_cgroup_scan_tasks(struct mem_cgroup *memcg,
+static inline void mem_cgroup_scan_tasks(struct mem_cgroup *memcg,
int (*fn)(struct task_struct *, void *), void *arg)
{
return 0;
diff --git a/mm/memcontrol.c b/mm/memcontrol.c
index 0fe39ed857db..92a553b06f7a 100644
--- a/mm/memcontrol.c
+++ b/mm/memcontrol.c
@@ -1259,13 +1259,13 @@ static void invalidate_reclaim_iterators(struct mem_cgroup *dead_memcg)
*
* This function iterates over tasks attached to @memcg or to any of its
* descendants and calls @fn for each task. If @fn returns a non-zero
- * value, the function breaks the iteration loop and returns the value.
- * Otherwise, it will iterate over all tasks and return 0.
+ * value, the function breaks the iteration loop. Otherwise, it will iterate
+ * over all tasks and return 0.
*
* This function must not be called for the root memory cgroup.
*/
-int mem_cgroup_scan_tasks(struct mem_cgroup *memcg,
- int (*fn)(struct task_struct *, void *), void *arg)
+void mem_cgroup_scan_tasks(struct mem_cgroup *memcg,
+ int (*fn)(struct task_struct *, void *), void *arg)
{
struct mem_cgroup *iter;
int ret = 0;
@@ -1285,7 +1285,6 @@ int mem_cgroup_scan_tasks(struct mem_cgroup *memcg,
break;
}
}
- return ret;
}

#ifdef CONFIG_DEBUG_VM
--
2.25.1



2023-06-16 05:27:53

by kernel test robot

[permalink] [raw]
Subject: Re: [PATCH] mm/memcg: remove return value of mem_cgroup_scan_tasks()

Hi Peng,

kernel test robot noticed the following build errors:

[auto build test ERROR on akpm-mm/mm-everything]

url: https://github.com/intel-lab-lkp/linux/commits/Peng-Zhang/mm-memcg-remove-return-value-of-mem_cgroup_scan_tasks/20230616-102145
base: https://git.kernel.org/pub/scm/linux/kernel/git/akpm/mm.git mm-everything
patch link: https://lore.kernel.org/r/20230616021955.872413-1-zhangpeng362%40huawei.com
patch subject: [PATCH] mm/memcg: remove return value of mem_cgroup_scan_tasks()
config: x86_64-randconfig-r005-20230616 (https://download.01.org/0day-ci/archive/20230616/[email protected]/config)
compiler: clang version 15.0.7 (https://github.com/llvm/llvm-project.git 8dfdcc7b7bf66834a761bd8de445840ef68e4d1a)
reproduce (this is a W=1 build):
mkdir -p ~/bin
wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross
chmod +x ~/bin/make.cross
git remote add akpm-mm https://git.kernel.org/pub/scm/linux/kernel/git/akpm/mm.git
git fetch akpm-mm mm-everything
git checkout akpm-mm/mm-everything
b4 shazam https://lore.kernel.org/r/[email protected]
# save the config file
mkdir build_dir && cp config build_dir/.config
COMPILER_INSTALL_PATH=$HOME/0day COMPILER=clang ~/bin/make.cross W=1 O=build_dir ARCH=x86_64 olddefconfig
COMPILER_INSTALL_PATH=$HOME/0day COMPILER=clang ~/bin/make.cross W=1 O=build_dir ARCH=x86_64 prepare

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 <[email protected]>
| Closes: https://lore.kernel.org/oe-kbuild-all/[email protected]/

All errors (new ones prefixed by >>):

In file included from arch/x86/kernel/asm-offsets.c:14:
In file included from include/linux/suspend.h:5:
In file included from include/linux/swap.h:9:
>> include/linux/memcontrol.h:1370:2: error: void function 'mem_cgroup_scan_tasks' should not return a value [-Wreturn-type]
return 0;
^ ~
1 error generated.
make[2]: *** [scripts/Makefile.build:114: arch/x86/kernel/asm-offsets.s] Error 1 shuffle=3878817758
make[2]: Target 'prepare' not remade because of errors.
make[1]: *** [Makefile:1287: prepare0] Error 2 shuffle=3878817758
make[1]: Target 'prepare' not remade because of errors.
make: *** [Makefile:226: __sub-make] Error 2 shuffle=3878817758
make: Target 'prepare' not remade because of errors.


vim +/mem_cgroup_scan_tasks +1370 include/linux/memcontrol.h

5660048ccac873 Johannes Weiner 2012-01-12 1366
5044a2e0ddbf82 ZhangPeng 2023-06-16 1367 static inline void mem_cgroup_scan_tasks(struct mem_cgroup *memcg,
7c5f64f84483bd Vladimir Davydov 2016-10-07 1368 int (*fn)(struct task_struct *, void *), void *arg)
7c5f64f84483bd Vladimir Davydov 2016-10-07 1369 {
7c5f64f84483bd Vladimir Davydov 2016-10-07 @1370 return 0;
7c5f64f84483bd Vladimir Davydov 2016-10-07 1371 }
7c5f64f84483bd Vladimir Davydov 2016-10-07 1372

--
0-DAY CI Kernel Test Service
https://github.com/intel/lkp-tests/wiki

2023-06-16 06:23:04

by zhangpeng (AS)

[permalink] [raw]
Subject: Re: [PATCH] mm/memcg: remove return value of mem_cgroup_scan_tasks()

On 2023/6/16 13:13, kernel test robot wrote:

> Hi Peng,
>
> kernel test robot noticed the following build errors:
>
> [auto build test ERROR on akpm-mm/mm-everything]
>
> url: https://github.com/intel-lab-lkp/linux/commits/Peng-Zhang/mm-memcg-remove-return-value-of-mem_cgroup_scan_tasks/20230616-102145
> base: https://git.kernel.org/pub/scm/linux/kernel/git/akpm/mm.git mm-everything
> patch link: https://lore.kernel.org/r/20230616021955.872413-1-zhangpeng362%40huawei.com
> patch subject: [PATCH] mm/memcg: remove return value of mem_cgroup_scan_tasks()
> config: x86_64-randconfig-r005-20230616 (https://download.01.org/0day-ci/archive/20230616/[email protected]/config)
> compiler: clang version 15.0.7 (https://github.com/llvm/llvm-project.git 8dfdcc7b7bf66834a761bd8de445840ef68e4d1a)
> reproduce (this is a W=1 build):
> mkdir -p ~/bin
> wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross
> chmod +x ~/bin/make.cross
> git remote add akpm-mm https://git.kernel.org/pub/scm/linux/kernel/git/akpm/mm.git
> git fetch akpm-mm mm-everything
> git checkout akpm-mm/mm-everything
> b4 shazam https://lore.kernel.org/r/[email protected]
> # save the config file
> mkdir build_dir && cp config build_dir/.config
> COMPILER_INSTALL_PATH=$HOME/0day COMPILER=clang ~/bin/make.cross W=1 O=build_dir ARCH=x86_64 olddefconfig
> COMPILER_INSTALL_PATH=$HOME/0day COMPILER=clang ~/bin/make.cross W=1 O=build_dir ARCH=x86_64 prepare
>
> 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 <[email protected]>
> | Closes: https://lore.kernel.org/oe-kbuild-all/[email protected]/
>
> All errors (new ones prefixed by >>):
>
> In file included from arch/x86/kernel/asm-offsets.c:14:
> In file included from include/linux/suspend.h:5:
> In file included from include/linux/swap.h:9:
>>> include/linux/memcontrol.h:1370:2: error: void function 'mem_cgroup_scan_tasks' should not return a value [-Wreturn-type]
> return 0;

Thanks for reporting. I'll drop this line.

> ^ ~
> 1 error generated.
> make[2]: *** [scripts/Makefile.build:114: arch/x86/kernel/asm-offsets.s] Error 1 shuffle=3878817758
> make[2]: Target 'prepare' not remade because of errors.
> make[1]: *** [Makefile:1287: prepare0] Error 2 shuffle=3878817758
> make[1]: Target 'prepare' not remade because of errors.
> make: *** [Makefile:226: __sub-make] Error 2 shuffle=3878817758
> make: Target 'prepare' not remade because of errors.
>
>
> vim +/mem_cgroup_scan_tasks +1370 include/linux/memcontrol.h
>
> 5660048ccac873 Johannes Weiner 2012-01-12 1366
> 5044a2e0ddbf82 ZhangPeng 2023-06-16 1367 static inline void mem_cgroup_scan_tasks(struct mem_cgroup *memcg,
> 7c5f64f84483bd Vladimir Davydov 2016-10-07 1368 int (*fn)(struct task_struct *, void *), void *arg)
> 7c5f64f84483bd Vladimir Davydov 2016-10-07 1369 {
> 7c5f64f84483bd Vladimir Davydov 2016-10-07 @1370 return 0;
> 7c5f64f84483bd Vladimir Davydov 2016-10-07 1371 }
> 7c5f64f84483bd Vladimir Davydov 2016-10-07 1372
>