tevent: reorder tevent_context for cache locality
authorVolker Lendecke <vl@samba.org>
Mon, 8 Aug 2016 06:56:23 +0000 (08:56 +0200)
committerJeremy Allison <jra@samba.org>
Tue, 23 Aug 2016 23:33:48 +0000 (01:33 +0200)
No functionality change. This just looks better in objdump --disassemble :-)

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
lib/tevent/tevent_internal.h

index 6b29547427ce36551a629c5bdc386f4295ac8a0e..f17ce9403652c72b5e0d0b0e548e9e0635e3208f 100644 (file)
@@ -246,25 +246,32 @@ struct tevent_context {
        /* the specific events implementation */
        const struct tevent_ops *ops;
 
+       /*
+        * The following three pointers are queried on every loop_once
+        * in the order in which they appear here. Not measured, but
+        * hopefully putting them at the top together with "ops"
+        * should make tevent a *bit* more cache-friendly than before.
+        */
+
+       /* list of signal events - used by common code */
+       struct tevent_signal *signal_events;
+
+       /* List of threaded job indicators */
+       struct tevent_threaded_context *threaded_contexts;
+
+       /* list of immediate events - used by common code */
+       struct tevent_immediate *immediate_events;
+
        /* list of fd events - used by common code */
        struct tevent_fd *fd_events;
 
        /* list of timed events - used by common code */
        struct tevent_timer *timer_events;
 
-       /* List of threaded job indicators */
-       struct tevent_threaded_context *threaded_contexts;
-
        /* List of scheduled immediates */
        pthread_mutex_t scheduled_mutex;
        struct tevent_immediate *scheduled_immediates;
 
-       /* list of immediate events - used by common code */
-       struct tevent_immediate *immediate_events;
-
-       /* list of signal events - used by common code */
-       struct tevent_signal *signal_events;
-
        /* this is private for the events_ops implementation */
        void *additional_data;