[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <38135333-b277-1b1b-8346-1da2e1f114a7@gmail.com>
Date: Mon, 4 Jul 2022 13:09:01 -0600
From: David Ahern <dsahern@...il.com>
To: Steven Rostedt <rostedt@...dmis.org>,
LKML <linux-kernel@...r.kernel.org>
Cc: "David S. Miller" <davem@...emloft.net>,
netdev <netdev@...r.kernel.org>
Subject: Re: [PATCH v2] tracing/ipv4/ipv6: Use static array for name field in
fib*_lookup_table event
On 7/4/22 7:14 AM, Steven Rostedt wrote:
> From: "Steven Rostedt (Google)" <rostedt@...dmis.org>
>
> The fib_lookup_table and fib6_lookup_table events declare name as a
> dynamic_array, but also give it a fixed size, which defeats the purpose of
> the dynamic array, especially since the dynamic array also includes meta
> data in the event to specify its size.
>
> Since the size of the name is at most 16 bytes (defined by IFNAMSIZ),
> it is not worth spending the effort to determine the size of the string.
>
> Just use a fixed size array and copy into it. This will save 4 bytes that
> are used for the meta data that saves the size and position of a dynamic
> array, and even slightly speed up the event processing.
>
> Cc: David Ahern <dsahern@...il.com>
> Cc: David S. Miller <davem@...emloft.net>
> Cc: netdev@...r.kernel.org
> Signed-off-by: Steven Rostedt (Google) <rostedt@...dmis.org>
> ---
> Changes since v1: https://lkml.kernel.org/r/20220703102359.30f12e39@rorschach.local.home
> - Just use a fixed size array instead of calculating the
> size needed for the dynamic allocation.
>
> include/trace/events/fib.h | 6 +++---
> include/trace/events/fib6.h | 8 ++++----
> 2 files changed, 7 insertions(+), 7 deletions(-)
>
Reviewed-by: David Ahern <dsahern@...nel.org>
Powered by blists - more mailing lists