Page MenuHomeFreeBSD

Introduce m_get3()
ClosedPublic

Authored by kp on Aug 7 2021, 8:05 PM.
Tags
None
Referenced Files
Unknown Object (File)
Tue, Mar 19, 11:22 PM
Unknown Object (File)
Tue, Mar 19, 7:53 PM
Unknown Object (File)
Thu, Mar 7, 8:55 PM
Unknown Object (File)
Sat, Mar 2, 6:49 AM
Unknown Object (File)
Jan 14 2024, 10:02 AM
Unknown Object (File)
Jan 1 2024, 7:48 AM
Unknown Object (File)
Dec 20 2023, 7:25 AM
Unknown Object (File)
Nov 26 2023, 5:06 PM

Details

Summary

Introduce m_get3() which is similar to m_get2(), but can allocate up to
MJUM16BYTES bytes (m_get2() can only allocate up to MJUMPAGESIZE).

This simplifies the bpf improvement in f13da24715.

Suggested by: glebius

Diff Detail

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

Event Timeline

kp requested review of this revision.Aug 7 2021, 8:05 PM

Q: why can’t we extend m_get2 to not fail for 9..16k packets?

Please do not introduce new usages of mbuf clusters > PAGE_SIZE into
the network stack. When under memory pressure attempting to
allocating >PAGE_SIZE clusters will DoS the whole system if done at
the packet rates seen on modern networks.

Please do not introduce new usages of mbuf clusters > PAGE_SIZE into
the network stack. When under memory pressure attempting to
allocating >PAGE_SIZE clusters will DoS the whole system if done at
the packet rates seen on modern networks.

This particular use case (in f13da24715a7) is for bpf, so not directly in the data path, and it shouldn't be allocating millions of times per second. I suppose that does form a good argument for not extending m_get2() rather than having an m_get3() (or keeping the current bpf approach of m_get2()/m_getjcl()).

glebius added a subscriber: glebius.
glebius added inline comments.
sys/kern/kern_mbuf.c
1388

Can we short circuit beginning of the function to m_get2()?

if (size <= MJUMPAGESIZE)

return (m_get2(size, how, type, flags);
1412

Should be updated to m_free_raw(m) after the recent changes.

This revision is now accepted and ready to land.Aug 16 2021, 4:45 PM
This revision now requires review to proceed.Aug 17 2021, 7:09 AM
This revision is now accepted and ready to land.Aug 17 2021, 5:19 PM
This revision was automatically updated to reflect the committed changes.