* Re: [PATCH v2] percpu: improve percpu_alloc_percpu event trace
[not found] ` <a07be858-c8a3-7851-9086-e3262cbcf707@openvz.org>
@ 2022-05-11 2:33 ` Roman Gushchin
[not found] ` <30a47b4e-7c4b-cd2d-998d-cfaf8d12d342@openvz.org>
2022-05-15 22:06 ` Steven Rostedt
0 siblings, 2 replies; 3+ messages in thread
From: Roman Gushchin @ 2022-05-11 2:33 UTC (permalink / raw)
To: Vasily Averin
Cc: Shakeel Butt, Steven Rostedt, Ingo Molnar, kernel, linux-kernel,
Vlastimil Babka, Michal Hocko, cgroups, Andrew Morton,
Dennis Zhou, Tejun Heo, Christoph Lameter, linux-mm
On Fri, May 06, 2022 at 10:29:25PM +0300, Vasily Averin wrote:
> Added call_site, bytes_alloc and gfp_flags fields to the output
> of the percpu_alloc_percpu ftrace event:
>
> mkdir-4393 [001] 169.334788: percpu_alloc_percpu:
> call_site=mem_cgroup_css_alloc+0xa6 reserved=0 is_atomic=0 size=2408 align=8
> base_addr=0xffffc7117fc00000 off=402176 ptr=0x3dc867a62300 bytes_alloc=14448
> gfp_flags=GFP_KERNEL_ACCOUNT
>
> This is required to track memcg-accounted percpu allocations.
>
> Signed-off-by: Vasily Averin <vvs@openvz.org>
Acked-by: Roman Gushchin <roman.gushchin@linux.dev>
LGTM, thanks Vasily!
One minor thing below.
> ---
> v2: added call_site, improved patch description
> ---
> include/trace/events/percpu.h | 23 +++++++++++++++++------
> mm/percpu-internal.h | 8 ++++----
> mm/percpu.c | 5 +++--
> 3 files changed, 24 insertions(+), 12 deletions(-)
>
> diff --git a/include/trace/events/percpu.h b/include/trace/events/percpu.h
> index df112a64f6c9..e989cefc0def 100644
> --- a/include/trace/events/percpu.h
> +++ b/include/trace/events/percpu.h
> @@ -6,15 +6,20 @@
> #define _TRACE_PERCPU_H
>
> #include <linux/tracepoint.h>
> +#include <trace/events/mmflags.h>
>
> TRACE_EVENT(percpu_alloc_percpu,
>
> - TP_PROTO(bool reserved, bool is_atomic, size_t size,
> - size_t align, void *base_addr, int off, void __percpu *ptr),
> + TP_PROTO(unsigned long call_site,
> + bool reserved, bool is_atomic, size_t size,
> + size_t align, void *base_addr, int off,
> + void __percpu *ptr, size_t bytes_alloc, gfp_t gfp_flags),
Don't we want to preserve the order and add the call_site at the end?
Trace events are not ABI, but if we don't have a strong reason to break it,
I'd preserve the old order.
Thanks!
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH v2] percpu: improve percpu_alloc_percpu event trace
[not found] ` <30a47b4e-7c4b-cd2d-998d-cfaf8d12d342@openvz.org>
@ 2022-05-11 17:30 ` Roman Gushchin
0 siblings, 0 replies; 3+ messages in thread
From: Roman Gushchin @ 2022-05-11 17:30 UTC (permalink / raw)
To: Vasily Averin
Cc: Shakeel Butt, Steven Rostedt, Ingo Molnar, kernel, linux-kernel,
Vlastimil Babka, Michal Hocko, cgroups, Andrew Morton,
Dennis Zhou, Tejun Heo, Christoph Lameter, linux-mm
On Wed, May 11, 2022 at 08:11:54AM +0300, Vasily Averin wrote:
> On 5/11/22 05:33, Roman Gushchin wrote:
> > On Fri, May 06, 2022 at 10:29:25PM +0300, Vasily Averin wrote:
> >> TRACE_EVENT(percpu_alloc_percpu,
> >>
> >> - TP_PROTO(bool reserved, bool is_atomic, size_t size,
> >> - size_t align, void *base_addr, int off, void __percpu *ptr),
> >> + TP_PROTO(unsigned long call_site,
> >> + bool reserved, bool is_atomic, size_t size,
> >> + size_t align, void *base_addr, int off,
> >> + void __percpu *ptr, size_t bytes_alloc, gfp_t gfp_flags),
> >
> > Don't we want to preserve the order and add the call_site at the end?
> > Trace events are not ABI, but if we don't have a strong reason to break it,
> > I'd preserve the old order.
>
> I checked recent trace patches and found that order changes is acceptable.
>
> commit 8c39b8bc82aafcc8dd378bd79c76fac8e8a89c8d
> Author: David Howells <dhowells@redhat.com>
> Date: Fri Jan 14 11:44:54 2022 +0000
>
> cachefiles: Make some tracepoint adjustments
>
> - TP_printk("o=%08x i=%lx e=%d",
> - __entry->obj, __entry->ino, __entry->error)
> + TP_printk("o=%08x dB=%lx B=%lx e=%d",
> + __entry->obj, __entry->dino, __entry->ino, __entry->error)
>
> On the other hand I'm agree to keep old order by default.
> that's why I added bytes_alloc and gfp_flags to end of output.
> However I think call_site is an exception. In all cases found,
> call_site is output first.
> For me personally it simplified output parsing.
>
> So I would like to know Steven's position on this question.
Ok, not a strong opinion, I think both options are acceptable.
Thanks!
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH v2] percpu: improve percpu_alloc_percpu event trace
2022-05-11 2:33 ` [PATCH v2] percpu: improve percpu_alloc_percpu event trace Roman Gushchin
[not found] ` <30a47b4e-7c4b-cd2d-998d-cfaf8d12d342@openvz.org>
@ 2022-05-15 22:06 ` Steven Rostedt
1 sibling, 0 replies; 3+ messages in thread
From: Steven Rostedt @ 2022-05-15 22:06 UTC (permalink / raw)
To: Roman Gushchin
Cc: Vasily Averin, Shakeel Butt, Ingo Molnar, kernel, linux-kernel,
Vlastimil Babka, Michal Hocko, cgroups, Andrew Morton,
Dennis Zhou, Tejun Heo, Christoph Lameter, linux-mm,
linux-trace-users
On Tue, 10 May 2022 19:33:17 -0700
Roman Gushchin <roman.gushchin@linux.dev> wrote:
> --- a/include/trace/events/percpu.h
> > +++ b/include/trace/events/percpu.h
> > @@ -6,15 +6,20 @@
> > #define _TRACE_PERCPU_H
> >
> > #include <linux/tracepoint.h>
> > +#include <trace/events/mmflags.h>
> >
> > TRACE_EVENT(percpu_alloc_percpu,
> >
> > - TP_PROTO(bool reserved, bool is_atomic, size_t size,
> > - size_t align, void *base_addr, int off, void __percpu *ptr),
> > + TP_PROTO(unsigned long call_site,
> > + bool reserved, bool is_atomic, size_t size,
> > + size_t align, void *base_addr, int off,
> > + void __percpu *ptr, size_t bytes_alloc, gfp_t gfp_flags),
>
> Don't we want to preserve the order and add the call_site at the end?
> Trace events are not ABI, but if we don't have a strong reason to break it,
> I'd preserve the old order.
Ideally everyone should be using libtraceevent which will parse the format
file for the needed entries.
Nothing (important) should be parsing the raw ascii from the trace files.
It's slow and unreliable. The raw format (trace_pipe_raw) files, along with
libtraceevent will handle fining the fields you are looking for, even if
the fields move around (internally or externally).
Then there's trace-cruncher (a python script that uses libtracefs and
libtraceevent) that will work too.
https://github.com/vmware/trace-cruncher
-- Steve
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2022-05-15 22:06 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
[not found] <2b388d09-940e-990f-1f8a-2fdaa9210fa0@openvz.org>
[not found] ` <a07be858-c8a3-7851-9086-e3262cbcf707@openvz.org>
2022-05-11 2:33 ` [PATCH v2] percpu: improve percpu_alloc_percpu event trace Roman Gushchin
[not found] ` <30a47b4e-7c4b-cd2d-998d-cfaf8d12d342@openvz.org>
2022-05-11 17:30 ` Roman Gushchin
2022-05-15 22:06 ` Steven Rostedt
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox