Skip to contentSkip to conversation

kernel/events/core: check return value of task_function_call()

PATCH Superseded Li Zhong 2 participants 3 messages Sep 17, 2022 – Sep 19, 2022

Subsystems (2)

v1 of 2 Superseded Latest is v2 →

lore
Share & tools
lore

Li Zhong

author
#0 lore raw

PATCH 1/1 kernel/events/core: check return value of task_function_call()

Check the return value of task_function_call(), which could be error code when the execution fails.

---
 kernel/events/core.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
kernel/events/core.c +2 -1
index 2621fd24ad26..ac0cf611b12a 100644
@@ -13520,7 +13520,8 @@ static void perf_cgroup_attach(struct cgroup_taskset *tset)
 	struct cgroup_subsys_state *css;
 
 	cgroup_taskset_for_each(task, css, tset)
-		task_function_call(task, __perf_cgroup_move, task);
+		if (!task_function_call(task, __perf_cgroup_move, task))
+			return;
 }
 
 struct cgroup_subsys perf_event_cgrp_subsys = {
Signature · 1 line
2.25.1
maintainer
#1 lore raw
Quoted 2 lines · Li Zhong

Check the return value of task_function_call(), which could be error code when the execution fails.

How is terminating the cgroup task iteration a useful thing? Also coding style fail for not adding { }

Quoted 22 lines
---
 kernel/events/core.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
kernel/events/core.c +2 -1
index 2621fd24ad26..ac0cf611b12a 100644
@@ -13520,7 +13520,8 @@ static void perf_cgroup_attach(struct cgroup_taskset *tset)
 	struct cgroup_subsys_state *css;
 
 	cgroup_taskset_for_each(task, css, tset)
-		task_function_call(task, __perf_cgroup_move, task);
+		if (!task_function_call(task, __perf_cgroup_move, task))
+			return;
 }
 
 struct cgroup_subsys perf_event_cgrp_subsys = {
Signature · 1 line
2.25.1
author
#2 lore raw
Quoted 7 lines · Peter Zijlstra
Quoted 2 lines · Li Zhong

Check the return value of task_function_call(), which could be error code when the execution fails.

How is terminating the cgroup task iteration a useful thing? Also coding style fail for not adding { }

Thanks for your reply! Skip and continue the execution is more appropriate here. Change it in v2 patch.

Quoted 23 lines
Quoted 23 lines
---
 kernel/events/core.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
kernel/events/core.c +2 -2
index 2621fd24ad26..ac0cf611b12a 100644
@@ -13520,7 +13520,8 @@ static void perf_cgroup_attach(struct cgroup_taskset *tset)
      struct cgroup_subsys_state *css;
 
      cgroup_taskset_for_each(task, css, tset)
-             task_function_call(task, __perf_cgroup_move, task);
+             if (!task_function_call(task, __perf_cgroup_move, task))
+                     return;
 }
 
 struct cgroup_subsys perf_event_cgrp_subsys = {
--

2.25.1