Re: [PATCH 1/2] net/mlx5: pre-initialize sprintf buffers

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



在 2024/2/20 14:57, Yevgeny Kliteynik 写道:
On 20-Feb-24 07:50, Zhu Yanjun wrote:
External email: Use caution opening links or attachments


在 2024/2/19 18:04, Arnd Bergmann 写道:
From: Arnd Bergmann <arnd@xxxxxxxx>

The debugfs files always in this driver all use an extra round-trip
through an snprintf() before getting put into a mlx5dr_dbg_dump_buff()
rather than the normal seq_printf().

Zhu Yanjun noticed that the buffers are not initialized before being
filled or reused and requested them to always be zeroed as a
preparation for having more reused between the buffers.

I think that you are the first to find this.

The buffers are not initialized intentionally.
The content is overwritten from the buffer's beginning.
Initializing is not needed as it will only cause perf degradation.

If the mentioned functions are not in the critical path, this initialization will not make too much difference on the performance.

But if this function knows how many bytes are written and read, it is not necessary to initialize the buffer. Or else we should initialize the buffer before it is used again.

Zhu Yanjun


-- YK







[Index of Archives]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Photo]     [Yosemite News]     [Yosemite Photos]     [Linux Kernel]     [Linux SCSI]     [XFree86]

  Powered by Linux