diff options
| author | Namjae Jeon <linkinjeon@kernel.org> | 2026-06-26 10:49:16 +0900 |
|---|---|---|
| committer | Steve French <stfrench@microsoft.com> | 2026-06-30 21:29:46 -0500 |
| commit | 6b9a2e09d4cc5cea824ce4b457bf91dffa4a41cb (patch) | |
| tree | 21ec3b7e87ceeaa526e4cff6ef99fdbe74346710 /drivers | |
| parent | 47f0b34f6bc98ed85bfdc293e8f3e432ec24958d (diff) | |
ksmbd: avoid zeroing the read buffer in smb2_read()
smb2_read() allocates the read payload buffer with kvzalloc(), zeroing up
to max_read_size bytes (1MB or more with multichannel) on every read,
only to immediately overwrite the region with file data via kernel_read().
The zero-fill is pure overhead: ksmbd_vfs_read() returns the number of
bytes actually read ('nbytes'), and only those nbytes are ever consumed -
they are pinned into the response iov (ksmbd_iov_pin_rsp_read()), sent
over the RDMA channel (smb2_read_rdma_channel()), or copied by the
compression path (ksmbd_compress_response() uses iov_len == nbytes). The
ALIGN(length, 8) tail padding and any short-read remainder are never read
or transmitted, so they need not be initialized.
Use kvmalloc() instead to skip the redundant zeroing. This reduces CPU
and memory-bandwidth usage on large sequential reads.
Signed-off-by: Namjae Jeon <linkinjeon@kernel.org>
Signed-off-by: Steve French <stfrench@microsoft.com>
Diffstat (limited to 'drivers')
0 files changed, 0 insertions, 0 deletions
