You are viewing a plain text version of this content. The canonical link for it is here.
Posted to cvs@httpd.apache.org by ja...@apache.org on 2023/02/19 15:15:04 UTC

svn commit: r1907756 - /httpd/httpd/trunk/modules/http2/h2.h

Author: jailletc36
Date: Sun Feb 19 15:15:03 2023
New Revision: 1907756

URL: http://svn.apache.org/viewvc?rev=1907756&view=rev
Log:
Re-order the fields of 'struct h2_session_props' to avoid a hole and some padding.

On x86_64, this shrinks the size of the struct from 40 to 32 bytes.

Before the patch, pahole states that:

struct h2_session_props {
	int                        accepted_max;         /*     0     4 */
	int                        completed_max;        /*     4     4 */
	int                        emitted_count;        /*     8     4 */
	int                        emitted_max;          /*    12     4 */
	int                        error;                /*    16     4 */

	/* XXX 4 bytes hole, try to pack */

	const char  *              error_msg;            /*    24     8 */
	unsigned int               accepting:1;          /*    32: 0  4 */
	unsigned int               shutdown:1;           /*    32: 1  4 */

	/* size: 40, cachelines: 1, members: 8 */
	/* sum members: 28, holes: 1, sum holes: 4 */
	/* sum bitfield members: 2 bits (0 bytes) */
	/* padding: 4 */
	/* bit_padding: 30 bits */
	/* last cacheline: 40 bytes */
};

Modified:
    httpd/httpd/trunk/modules/http2/h2.h

Modified: httpd/httpd/trunk/modules/http2/h2.h
URL: http://svn.apache.org/viewvc/httpd/httpd/trunk/modules/http2/h2.h?rev=1907756&r1=1907755&r2=1907756&view=diff
==============================================================================
--- httpd/httpd/trunk/modules/http2/h2.h (original)
+++ httpd/httpd/trunk/modules/http2/h2.h Sun Feb 19 15:15:03 2023
@@ -114,10 +114,10 @@ typedef struct h2_session_props {
     int completed_max;     /* the highest remote stream completed */
     int emitted_count;     /* the number of local streams sent */
     int emitted_max;       /* the highest local stream id sent */
-    int error;             /* the last session error encountered */
-    const char *error_msg; /* the short message given on the error */
     unsigned int accepting : 1;     /* if the session is accepting new streams */
     unsigned int shutdown : 1;      /* if the final GOAWAY has been sent */
+    int error;             /* the last session error encountered */
+    const char *error_msg; /* the short message given on the error */
 } h2_session_props;
 
 typedef enum h2_stream_state_t {