Page MenuHomeFreeBSD

p9fs: Refactor buffer allocations to avoid zeroing large payloads
Needs ReviewPublic

Authored by arichardson on Sat, Apr 18, 5:58 AM.
Tags
None
Referenced Files
Unknown Object (File)
Sat, Apr 18, 1:26 PM
Unknown Object (File)
Sat, Apr 18, 11:40 AM
Unknown Object (File)
Sat, Apr 18, 11:40 AM
Subscribers

Details

Reviewers
markj
kib
Summary

Allocating large buffers with M_ZERO adds unnecessary overhead since
the data is immediately overwritten. This change embeds the tc and rc
p9_buffer structs directly into p9_req_t so we only zero the small
metadata headers. The actual data payload is allocated with M_NOWAIT.

Embedding the metadata headers by value also allows the p9fs_buf_zone
UMA items to be sized exactly to P9FS_MTU, ensuring they are nicely
aligned.

This also adds proper error handling to p9_get_request() to handle
UMA allocation failures.

Diff Detail

Repository
rG FreeBSD src repository
Lint
Lint Passed
Unit
No Test Coverage
Build Status
Buildable 72316
Build 69199: arc lint + arc unit

Event Timeline

sys/fs/p9fs/p9_client.c
114

No need to check for NULL here.

124

This comment seems wrong and unhelpful.

157

With M_WAITOK the allocation is guaranteed to succeed, so this is dead code.

530

These two lines can be combined.