[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Date: Tue, 08 Sep 2020 19:49:52 -0700 (PDT)
From: David Miller <davem@...emloft.net>
To: dust.li@...ux.alibaba.com
Cc: kuba@...nel.org, edumazet@...gle.com, satoru.moriya@....com,
netdev@...r.kernel.org
Subject: Re: [PATCH v2] net: tracepoint: fix print wrong sysctl_mem value
From: Dust Li <dust.li@...ux.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.
Powered by blists - more mailing lists