Re: [PATCH bpf 2/5] bpf: remove unnecessary rcu_read_{lock,unlock}() in multi-uprobe attach logic

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Mon, May 20, 2024 at 04:47:17PM -0700, Andrii Nakryiko wrote:
> get_pid_task() internally already calls rcu_read_lock() and
> rcu_read_unlock(), so there is no point to do this one extra time.
> 
> This is a drive-by improvements and has no correctness implications.
> 
> Signed-off-by: Andrii Nakryiko <andrii@xxxxxxxxxx>

Acked-by: Jiri Olsa <jolsa@xxxxxxxxxx>

jirka

> ---
>  kernel/trace/bpf_trace.c | 2 --
>  1 file changed, 2 deletions(-)
> 
> diff --git a/kernel/trace/bpf_trace.c b/kernel/trace/bpf_trace.c
> index 1baaeb9ca205..6249dac61701 100644
> --- a/kernel/trace/bpf_trace.c
> +++ b/kernel/trace/bpf_trace.c
> @@ -3423,9 +3423,7 @@ int bpf_uprobe_multi_link_attach(const union bpf_attr *attr, struct bpf_prog *pr
>  	}
>  
>  	if (pid) {
> -		rcu_read_lock();
>  		task = get_pid_task(find_vpid(pid), PIDTYPE_TGID);
> -		rcu_read_unlock();
>  		if (!task) {
>  			err = -ESRCH;
>  			goto error_path_put;
> -- 
> 2.43.0
> 
> 




[Index of Archives]     [Linux Samsung SoC]     [Linux Rockchip SoC]     [Linux Actions SoC]     [Linux for Synopsys ARC Processors]     [Linux NFS]     [Linux NILFS]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]


  Powered by Linux