[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <CAEf4BzZmaH4y82DemPqmS-Eho-4iX91fQ2z=bhauhiDOb=98cg@mail.gmail.com>
Date: Tue, 13 Aug 2024 10:05:54 -0700
From: Andrii Nakryiko <andrii.nakryiko@...il.com>
To: Oleg Nesterov <oleg@...hat.com>
Cc: Andrii Nakryiko <andrii@...nel.org>, linux-trace-kernel@...r.kernel.org,
rostedt@...dmis.org, mhiramat@...nel.org, peterz@...radead.org,
bpf@...r.kernel.org, linux-kernel@...r.kernel.org, jolsa@...nel.org
Subject: Re: [PATCH v2] uprobes: make trace_uprobe->nhit counter a per-CPU one
On Tue, Aug 13, 2024 at 7:50 AM Oleg Nesterov <oleg@...hat.com> wrote:
>
> On 08/09, Andrii Nakryiko wrote:
> >
> > @@ -815,13 +824,21 @@ static int probes_profile_seq_show(struct seq_file *m, void *v)
> > {
> > struct dyn_event *ev = v;
> > struct trace_uprobe *tu;
> > + unsigned long nhits;
> > + int cpu;
> >
> > if (!is_trace_uprobe(ev))
> > return 0;
> >
> > tu = to_trace_uprobe(ev);
> > +
> > + nhits = 0;
> > + for_each_possible_cpu(cpu) {
> > + nhits += READ_ONCE(*per_cpu_ptr(tu->nhits, cpu));
>
> why not
>
> nhits += per_cpu(*tu->nhits, cpu);
>
> ?
>
> See for example per_cpu_sum() or nr_processes(), per_cpu() should work just fine...
>
I just monkeyed it from some existing code somewhere in the BPF code
base. I like per_cpu, will send a v3 and rebase it onto a linux-trace
tree.
> Other than that
>
> Reviewed-by: Oleg Nesterov <oleg@...hat.com>
>
Powered by blists - more mailing lists