The Tile platform doesn't natively support atomic operations other than
4-byte and 8-byte.  Although our runtime can handle subword atomics (by
doing a word-aligned read, inserting the sub-word properly, and trying
compare-and-exchange) it is more efficient to use word-size atomics where
possible.  I suspect this may also be true for other non-Intel platforms,
and certainly the top of rsyslog's runtime/atomic.h does say "THESE MACROS
MUST ONLY BE USED WITH WORD-SIZED DATA TYPES!".

The attached patch against 6.1.0 converts msg_t's iRefCount from short to
int, and moves it in the structure so that the neighboring sbool and short
types can be packed more efficiently.

-- 
Chris Metcalf, Tilera Corp.
http://www.tilera.com



--- rsyslog-6.1.0/runtime/msg.h.orig    2010-11-22 09:42:22.971057000 -0500
+++ rsyslog-6.1.0/runtime/msg.h 2010-11-22 09:43:19.100110000 -0500
@@ -60,8 +60,8 @@
        flowControl_t flowCtlType; /**< type of flow control we can apply, for 
enqueueing, needs not to be persisted because
                                        once data has entered the queue, this 
property is no longer needed. */
        pthread_mutex_t mut;
+       int     iRefCount;      /* reference counter (0 = unused) */
        sbool   bDoLock;         /* use the mutex? */
-       short   iRefCount;      /* reference counter (0 = unused) */
        short   iSeverity;      /* the severity 0..7 */
        short   iFacility;      /* Facility code 0 .. 23*/
        short   offAfterPRI;    /* offset, at which raw message WITHOUT PRI 
part starts in pszRawMsg */


_______________________________________________
rsyslog mailing list
http://lists.adiscon.net/mailman/listinfo/rsyslog
http://www.rsyslog.com

Reply via email to