Page MenuHomeFreeBSD

p9fs: Refactor buffer allocations to avoid zeroing large payloads
AcceptedPublic

Authored by arichardson on Sat, Apr 18, 5:58 AM.
Tags
None
Referenced Files
F156669165: D56495.id177352.diff
Fri, May 15, 1:42 PM
F156653783: D56495.id.diff
Fri, May 15, 10:35 AM
Unknown Object (File)
Thu, May 14, 7:53 PM
Unknown Object (File)
Thu, May 14, 7:12 PM
Unknown Object (File)
Thu, May 14, 6:46 PM
Unknown Object (File)
Wed, May 13, 9:49 AM
Unknown Object (File)
Wed, May 13, 6:24 AM
Unknown Object (File)
Tue, May 12, 3:00 PM
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 72872
Build 69755: arc lint + arc unit

Event Timeline

sys/fs/p9fs/p9_client.c
113

No need to check for NULL here.

118–119

This comment seems wrong and unhelpful.

149–150

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

512

These two lines can be combined.

jhb added inline comments.
sys/fs/p9fs/p9_client.c
156

Given that p9_buffer_alloc() uses M_WAITOK, this is also dead code. You could just change p9_buffer_alloc to return void given its use of M_WAITOK.

arichardson marked 5 inline comments as done.

address feedback

sys/fs/p9fs/p9_client.c
127

Is this NULL check actually needed?

sys/fs/p9fs/p9_client.c
127

Maybe, I didn't audit all callers.

149–150

Oh yes, let me simplify it.

This revision is now accepted and ready to land.Sun, May 10, 5:25 PM