00001 ######################################################################## 00002 # 00003 # PERSISTENT MEMORY TRANSACTIONS BUILD-TIME CONFIGURATION 00004 # 00005 ######################################################################## 00006 00007 00008 00009 ######################################################################## 00010 # ALLOW_ABORTS: Allows transaction aborts. When disabled and 00011 # combined with no-isolation, the TM system does not need to perform 00012 # version management for volatile data. 00013 ######################################################################## 00014 00015 ALLOW_ABORTS = False 00016 00017 ######################################################################## 00018 # SYNC_TRUNCATION: Synchronously flushes the write set out of the HW 00019 # cache and truncates the persistent log. 00020 ######################################################################## 00021 00022 SYNC_TRUNCATION = True 00023 00024 ######################################################################## 00025 # TMLOG_TYPE: Determines the type of the persistent log used. 00026 # 00027 # TMLOG_TYPE_BASE: a simple log that synchronously updates the tail on 00028 # each transaction commit/abort to properly keep track of the log 00029 # limits. 00030 # 00031 # TMLOG_TYPE_TORNBIT: a log that reserves a torn bit per 64-bit word to 00032 # detect writes that did not make it to persistent storage. Does not 00033 # require updating the tail on each transaction commit/abort. 00034 ######################################################################## 00035 00036 TMLOG_TYPE = 'TMLOG_TYPE_BASE' 00037 00038 00039 ######################################################################## 00040 # FLUSH_CACHELINE_ONCE: When asynchronously truncating the log, the log 00041 # manager flushes each cacheline of the write set only once by keeping 00042 # track flushed cachelines. This adds some bookkeeping overhead which 00043 # for some workloads might be worse than simply flushing a cacheline 00044 # multiple times. 00045 ######################################################################## 00046 00047 FLUSH_CACHELINE_ONCE = False 00048 00049 ######################################################################## 00050 ######################################################################## 00051 ######################################################################## 00052 00053 00054 00055 ######################################################################## 00056 # 00057 # GENERIC FLAGS 00058 # 00059 ######################################################################## 00060 00061 00062 ######################################################################## 00063 # Maintain detailed internal statistics. Statistics are stored in 00064 # thread locals and do not add much overhead, so do not expect much gain 00065 # from disabling them. 00066 ######################################################################## 00067 00068 INTERNAL_STATS = True 00069 00070 ######################################################################## 00071 # Roll over clock when it reaches its maximum value. Clock rollover can 00072 # be safely disabled on 64 bits to save a few cycles, but it is 00073 # necessary on 32 bits if the application executes more than 2^28 00074 # (write-through) or 2^31 (write-back) transactions. 00075 ######################################################################## 00076 00077 ROLLOVER_CLOCK = True 00078 00079 ######################################################################## 00080 # Ensure that the global clock does not share the same cache line than 00081 # some other variable of the program. This should be normally enabled. 00082 ######################################################################## 00083 00084 CLOCK_IN_CACHE_LINE = True 00085 00086 ######################################################################## 00087 # Prevent duplicate entries in read/write sets when accessing the same 00088 # address multiple times. Enabling this option may reduce performance 00089 # so leave it disabled unless transactions repeatedly read or write the 00090 # same address. 00091 ######################################################################## 00092 00093 NO_DUPLICATES_IN_RW_SETS = True 00094 00095 ######################################################################## 00096 # Yield the processor when waiting for a contended lock to be released. 00097 # This only applies to the CM_WAIT and CM_PRIORITY contention managers. 00098 ######################################################################## 00099 00100 WAIT_YIELD = True 00101 00102 ######################################################################## 00103 # Use an epoch-based memory allocator and garbage collector to ensure 00104 # that accesses to the dynamic memory allocated by a transaction from 00105 # another transaction are valid. There is a slight overhead from 00106 # enabling this feature. 00107 ######################################################################## 00108 00109 EPOCH_GC = False 00110 00111 ######################################################################## 00112 # Keep track of conflicts between transactions and notifies the 00113 # application (using a callback), passing the identity of the two 00114 # conflicting transaction and the associated threads. This feature 00115 # requires EPOCH_GC. 00116 ######################################################################## 00117 00118 CONFLICT_TRACKING = False 00119 00120 ######################################################################## 00121 # Allow transactions to read the previous version of locked memory 00122 # locations, as in the original LSA algorithm (see [DISC-06]). This is 00123 # achieved by peeking into the write set of the transaction that owns 00124 # the lock. There is a small overhead with non-contended workloads but 00125 # it may significantly reduce the abort rate, especially with 00126 # transactions that read much data. This feature only works with the 00127 # WRITE_BACK_ETL design and requires EPOCH_GC. 00128 ######################################################################## 00129 00130 READ_LOCKED_DATA = False 00131 00132 ######################################################################## 00133 # Tweak the hash function that maps addresses to locks so that 00134 # consecutive addresses do not map to consecutive locks. This can avoid 00135 # cache line invalidations for application that perform sequential 00136 # memory accesses. The last byte of the lock index is swapped with the 00137 # previous byte. 00138 ######################################################################## 00139 00140 LOCK_IDX_SWAP = True 00141 00142 ######################################################################## 00143 # Several contention management strategies are available: 00144 # 00145 # CM_SUICIDE: immediately abort the transaction that detects the 00146 # conflict. 00147 # 00148 # CM_DELAY: like CM_SUICIDE but wait until the contended lock that 00149 # caused the abort (if any) has been released before restarting the 00150 # transaction. The intuition is that the transaction will likely try 00151 # again to acquire the same lock and might fail once more if it has 00152 # not been released. In addition, this increases the chances that the 00153 # transaction can succeed with no interruption upon retry, which 00154 # improves execution time on the processor. 00155 # 00156 # CM_BACKOFF: like CM_SUICIDE but wait for a random delay before 00157 # restarting the transaction. The delay duration is chosen uniformly 00158 # at random from a range whose size increases exponentially with every 00159 # restart. 00160 # 00161 # CM_PRIORITY: cooperative priority-based contention manager that avoids 00162 # livelocks. It only works with the ETL-based design (WRITE_BACK_ETL 00163 # or WRITE_THROUGH). The principle is to give preference to 00164 # transactions that have already aborted many times. Therefore, a 00165 # priority is associated to each transaction and it increases with the 00166 # number of retries. 00167 # 00168 # A transaction that tries to acquire a lock can "reserve" it if it is 00169 # currently owned by another transaction with lower priority. If the 00170 # latter is blocked waiting for another lock, it will detect that the 00171 # former is waiting for the lock and will abort. As with CM_DELAY, 00172 # before retrying after failing to acquire some lock, we wait until 00173 # the lock we were waiting for is released. 00174 # 00175 # If a transaction fails because of a read-write conflict (detected 00176 # upon validation at commit time), we do not increase the priority. 00177 # It such a failure occurs sufficiently enough (e.g., three times in a 00178 # row, can be parametrized), we switch to visible reads. 00179 # 00180 # When using visible reads, each read is implemented as a write and we 00181 # do not allow multiple readers. The reasoning is that (1) visible 00182 # reads are expected to be used rarely, (2) supporting multiple 00183 # readers is complex and has non-negligible overhead, especially if 00184 # fairness must be guaranteed, e.g., to avoid writer starvation, and 00185 # (3) having a single reader makes lock upgrade trivial. 00186 # 00187 # To implement cooperative contention management, we associate a 00188 # priority to each transaction. The priority is used to avoid 00189 # deadlocks and to decide which transaction can proceed or must abort 00190 # upon conflict. Priorities can vary between 0 and MAX_PRIORITY. By 00191 # default we use 3 bits, i.e., MAX_PRIORITY=7, and we use the number 00192 # of retries of a transaction to specify its priority. The priority 00193 # of a transaction is encoded in the locks (when the lock bit is set). 00194 # If the number of concurrent transactions is higher than 00195 # MAX_PRIORITY+1, the properties of the CM (bound on the number of 00196 # retries) might not hold. 00197 # 00198 # The priority contention manager can be activated only after a 00199 # configurable number of retries. Until then, CM_SUICIDE is used. 00200 ######################################################################## 00201 00202 CM = 'CM_SUICIDE' 00203 00204 ######################################################################## 00205 # RW_SET_SIZE: initial size of the read and write sets. These sets will 00206 # grow dynamically when they become full. 00207 ######################################################################## 00208 00209 RW_SET_SIZE = 32768 00210 00211 ######################################################################## 00212 # LOCK_ARRAY_LOG_SIZE (default=20): number of bits used for indexes in 00213 # the lock array. The size of the array will be 2 to the power of 00214 # LOCK_ARRAY_LOG_SIZE. 00215 ######################################################################## 00216 00217 LOCK_ARRAY_LOG_SIZE = 20 00218 00219 ######################################################################## 00220 # LOCK_SHIFT_EXTRA (default=2): additional shifts to apply to the 00221 # address when determining its index in the lock array. This controls 00222 # how many consecutive memory words will be covered by the same lock 00223 # (2 to the power of LOCK_SHIFT_EXTRA). Higher values will increase 00224 # false sharing but reduce the number of CASes necessary to acquire 00225 # locks and may avoid cache line invalidations on some workloads. As 00226 # shown in [PPoPP-08], a value of 2 seems to offer best performance on 00227 # many benchmarks. 00228 ######################################################################## 00229 00230 LOCK_SHIFT_EXTRA = 2 00231 00232 ######################################################################## 00233 # PRIVATE_LOCK_ARRAY_LOG_SIZE (default=20): number of bits used for indexes 00234 # in the private pseudo-lock array. The size of the array will be 2 to 00235 # the power of PRIVATE_LOCK_ARRAY_LOG_SIZE. 00236 ######################################################################## 00237 00238 PRIVATE_LOCK_ARRAY_LOG_SIZE = 8 00239 00240 00241 ######################################################################## 00242 # MIN_BACKOFF (default=0x04UL) and MAX_BACKOFF (default=0x80000000UL): 00243 # minimum and maximum values of the exponential backoff delay. This 00244 # parameter is only used with the CM_BACKOFF contention manager. 00245 ######################################################################## 00246 00247 MIN_BACKOFF = 0x04 00248 MAX_BACKOFF = 0x80000000 00249 00250 ######################################################################## 00251 # VR_THRESHOLD_DEFAULT (default=3): number of aborts due to failed 00252 # validation before switching to visible reads. A value of 0 00253 # indicates no limit. This parameter is only used with the 00254 # CM_PRIORITY contention manager. It can also be set using an 00255 # environment variable of the same name. 00256 ######################################################################## 00257 00258 VR_THRESHOLD_DEFAULT = 3 00259 00260 ######################################################################## 00261 # CM_THRESHOLD_DEFAUL: number of executions of the transaction with a 00262 # CM_SUICIDE contention management strategy before switching to 00263 # CM_PRIORITY. This parameter is only used with the CM_PRIORITY 00264 # contention manager. It can also be set using an environment 00265 # variable of the same name. 00266 ######################################################################## 00267 00268 CM_THRESHOLD_DEFAULT = 0