Remove padding in XLogCtl; might be a good idea, but let's keep it simple
authorHeikki Linnakangas <heikki@enterprisedb.com>
Tue, 27 Jan 2009 08:10:52 +0000 (10:10 +0200)
committerHeikki Linnakangas <heikki@enterprisedb.com>
Tue, 27 Jan 2009 08:10:52 +0000 (10:10 +0200)
for now.

Also remove the XLogCtl->mode_lck spinlock, which is pretty pointless for
a single boolean that's only written by one process.

src/backend/access/transam/xlog.c

index 6b687911203decb6cf6396ff735eca9350b8e299..f311a9f3cea88baac56203c9c26ef1627bc63687 100644 (file)
@@ -317,18 +317,11 @@ typedef struct XLogCtlWrite
 
 /*
  * Total shared-memory state for XLOG.
- *
- * This small structure is accessed by many backends, so we take care to
- * pad out the parts of the structure so they can be accessed by separate
- * CPUs without causing false sharing cache flushes. Padding is generous
- * to allow for a wide variety of CPU architectures.
  */
-#define        XLOGCTL_BUFFER_SPACING  128
 typedef struct XLogCtlData
 {
        /* Protected by WALInsertLock: */
        XLogCtlInsert Insert;
-       char    InsertPadding[XLOGCTL_BUFFER_SPACING - sizeof(XLogCtlInsert)];
 
        /* Protected by info_lck: */
        XLogwrtRqst LogwrtRqst;
@@ -336,16 +329,9 @@ typedef struct XLogCtlData
        uint32          ckptXidEpoch;   /* nextXID & epoch of latest checkpoint */
        TransactionId ckptXid;
        XLogRecPtr      asyncCommitLSN; /* LSN of newest async commit */
-       /* add data structure padding for above info_lck declarations */
-       char    InfoPadding[XLOGCTL_BUFFER_SPACING - sizeof(XLogwrtRqst) 
-                                                                                       - sizeof(XLogwrtResult)
-                                                                                       - sizeof(uint32)
-                                                                                       - sizeof(TransactionId)
-                                                                                       - sizeof(XLogRecPtr)];
 
        /* Protected by WALWriteLock: */
        XLogCtlWrite Write;
-       char    WritePadding[XLOGCTL_BUFFER_SPACING - sizeof(XLogCtlWrite)];
 
        /*
         * These values do not change after startup, although the pointed-to pages
@@ -367,13 +353,8 @@ typedef struct XLogCtlData
         * always during Recovery Processing Mode. This allows us to identify
         * code executed *during* Recovery Processing Mode but not necessarily
         * by Startup process itself.
-        *
-        * Protected by mode_lck
         */
        bool            SharedRecoveryProcessingMode;
-       slock_t         mode_lck;
-
-       char            InfoLockPadding[XLOGCTL_BUFFER_SPACING];
 
        slock_t         info_lck;               /* locks shared variables shown above */
 } XLogCtlData;
@@ -4374,7 +4355,6 @@ XLOGShmemInit(void)
        XLogCtl->XLogCacheBlck = XLOGbuffers - 1;
        XLogCtl->Insert.currpage = (XLogPageHeader) (XLogCtl->pages);
        SpinLockInit(&XLogCtl->info_lck);
-       SpinLockInit(&XLogCtl->mode_lck);
 
        /*
         * If we are not in bootstrap mode, pg_control should already exist. Read