Page MenuHomeFreeBSD

sbuf(9): Add NOWAIT dynamic buffer extension mode
ClosedPublic

Authored by cem on Jul 21 2019, 5:17 PM.
Tags
None
Referenced Files
Unknown Object (File)
Feb 12 2024, 10:34 AM
Unknown Object (File)
Jan 10 2024, 1:40 AM
Unknown Object (File)
Dec 22 2023, 1:39 PM
Unknown Object (File)
Dec 14 2023, 10:20 PM
Unknown Object (File)
Aug 17 2023, 2:01 PM
Unknown Object (File)
Aug 8 2023, 6:57 AM
Unknown Object (File)
Aug 8 2023, 6:57 AM
Unknown Object (File)
Aug 8 2023, 6:56 AM
Subscribers

Details

Summary

The goal is to avoid some kinds of low-memory deadlock when formatting
buffers.

Test Plan

This reconciles one of the few semantic gaps between our in-house sbuf clone
and sbuf(9).

Diff Detail

Repository
rS FreeBSD src repository - subversion
Lint
Lint Not Applicable
Unit
Tests Not Applicable

Event Timeline

Need to M_NOWAIT the allocation in sbuf_newbuf for this use case as well.

share/man/man9/sbuf.9
46 ↗(On Diff #59992)

Oops.

sys/kern/subr_sbuf.c
240 ↗(On Diff #59992)

Why do we ignore SBUF_NOWAIT in flags here? (Was this just for testing?)

Thanks!

share/man/man9/sbuf.9
46 ↗(On Diff #59992)

vim-o, will fix

sys/kern/subr_sbuf.c
240 ↗(On Diff #59992)

This one is actually constructing the struct sbuf itself. I don't see much value in a heap version of that one that gracefully handles OOM, but I don't feel strongly about it. If you'd prefer it for consistency, I'm happy to use the flag here as well.

cem marked an inline comment as done.

Fix the typo in sbuf.9

sys/kern/subr_sbuf.c
240 ↗(On Diff #59992)

I agree that it doesn’t seem useful, but I think it’s best to be consistent. If the caller passes NOWAIT, blocking in malloc would be astonishing behavior.

cem marked 2 inline comments as done.

Extend use of NOWAIT flag to initial heap sbuf allocation.

This revision is now accepted and ready to land.Jul 22 2019, 1:41 AM
This revision was automatically updated to reflect the committed changes.