Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

io: rewrite slab to support compaction #2757

Merged
merged 16 commits into from Aug 12, 2020
Merged

io: rewrite slab to support compaction #2757

merged 16 commits into from Aug 12, 2020

Commits on Aug 10, 2020

  1. io: rewrite slab to support compaction

    The I/O driver uses a slab to store per-resource state. Doing this
    provides two benefits. First, allocating state is streamlined. Second,
    resources may be safetly indexed using a `usize` type. The `usize` is
    used passed to the OS's selector when registering for receiving events.
    
    The original slab implementation used a `Vec` backed by `RwLock`. This
    primarily caused contention when reading state. This implementation also
    only **grew** the slab capacity but never shrank. In #1625, the slab was
    rewritten to use a lock-free strategy. The lock contention was removed
    but this implementation was still grow-only.
    
    This change adds the ability to release memory. Similar to the previous
    implementation, it structures the slab to use a vector of pages. This
    enables growing the slab without having to move any previous entries. It
    also adds the ability to release pages. This is done by introducing a
    lock when allocating / releasing slab entries. This does not impact
    benchmarks, primarily due to the existing implementation not being
    "done" and also having a lock around allocating and releasing.
    
    A `Slab::compact()` function is added. Pages are iterated. When a page
    is found with no slots in use, the page is freed. The `compact()`
    function is called occassionally by the I/O driver.
    carllerche committed Aug 10, 2020
    Copy the full SHA
    a04ab1a View commit details
    Browse the repository at this point in the history
  2. fmt

    carllerche committed Aug 10, 2020
    Copy the full SHA
    8a9b88b View commit details
    Browse the repository at this point in the history

Commits on Aug 11, 2020

  1. clippy

    carllerche committed Aug 11, 2020
    Copy the full SHA
    7d3063b View commit details
    Browse the repository at this point in the history
  2. get compiling with loom

    carllerche committed Aug 11, 2020
    Copy the full SHA
    7bb3ec3 View commit details
    Browse the repository at this point in the history
  3. Copy the full SHA
    3c9c8b5 View commit details
    Browse the repository at this point in the history
  4. Copy the full SHA
    13a7fd5 View commit details
    Browse the repository at this point in the history
  5. add note on `index_for

    carllerche committed Aug 11, 2020
    Copy the full SHA
    439262c View commit details
    Browse the repository at this point in the history
  6. Copy the full SHA
    6604eae View commit details
    Browse the repository at this point in the history
  7. Apply suggestions from code review

    Co-authored-by: Alice Ryhl <alice@ryhl.io>
    carllerche and Darksonn committed Aug 11, 2020
    Copy the full SHA
    ed6c9db View commit details
    Browse the repository at this point in the history
  8. expand on safety comment

    carllerche committed Aug 11, 2020
    Copy the full SHA
    5ba90ab View commit details
    Browse the repository at this point in the history
  9. expand another comment

    carllerche committed Aug 11, 2020
    Copy the full SHA
    f93acba View commit details
    Browse the repository at this point in the history
  10. Copy the full SHA
    1b3f518 View commit details
    Browse the repository at this point in the history
  11. Copy the full SHA
    c237fbc View commit details
    Browse the repository at this point in the history
  12. improve debug output

    carllerche committed Aug 11, 2020
    Copy the full SHA
    6a9fd9b View commit details
    Browse the repository at this point in the history

Commits on Aug 12, 2020

  1. document pack_lossy

    carllerche committed Aug 12, 2020
    Copy the full SHA
    cfbfdfa View commit details
    Browse the repository at this point in the history
  2. change panic

    carllerche committed Aug 12, 2020
    Copy the full SHA
    1f7bc00 View commit details
    Browse the repository at this point in the history