The branch main has been updated by markj:

URL: 
https://cgit.FreeBSD.org/src/commit/?id=97cf43ebc5c9cd4b43190ba2b1ff3d0e0f9372cc

commit 97cf43ebc5c9cd4b43190ba2b1ff3d0e0f9372cc
Author:     Mark Johnston <ma...@freebsd.org>
AuthorDate: 2021-09-07 18:45:22 +0000
Commit:     Mark Johnston <ma...@freebsd.org>
CommitDate: 2021-09-07 18:59:24 +0000

    socket: Reorder socket and sockbuf fields to eliminate some padding
    
    This is in preparation for moving sockbuf locks into the owning socket,
    in order to provide proper interlocking for listen(2).  In particular,
    listening sockets do not use the socket buffers and repurpose that space
    in struct socket for their own purposes.  Moving the locks out of the
    socket buffers and into the socket proper makes it possible to safely
    lock socket buffers and test for a listening socket before deciding how
    to proceed.
    
    Reordering these fields saves some space and helps ensure that UMA will
    provide the same space efficiency for sockets as before.  No functional
    change intended.
    
    Reviewed by:    tuexen, gallatin
    Sponsored by:   The FreeBSD Foundation
    Differential Revision:  https://reviews.freebsd.org/D31656
---
 sys/sys/sockbuf.h   | 4 ++--
 sys/sys/socketvar.h | 4 ++--
 2 files changed, 4 insertions(+), 4 deletions(-)

diff --git a/sys/sys/sockbuf.h b/sys/sys/sockbuf.h
index 4c56f4eaf234..e7a4c8883054 100644
--- a/sys/sys/sockbuf.h
+++ b/sys/sys/sockbuf.h
@@ -85,7 +85,8 @@ struct        sockbuf {
        struct  sx sb_sx;               /* prevent I/O interlacing */
        struct  selinfo *sb_sel;        /* process selecting read/write */
        short   sb_state;       /* (a) socket state on sockbuf */
-#define        sb_startzero    sb_mb
+#define        sb_startzero    sb_flags
+       short   sb_flags;       /* (a) flags, see above */
        struct  mbuf *sb_mb;    /* (a) the mbuf chain */
        struct  mbuf *sb_mbtail; /* (a) the last mbuf in the chain */
        struct  mbuf *sb_lastrecord;    /* (a) first mbuf of last
@@ -109,7 +110,6 @@ struct      sockbuf {
        struct  ktls_session *sb_tls_info; /* (a + b) TLS state */
        struct  mbuf *sb_mtls;  /* (a) TLS mbuf chain */
        struct  mbuf *sb_mtlstail; /* (a) last mbuf in TLS chain */
-       short   sb_flags;       /* (a) flags, see above */
        int     (*sb_upcall)(struct socket *, void *, int); /* (a) */
        void    *sb_upcallarg;  /* (a) */
        TAILQ_HEAD(, kaiocb) sb_aiojobq; /* (a) pending AIO ops */
diff --git a/sys/sys/socketvar.h b/sys/sys/socketvar.h
index 47033fdabbfa..506a328b1e0a 100644
--- a/sys/sys/socketvar.h
+++ b/sys/sys/socketvar.h
@@ -91,13 +91,13 @@ struct socket {
        volatile u_int  so_count;       /* (b / refcount) */
        struct selinfo  so_rdsel;       /* (b/cr) for so_rcv/so_comp */
        struct selinfo  so_wrsel;       /* (b/cs) for so_snd */
-       short   so_type;                /* (a) generic type, see socket.h */
        int     so_options;             /* (b) from socket call, see socket.h */
-       short   so_linger;              /* time to linger close(2) */
+       short   so_type;                /* (a) generic type, see socket.h */
        short   so_state;               /* (b) internal state flags SS_* */
        void    *so_pcb;                /* protocol control block */
        struct  vnet *so_vnet;          /* (a) network stack instance */
        struct  protosw *so_proto;      /* (a) protocol handle */
+       short   so_linger;              /* time to linger close(2) */
        short   so_timeo;               /* (g) connection timeout */
        u_short so_error;               /* (f) error affecting connection */
        u_short so_rerror;              /* (f) error affecting connection */
_______________________________________________
dev-commits-src-main@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/dev-commits-src-main
To unsubscribe, send any mail to "dev-commits-src-main-unsubscr...@freebsd.org"

Reply via email to