Page MenuHomeFreeBSD

mbuf: provide mc_get() that allocates struct mchain of given length
ClosedPublic

Authored by glebius on Feb 29 2024, 7:03 AM.
Tags
None
Referenced Files
Unknown Object (File)
Sun, Apr 14, 5:44 PM
Unknown Object (File)
Mon, Apr 8, 9:27 PM
Unknown Object (File)
Sat, Apr 6, 11:13 AM
Unknown Object (File)
Sun, Mar 31, 1:43 AM
Unknown Object (File)
Mar 4 2024, 3:07 AM
Unknown Object (File)
Mar 2 2024, 2:58 AM
Subscribers

Details

Summary

Implement m_getm2(), which is widely used via m_getm() macro, as a wrapper
around mc_get(). New code is advised to use mc_get().

Diff Detail

Repository
rG FreeBSD src repository
Lint
Lint Not Applicable
Unit
Tests Not Applicable

Event Timeline

This revision is now accepted and ready to land.Feb 29 2024, 9:39 AM
markj added inline comments.
sys/kern/kern_mbuf.c
1454

Please don't have len and length in the same function.

1469

Please explain the reason inline, e.g., "this avoids blocking if the jumbop zone is exhausted, for example by an ongoing DoS." Code comments should be self-contained.

sys/sys/mbuf.h
1787

Keep these alphabetically sorted? It'd also be a bit neater to put these after all of the mc_ inline function definitions.

This revision now requires review to proceed.Mar 16 2024, 6:10 PM
glebius added inline comments.
sys/kern/kern_mbuf.c
1469

To be fair I don't full agree with what had been done in 796d4eb89e2c, although I'm listed as reviewer. It addresses a specific problem that appeared under specific conditions with specific hardware configuration. It won't work if a NIC driver used 2k mbufs to fill rings. It won't work if limits set on 4k and 2k zones were configured differently.

The new mc_get() would be git blamed fully to my name, but I want to redirect people who question the M_NOWAIT into the proper place where this M_NOWAIT comes from.

So I ended up with providing a full sentence as you suggest, but kept external reference, too.

markj added inline comments.
sys/kern/kern_mbuf.c
1502

IMO it would be nice to provide mc_first() and mc_last() accessors.

This revision is now accepted and ready to land.Mar 18 2024, 5:16 AM