Page MenuHomeFreeBSD

m_uiotombuf: write total memory length of the allocated chain in pkthdr
ClosedPublic

Authored by glebius on May 23 2022, 9:02 PM.
Tags
None
Referenced Files
Unknown Object (File)
Sat, Feb 1, 5:07 AM
Unknown Object (File)
Fri, Jan 31, 3:01 PM
Unknown Object (File)
Mon, Jan 27, 4:59 PM
Unknown Object (File)
Sun, Jan 26, 6:18 PM
Unknown Object (File)
Thu, Jan 23, 10:39 AM
Unknown Object (File)
Sun, Jan 19, 11:13 PM
Unknown Object (File)
Nov 20 2024, 9:03 AM
Unknown Object (File)
Nov 12 2024, 2:47 AM
Subscribers

Details

Summary

Data allocated by m_uiotombuf() usually goes into a socket buffer.
We are interested in the length of useful data to be added to sb_ccc,
as well as total memory used by mbufs. The later would be added to
sb_mbcnt. Calculating this value at allocation time allows to save
on extra traversal of the mbuf chain.

Diff Detail

Repository
rS FreeBSD src repository - subversion
Lint
Lint Passed
Unit
No Test Coverage
Build Status
Buildable 45682
Build 42570: arc lint + arc unit

Event Timeline

sys/sys/mbuf.h
209

How is a consumer supposed to know whether memlen is populated or not? It sounds very general but it's only set by m_uiotombuf().

How do we know that setting memlen won't clobber a field in PH_loc? I'm not very familiar with PH_loc's usage so it's not clear to me.

sys/sys/mbuf.h
209

At this moment m_uiotombuf() supports it, but other chain allocation functions can and should support it future.

The PH_loc belongs to a subsystem that is sure it owns the mbuf. For a freshly allocated mbuf this works perfect.

This revision is now accepted and ready to land.May 30 2022, 1:20 PM