This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [trans-mem] Add gl_wt TM method.


On Tue, 2011-08-30 at 00:33 +0200, Torvald Riegel wrote:
> The attached patches are several changes required for a new TM method,
> gl_wt (global lock, write-through), which is added by the last patch
> 
> patch1: Add TM-method-specific begin code. All time-based TMs need to
> know at which point in time they start working. Initializing lazily on
> the first txnal load or store would be unnecessary overhead.
> 
> patch2: A small fix for serial mode. This change should have been
> included in the previous renaming of the serial mode dispatchs.
> 
> patch3: We can't free transaction-local memory during nested commits
> unless we also go through the undo and redo logs and remove all
> references to the to-be-freed memory (otherwise, we'll undo/redo to
> privatized memory...). I guess going trough the logs is higher overhead
> than just keeping the allocations around. If we see transactions in
> practice that have large malloc/free cycles embedded in nested txns that
> are not flattened, we can still add special handling for this case.
> 
> patch4: We sometimes need to re-initialize method groups (e.g., to avoid
> overflow of counters etc.). TM methods can request this using a special
> restart reason.
> 
> patch5: The undo log is used for both thread-local and shared data
> (which are separate). Maintaining two undo logs does not provide any
> advantages. However, we have to perform undo actions to shared data
> before dispatch-specific rollback (e.g., where we release locks).
> 
> patch6: Add support for quiescence-based privatization safety (using
> gtm_thread::shared_state as the value of the current (snapshot) time of
> a transaction). Currently, this uses just spinning, but it should
> eventually be changed to block using cond vars / futexes if necessary.
> This requires more thought and tuning however, as it should probably be
> integrated with the serial lock (and it poses similar challenges, such
> as having to minimize the number of wait/wakeup calls, number of cache
> misses, etc.). Therefore, this should be addressed in a future patch.
> 
> patch7: Finally, the new TM method, gl_wt (global lock, write trough).
> This is a simple algorithm that uses a global versioned lock (aka
> ownership record or orec) together with write-through / undolog-style
> txnal writes. This has a lot of similarities to undolog-style TM methods
> that use several locks (e.g., privatization safety has to be ensured),
> but has less overhead. If update txns are frequent, it obviously won't
> scale. With the current code base, gl_wt performs better than
> serialirr_onwrite but probably mostly due spinning and restarts when the
> global lock is acquired instead of falling back to heavyweight waiting
> via futex wait/wakeup calls.
> gl_wt is in the globallock method group, to which at least another
> write-back, value-based-validation TM method will be added.

The attached two patches fix one bug in gl_wt (patch8) and one unrelated
bug that affected gl_wt (patch9).

patch8: The previous code did not handle transitions to serial mode
properly. On such a transition, a method's trycommit() and/or rollback()
functions are called when the serial lock is already acquired. This
acquisition is handled through (and stored in) gtm_thread::shared_state,
which the gl_wt method uses too. Thus, blindly overwriting shared_state
in commit/rollback doesn't work. The fix handles now detects this case
and makes gl_wt not interfere with serial mode anymore.

patch9: The previous custom TLS slot read accesses were reordered by the
compiler across non-inlined function calls. For gl_wt, this caused
restarts to operate on a stale value for abi_disp() (because this call
was moved to before the decide_retry_strategy() call, which would call
set_abi_disp). In turn, this broke gl_wt because it was being used
together with serial mode, which does not work because it tries to use
shared_state too.

Ok for branch (patches 1-9)?

Attachment: patch8
Description: Text document

Attachment: patch9
Description: Text document


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]