Skip to content
Snippets Groups Projects
  1. Jan 15, 2022
  2. Dec 14, 2021
  3. Dec 13, 2021
  4. Dec 10, 2021
    • Florian Fischer's avatar
      [CI] print the number of available CPUs · 2653df7e
      Florian Fischer authored
      2653df7e
    • Florian Fischer's avatar
      Introduce waitfree workstealing · 1c538024
      Florian Fischer authored
      Waitfree work stealing is configured with the meson option
      'waitfree_work_stealing'.
      
      The retry logic is intentionally left in the Queues and not lifted to
      the scheduler to reuse the load of an unsuccessful CAS.
      
      Consider the following pseudo code examples:
      
      steal() -> bool:                       steal() -> res
        load                                   load
      loop:                                    if empty return EMPTY
        if empty return EMPTY                  cas
        cas                                    return cas ? STOLEN : LOST_RACE
        if not WAITFREE and not cas:
          goto loop                          outer():
        return cas ? STOLEN : LOST_RACE      loop:
                                               res = steal()
      outer():                                 if not WAITFREE and res == LOST_RACE:
        steal()                                  goto loop
      
      In the right example the value loaded by a possible unsuccessful CAS
      can not be reused. And a loop of unsuccessful CAS' will result in
      double loads.
      
      The retries are configurable through a template variable maxRetries.
      * maxRetries < 0: indefinitely retries
      * maxRetries >= 0: maxRetries
      1c538024
  5. Dec 08, 2021
  6. Dec 06, 2021
  7. Oct 28, 2021
  8. Oct 13, 2021
    • Florian Fischer's avatar
      [meson] introduce lockless memory order and rename lockless option · 67b0c77a
      Florian Fischer authored
      The lockless algorithm can now be configured by setting -Dio_lockless_cq=true
      and the used memory ordering by setting -Dio_lockless_memory_order={weak,strong}.
      
      io_lockless_memory_order=weak:
          read with acquire
          write with release
      
      io_lockless_memory_order=strong:
          read with seq_cst
          write with seq_cst
      67b0c77a
  9. Oct 11, 2021
    • Florian Fischer's avatar
      [IoContext] implement lockless CQ reaping · d9d350d9
      Florian Fischer authored
      TODO: think about stats and possible ring buffer pointers overflow and ABA.
      d9d350d9
    • Florian Fischer's avatar
      implement IO stealing · 0abc29ad
      Florian Fischer authored
      IO stealing is analog to work-stealing and means that worker thread
      without work will try to steal IO completions (CQEs) from other worker's
      IoContexts. The work stealing algorithm is modified to check a victims
      CQ after findig their work queue empty.
      
      This approach in combination with future additions (global notifications
      on IO completions, and lock free CQE consumption) are a realistic candidate
      to replace the completer thread without loosing its benefits.
      
      To allow IO stealing the CQ must be synchronized which is already the
      case with the IoContext::cq_lock.
      Currently stealing workers always try to pop a single CQE (this could
      be configurable).
      Steal attempts are recorded in the IoContext's Stats object and
      successfully stolen IO continuations in the AbstractWorkStealingWorkerStats.
      
      I moved the code transforming CQEs into continuation Fibers from
      reapCompletions into a seperate function to make the rather complicated
      function more readable and thus easier to understand.
      
      Remove the default CallerEnvironment template arguments to make
      the code more explicit and prevent easy errors (not propagating
      the caller environment or forgetting the function takes a caller environment).
      
      io::Stats now need to use atomics because multiple thread may increment
      them in parallel from EMPER and the OWNER.
      And since using std::atomic<T*> in std::map is not easily possible we
      use the compiler __atomic_* builtins.
      
      Add, adjust and fix some comments.
      0abc29ad
  10. Oct 04, 2021
    • Florian Fischer's avatar
      [WakeupStrategy] fix the throttle algorithm for notifiaction from anywhere · baedc874
      Florian Fischer authored
      The throttle algorithm had the same problem like our sleep algorithms
      where notifications from anywhere may race with a worker going to
      sleep resulting in lost wakeups.
      In the sleep strategy we prevent those races by preventing sleep attempts
      when notifing from anywhere.
      The throttle algorithm also does now exactly this. A notifier from anywhere
      will now always set the WakeupStrategy state to notified.
      If the state was previously pending this new approach does not differ from
      the previous behavior and a sleeping worker will be notified.
      If the state was waking the waking worker skips its sleep if it observes
      the WakeupStrategy state as notified.
      baedc874
  11. Sep 27, 2021
    • Florian Fischer's avatar
      [log] improve timestamp scalability and increase LogBuffer size · 442ead84
      Florian Fischer authored
      std::localtime takes a global lock and is therefore not scalable and
      inapplicable for analyzing timing sensible bugs.
      Introduce a new option to add UTC timestamps. This allows on my system
      to double the CPU load while using mmapped logging.
      
      Also increase the LogBuffer size from 1MB to 1GB because I had some
      crashes where a renewed buffer was still used.
      442ead84
  12. Sep 24, 2021
  13. Sep 21, 2021
  14. Sep 13, 2021
    • Florian Fischer's avatar
      [Debug] implement logging to a memory-mapped log file · ad10eb3a
      Florian Fischer authored
      
      When setting the environment variable EMPER_LOG_FILE=<logfile> EMPER
      will write its log messages to <logfile> instead of stderr.
      This removes the need for the mutex protecting std::cerr as well as
      multiple write calls to flush std:cerr.
      
      To efficiently write log messages to the log file the algorithm uses
      three memory 1MiB mapped views into <logfile> to store the log messages.
      One buffer is active, one is new, and one is old.
      The next buffer ensures that threads can write log messages even if the
      active buffer would overflows.
      The old buffer allows slower threads to still write safely while everyone
      else uses the active buffer.
      When a thread changes from the active buffer to the new buffer it
      is responsible to renew the current old buffer and changing the semantic
      of the buffers:
      
      * active -> old
      * next -> active
      * old -> next
      
      This buffer scheme allows wait-free logging.
      But the approach is NOT sound because delayed thread may still use the
      old buffer which gets renewed by the first thread touching the next buffer.
      But the likeliness for this situation decreases with bigger sizes of the
      buffers.
      
      ATTENTION: Using SCHED_IDLE for the completer may break this likeliness
      assumption.
      
      Add new CI test job with mmaped log files.
      
      This contains code cleanups
      Suggested-By: default avatarFlorian Schmaus <flow@cs.fau.de>
      ad10eb3a
  15. Jul 26, 2021
  16. May 28, 2021
  17. May 20, 2021
  18. May 05, 2021
  19. Apr 12, 2021
  20. Mar 22, 2021
  21. Mar 01, 2021
  22. Feb 25, 2021
  23. Feb 23, 2021
    • Florian Fischer's avatar
      [WorkerWakeupSemaphore] add three possible implementations · 3cde3e16
      Florian Fischer authored
      LockedSemaphore is the already existening Semaphore using
      a mutex and a condition variable.
      PosixMutex is a thin wrapper around a POSIX semaphore.
      SpuriousFutexSemaphore is a atomic/futex based implementation
      prune to spurious wakeups which is fine for the worker wakeup usecase.
      3cde3e16
  24. Feb 20, 2021
    • Florian Schmaus's avatar
      [Makefile] fix smoke-test/static-analysis target · 1b39754b
      Florian Schmaus authored
      This adds yet another target "smoke-test-suite", which just runs all
      tests in the 'smoke' test suite. The static-analysis target was
      changed to include *all* static analysis thingies we have, even 'doc'
      as Doxygen does also do some checks that the documentation is
      "correct".
      
      The smoke-test target is also kept, as it allows developers to simply
      run all smoke tests. Furthermore, this adds some missing PHONY
      declarations in the Makefile.
      
      The gitlab-ci now runs the smoke-test-suite and static-analysis
      targets in two different jobs. Previously the smoke-test would also
      run the static-analysis target, which was not intended.
      1b39754b
  25. Feb 02, 2021
  26. Feb 01, 2021
  27. Jan 26, 2021
  28. Jan 14, 2021
  29. Jan 13, 2021
  30. Jan 11, 2021
  31. Dec 17, 2020
  32. Dec 05, 2020
Loading