[Bug 204438] setsockopt() handling of kern.ipc.maxsockbuf limit

bugzilla-noreply at freebsd.org bugzilla-noreply at freebsd.org
Thu Nov 12 18:20:09 UTC 2015


https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=204438

Alfred Perlstein <alfred at FreeBSD.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |alfred at FreeBSD.org

--- Comment #13 from Alfred Perlstein <alfred at FreeBSD.org> ---
I believe the reason for the adjustment is that "sb_max" is for "max kernel
memory taken by the socketbuffer INCLUDING MBUFS THEMSELVES"

So what is actually happening is that each MCLSIZE (size of cluster) of "data"
is having MSIZE (size of mbuf) added to it.

Why is it scaled up so?  Because in reality one needs MSIZE actual memory for
each cluster as metadata to point to it.

And why is this done?  So that you can actually trust "sb_max" to mean maximum
kernel memory taken to support N bytes per socket.

I didn't realize Linux silents truncates the requested amount, that's a little
scary, however I'm learning to trust more and more what Linux does.

What might make a bit more sense in the long run is actually to make:

1) kern.ipc.maxsockbuf == max number of bytes of DATA in each socketbuffer
2) kern.ipc.maxsockbufmeta = max number of bytes of DATA + METADATA required to
be allocated.

-- 
You are receiving this mail because:
You are the assignee for the bug.


More information about the freebsd-net mailing list