* [PATCH v2] mm/memcg: remove return value of mem_cgroup_scan_tasks()
@ 2023-06-16 6:30 Peng Zhang
2023-06-16 18:47 ` Christophe JAILLET
0 siblings, 1 reply; 2+ messages in thread
From: Peng Zhang @ 2023-06-16 6:30 UTC (permalink / raw)
To: linux-mm, linux-kernel
Cc: hannes, mhocko, roman.gushchin, shakeelb, muchun.song, akpm,
wangkefeng.wang, sunnanyong, ZhangPeng
From: ZhangPeng <zhangpeng362@huawei.com>
No user checks the return value of mem_cgroup_scan_tasks(). Make the
return value void.
Signed-off-by: ZhangPeng <zhangpeng362@huawei.com>
---
v2:
- drop redundant return 0 per kernel test robot
include/linux/memcontrol.h | 7 +++----
mm/memcontrol.c | 9 ++++-----
2 files changed, 7 insertions(+), 9 deletions(-)
diff --git a/include/linux/memcontrol.h b/include/linux/memcontrol.h
index c3d3a0c09315..5818af8eca5a 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)
{
@@ -1364,10 +1364,9 @@ 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;
}
static inline unsigned short mem_cgroup_id(struct mem_cgroup *memcg)
diff --git a/mm/memcontrol.c b/mm/memcontrol.c
index cf06b1c9b3bb..a834b1edcde9 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
^ permalink raw reply [flat|nested] 2+ messages in thread
* Re: [PATCH v2] mm/memcg: remove return value of mem_cgroup_scan_tasks()
2023-06-16 6:30 [PATCH v2] mm/memcg: remove return value of mem_cgroup_scan_tasks() Peng Zhang
@ 2023-06-16 18:47 ` Christophe JAILLET
0 siblings, 0 replies; 2+ messages in thread
From: Christophe JAILLET @ 2023-06-16 18:47 UTC (permalink / raw)
To: Peng Zhang, linux-mm, linux-kernel
Cc: hannes, mhocko, roman.gushchin, shakeelb, muchun.song, akpm,
wangkefeng.wang, sunnanyong
Le 16/06/2023 à 08:30, Peng Zhang a écrit :
> From: ZhangPeng <zhangpeng362@huawei.com>
>
> No user checks the return value of mem_cgroup_scan_tasks(). Make the
> return value void.
>
> Signed-off-by: ZhangPeng <zhangpeng362@huawei.com>
> ---
> v2:
> - drop redundant return 0 per kernel test robot
>
> include/linux/memcontrol.h | 7 +++----
> mm/memcontrol.c | 9 ++++-----
> 2 files changed, 7 insertions(+), 9 deletions(-)
>
> diff --git a/include/linux/memcontrol.h b/include/linux/memcontrol.h
> index c3d3a0c09315..5818af8eca5a 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)
> {
> @@ -1364,10 +1364,9 @@ 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;
> }
>
> static inline unsigned short mem_cgroup_id(struct mem_cgroup *memcg)
> diff --git a/mm/memcontrol.c b/mm/memcontrol.c
> index cf06b1c9b3bb..a834b1edcde9 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.
It does not return 0 any more in such a case.
CJ
> *
> * 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
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2023-06-16 18:47 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-06-16 6:30 [PATCH v2] mm/memcg: remove return value of mem_cgroup_scan_tasks() Peng Zhang
2023-06-16 18:47 ` Christophe JAILLET
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox