Uploaded image for project: 'TrueNAS'
  1. TrueNAS
  2. NAS-108596

lib:tevent - switch back to default (non-kqueue) timers

    XMLWordPrintable

    Details

    • Type: Defect
    • Status: Done (View Workflow)
    • Priority: Medium
    • Resolution: Complete
    • Affects Version/s: None
    • Fix Version/s: 12.0-U2
    • Component/s: SMB
    • Labels:
      None

      Description

      PR: https://github.com/freenas/ports/pull/917

      This addreses NULL dereference caused by discharging timed events
      with a wrapped event context.

      Performance investigation for high IOPs on x-series indicated
      a measurable amount of time spent in adding / removing timed events
      from kqueue. During this test, multiple timers are added / removed for
      each SMB request. This particular library does not benefit from the high
      precision kqueue allows for discharging timed events.

      Hence, it's a better call to switch back to using libtevent's default
      timer functions. In this case, we use the standard API to determine
      the offset to the next timed event, and then use this value for the
      timeout for the subsequent kevent() call.

      In overload situations where we grow our kevent array and loop,
      we call get a new timer offset and use this for the next kevent() call.

      Due to design constraints / current usage, libtevent's timed events
      use gettimeofday() to calculate offsets. In this PR I also transition to
      using the lower-precision timer CLOCK_REALTIME_FAST for the sake of
      efficiency, and make a similar change to timeval_current(). This provides
      precision to within 1 tick.

      There is also some further simplification of kqueue / aio calls.

      Further investigation will be required into utilizing a monotonic clock
      for timed events.

        Attachments

          Attachments

            JEditor

              Issue Links

                Activity

                  People

                  Assignee:
                  awalker Andrew Walker
                  Reporter:
                  bugclerk Bug Clerk
                  Watchers:
                  Bug Clerk, Joe Maloney, Mike White, William Grzybowski
                  Votes:
                  0 Vote for this issue
                  Watchers:
                  4 Start watching this issue

                    Dates

                    Created:
                    Updated:
                    Resolved: