On Fri, Jan 24, 2025 at 07:16:40AM -0800, Breno Leitao wrote:
> Move the static buffers from send_msg_no_fragmentation() and
> send_msg_fragmented() into the netconsole_target structure. This
> simplifies the code by:
> - Eliminating redundant static buffers
> - Centralizing buffer management in the target structure
> - Reducing memory usage by 1KB (one buffer instead of two)
> 
> The buffer in netconsole_target is protected by target_list_lock,
> maintaining the same synchronization semantics as the original code.
> 
> Suggested-by: Jakub Kicinski <k...@kernel.org>
> Signed-off-by: Breno Leitao <lei...@debian.org>
> ---
>  drivers/net/netconsole.c | 29 +++++++++++++++--------------
>  1 file changed, 15 insertions(+), 14 deletions(-)
> 
> diff --git a/drivers/net/netconsole.c b/drivers/net/netconsole.c
> index 
> 86ab4a42769a49eebe5dd6f01dafafc6c86ec54f..1a78704681184673f5c1ba8ae665e46751384293
>  100644
> --- a/drivers/net/netconsole.c
> +++ b/drivers/net/netconsole.c
> @@ -137,6 +137,8 @@ struct netconsole_target {
>       bool                    extended;
>       bool                    release;
>       struct netpoll          np;
> +     /* protected by target_list_lock */
> +     char                    buf[MAX_PRINT_CHUNK];

nit: buf should also be added to the Kernel doc for this structure.

...

Reply via email to