From: Dust Li <dust...@linux.alibaba.com>
Date: Tue,  8 Sep 2020 10:09:39 +0800

> @@ -98,7 +98,7 @@ TRACE_EVENT(sock_exceed_buf_limit,
>  
>       TP_STRUCT__entry(
>               __array(char, name, 32)
> -             __field(long *, sysctl_mem)
> +             __array(long, sysctl_mem, 3)
>               __field(long, allocated)
>               __field(int, sysctl_rmem)
>               __field(int, rmem_alloc)
> @@ -110,7 +110,9 @@ TRACE_EVENT(sock_exceed_buf_limit,
>  
>       TP_fast_assign(
>               strncpy(__entry->name, prot->name, 32);
> -             __entry->sysctl_mem = prot->sysctl_mem;
> +             __entry->sysctl_mem[0] = prot->sysctl_mem[0];
> +             __entry->sysctl_mem[1] = prot->sysctl_mem[1];
> +             __entry->sysctl_mem[2] = prot->sysctl_mem[2];

I can't understand at all why the current code doesn't work.

We assign a pointer to entry->sysctl_mem and then print out the
three words pointed to by that.

It's so wasteful to copy this over every tracepoint entry so
the pointer approach is very desirable.

Reply via email to