All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH v1] kernel/events/core: check return value of task_function_call()
@ 2022-09-17  1:47 Li Zhong
  2022-09-19 14:39 ` Peter Zijlstra
  0 siblings, 1 reply; 3+ messages in thread
From: Li Zhong @ 2022-09-17  1:47 UTC (permalink / raw)
  To: linux-kernel, linux-perf-users, bpf
  Cc: namhyung, jolsa, alexander.shishkin, mark.rutland, acme, mingo,
	peterz, Li Zhong

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

Signed-off-by: Li Zhong <floridsleeves@gmail.com>
---
 kernel/events/core.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/kernel/events/core.c b/kernel/events/core.c
index 2621fd24ad26..ac0cf611b12a 100644
--- a/kernel/events/core.c
+++ b/kernel/events/core.c
@@ -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


^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH v1] kernel/events/core: check return value of task_function_call()
  2022-09-17  1:47 [PATCH v1] kernel/events/core: check return value of task_function_call() Li Zhong
@ 2022-09-19 14:39 ` Peter Zijlstra
  2022-09-19 18:36   ` Li Zhong
  0 siblings, 1 reply; 3+ messages in thread
From: Peter Zijlstra @ 2022-09-19 14:39 UTC (permalink / raw)
  To: Li Zhong
  Cc: linux-kernel, linux-perf-users, bpf, namhyung, jolsa,
	alexander.shishkin, mark.rutland, acme, mingo

On Fri, Sep 16, 2022 at 06:47:46PM -0700, Li Zhong wrote:
> 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 { }

> Signed-off-by: Li Zhong <floridsleeves@gmail.com>
> ---
>  kernel/events/core.c | 3 ++-
>  1 file changed, 2 insertions(+), 1 deletion(-)
> 
> diff --git a/kernel/events/core.c b/kernel/events/core.c
> index 2621fd24ad26..ac0cf611b12a 100644
> --- a/kernel/events/core.c
> +++ b/kernel/events/core.c
> @@ -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
> 

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH v1] kernel/events/core: check return value of task_function_call()
  2022-09-19 14:39 ` Peter Zijlstra
@ 2022-09-19 18:36   ` Li Zhong
  0 siblings, 0 replies; 3+ messages in thread
From: Li Zhong @ 2022-09-19 18:36 UTC (permalink / raw)
  To: Peter Zijlstra
  Cc: linux-kernel, linux-perf-users, bpf, namhyung, jolsa,
	alexander.shishkin, mark.rutland, acme, mingo

On Mon, Sep 19, 2022 at 7:39 AM Peter Zijlstra <peterz@infradead.org> wrote:
>
> On Fri, Sep 16, 2022 at 06:47:46PM -0700, Li Zhong wrote:
> > 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.

>
> > Signed-off-by: Li Zhong <floridsleeves@gmail.com>
> > ---
> >  kernel/events/core.c | 3 ++-
> >  1 file changed, 2 insertions(+), 1 deletion(-)
> >
> > diff --git a/kernel/events/core.c b/kernel/events/core.c
> > index 2621fd24ad26..ac0cf611b12a 100644
> > --- a/kernel/events/core.c
> > +++ b/kernel/events/core.c
> > @@ -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
> >

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2022-09-19 18:36 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-09-17  1:47 [PATCH v1] kernel/events/core: check return value of task_function_call() Li Zhong
2022-09-19 14:39 ` Peter Zijlstra
2022-09-19 18:36   ` Li Zhong

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.