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

single-chunk scatter ABDs can be treated as linear #8580

Merged
merged 1 commit into from Jun 11, 2019

Commits on Jun 10, 2019

  1. single-chunk scatter ABDs can be treated as linear

    Scatter ABD's are allocated from a number of pages.  In contrast to
    linear ABD's, these pages are disjoint in the kernel's virtual address
    space, so they can't be accessed as a contiguous buffer.  Therefore
    routines that need a linear buffer (e.g. abd_borrow_buf() and friends)
    must allocate a separate linear buffer (with zio_buf_alloc()), and copy
    the contents of the pages to/from the linear buffer.  This can have a
    measurable performance overhead on some workloads.
    
    openzfs@87c25d5
    ("abd_alloc should use scatter for >1K allocations") increased the use
    of scatter ABD's, specifically switching 1.5K through 4K (inclusive)
    buffers from linear to scatter.  For workloads that access blocks whose
    compressed sizes are in this range, that commit introduced an additional
    copy into the read code path.  For example, the
    sequential_reads_arc_cached tests in the test suite were reduced by
    around 5% (this is doing reads of 8K-logical blocks, compressed to 3K,
    which are cached in the ARC).
    
    This commit treats single-chunk scattered buffers as linear buffers,
    because they are contiguous in the kernel's virtual address space.
    
    All single-page (4K) ABD's can be represented this way.  Some multi-page
    ABD's can also be represented this way, if we were able to allocate a
    single "chunk" (higher-order "page" which represents a power-of-2 series
    of physically-contiguous pages).  This is often the case for 2-page (8K)
    ABD's.
    
    Representing a single-entry scatter ABD as a linear ABD has the
    performance advantage of avoiding the copy (and allocation) in
    abd_borrow_buf_copy / abd_return_buf_copy.  A performance increase of
    around 5% has been observed for ARC-cached reads (of small blocks which
    can take advantage of this), fixing the regression introduced by
    87c25d5.
    
    Note that this optimization is only possible because all physical memory
    is always mapped into the kernel's address space.  This is not the case
    for HIGHMEM pages, so the optimization can not be made on 32-bit
    systems.
    
    Signed-off-by: Matthew Ahrens <mahrens@delphix.com>
    ahrens committed Jun 10, 2019
    Copy the full SHA
    bb36001 View commit details
    Browse the repository at this point in the history