File tree Expand file tree Collapse file tree 1 file changed +16
-0
lines changed
Expand file tree Collapse file tree 1 file changed +16
-0
lines changed Original file line number Diff line number Diff line change @@ -227,6 +227,22 @@ impl UdpSocket {
227227 }
228228
229229 /// Sends a message on the socket using a msghdr.
230+ ///
231+ /// Returns a tuple of:
232+ ///
233+ /// * Result containing bytes written on success
234+ /// * The original `io_slices` Vec<T>
235+ /// * The original `msg_contol` Option<U>
236+ ///
237+ /// See the linux [kernel docs](https://www.kernel.org/doc/html/latest/networking/msg_zerocopy.html)
238+ /// for a discussion on when this might be appropriate. In particular:
239+ ///
240+ /// > Copy avoidance is not a free lunch. As implemented, with page pinning,
241+ /// > it replaces per byte copy cost with page accounting and completion
242+ /// > notification overhead. As a result, zero copy is generally only effective
243+ /// > at writes over around 10 KB.
244+ ///
245+ /// Note: Using fixed buffers [#54](https://github.com/tokio-rs/tokio-uring/pull/54), avoids the page-pinning overhead
230246 pub async fn sendmsg_zc < T : IoBuf , U : IoBuf > (
231247 & self ,
232248 io_slices : Vec < T > ,
You can’t perform that action at this time.
0 commit comments