Page MenuHomeFreeBSD

More re-working of multipage mbufs.
ClosedPublic

Authored by glebius on Apr 27 2020, 6:26 PM.
Tags
None
Referenced Files
Unknown Object (File)
Mar 10 2024, 5:38 PM
Unknown Object (File)
Mar 10 2024, 5:33 PM
Unknown Object (File)
Mar 10 2024, 5:33 PM
Unknown Object (File)
Mar 10 2024, 5:21 PM
Unknown Object (File)
Dec 20 2023, 6:56 AM
Unknown Object (File)
Dec 1 2023, 11:45 PM
Unknown Object (File)
Nov 11 2023, 8:52 PM
Unknown Object (File)
Nov 10 2023, 4:34 PM
Subscribers

Details

Summary

This is a straight continuation of D24213.

Now that array of pages is embedded into mbuf, we no longer need
separate structure to pass around, so struct mbuf_ext_pgs is an
artifact of the first implementation. And struct mbuf_ext_pgs_data
is a crutch to accomodate the main idea D24213 with minimal churn.
This change embeds into mbuf and anonymizes both of them.

Also, M_EXT of type EXT_PGS became just a synonym of M_NOMAP, so
clear that.

Also, bring all multi-page mbuf stuff together into a consistent
namespace. Now, a multipage mbuf has M_EXTPG flag on it, and that
means that all struct members that have name starting with m_epg are
enabled. Functions and macros that work with M_EXTPG also renamed into
similar namespace.

While working on this removed some redundant fields and assignments.

We probably can pack one more page into mbuf, but this is out of scope
of this patch.

To be committed in several steps, that can be reviewed in git:

https://github.com/glebius/FreeBSD/commits/m_epg

P.S. A logical continuation of this would be anonymization of
struct m_ext, sorting out fields that are shared with M_EXT and M_EXTPG,
and those that are not, sprinkling better comments and assertions. TBD.

Diff Detail

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

Event Timeline

bz added inline comments.
sys/kern/kern_mbuf.c
855 ↗(On Diff #71073)

That once was like 220 bytes on the stack? Is that a problem these days?

sys/kern/kern_mbuf.c
855 ↗(On Diff #71073)

Its using less space than before.. (256b for an entire mbuf) and there is precedent for other code in the kernel putting mbufs on the stack. The smallest default stacks seem to be 2 4K pages on 32 bit arm/ppc, so even on those platforms, 220b is less than 3% of available stack space.

glebius added inline comments.
sys/kern/kern_mbuf.c
855 ↗(On Diff #71073)

It is okay to put an mbuf on stack. There are/were other places like that. Note that this patch even reduces the stack usage from full mbuf to MHLEN.

This revision was not accepted when it landed; it landed in state Needs Review.May 2 2020, 10:39 PM
This revision was automatically updated to reflect the committed changes.