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

Kmem rework (WIP) #2918

Closed
wants to merge 7 commits into from
Closed

Kmem rework (WIP) #2918

wants to merge 7 commits into from

Commits on Dec 16, 2014

  1. Mark IO pipeline with PF_FSTRANS

    In order to avoid deadlocking in the IO pipeline it is critical that
    pageout be avoided during direct memory reclaim.  This ensures that
    the pipeline threads can always make forward progress and never end
    up blocking on a DMU transaction.  For this very reason Linux now
    provides the PF_FSTRANS flag which may be set in the process context.
    
    Signed-off-by: Brian Behlendorf <behlendorf1@llnl.gov>
    behlendorf committed Dec 16, 2014
    Configuration menu
    Copy the full SHA
    441f3b3 View commit details
    Browse the repository at this point in the history
  2. Use is_vmalloc_addr() in vdev_disk.c

    The initial port of ZFS to Linux required a way to identify virtual
    memory to make IO to virtual memory backed slabs work, so kmem_virt()
    was created. Linux 2.6.25 introduced is_vmalloc_addr(), which is
    logically equivalent to kmem_virt(). Support for kernels before 2.6.26
    was later dropped and more recently, support for kernels before Linux
    2.6.32 has been dropped. We retire kmem_virt() in favor of
    is_vmalloc_addr() to cleanup the code.
    
    Signed-off-by: Richard Yao <ryao@gentoo.org>
    Signed-off-by: Brian Behlendorf <behlendorf1@llnl.gov>
    ryao authored and behlendorf committed Dec 16, 2014
    Configuration menu
    Copy the full SHA
    669ea52 View commit details
    Browse the repository at this point in the history
  3. Retire KM_NODEBUG

    Callers of kmem_alloc() which passed the KM_NODEBUG flag to suppress
    the large allocation warning have been replaced by vmem_alloc() as
    appropriate.  The updated vmem_alloc() call will not print a warning
    regardless of the size of the allocation.
    
    A careful reader will notice that not all callers have been changed
    to vmem_alloc().  Some have only had the KM_NODEBUG flag removed.
    This was possible because the default warning threshold has been
    increased to 32k.  This is desirable because it minimizes the need
    for Linux specific code changes.
    
    Signed-off-by: Brian Behlendorf <behlendorf1@llnl.gov>
    behlendorf committed Dec 16, 2014
    Configuration menu
    Copy the full SHA
    aa40fed View commit details
    Browse the repository at this point in the history
  4. Change KM_PUSHPAGE -> KM_SLEEP

    By marking DMU transaction processing contexts with PF_FSTRANS
    we can revert the KM_PUSHPAGE -> KM_SLEEP changes.  This brings
    us back in line with upstream.  In some cases this means simply
    swapping the flags back.  For others fnvlist_alloc() was replaced
    by nvlist_alloc(..., KM_PUSHPAGE) and must be reverted back to
    fnvlist_alloc() which assumes KM_SLEEP.
    
    The one place KM_PUSHPAGE is kept is when allocating ARC buffers
    which allows us to dip in to reserved memory.  This is again the
    same as upstream.
    behlendorf committed Dec 16, 2014
    Configuration menu
    Copy the full SHA
    0214026 View commit details
    Browse the repository at this point in the history
  5. Add kmem_cache.h include to default context

    As part of the spl kmem/vmem refactoring the kmem_cache_* functions
    were split in to their own kmem_cache.h header.  This was done in
    part so that kmem_* consumers would not be forced to include the
    kmem_cache_* functions which mask several Linux SLAB/SLAB functions.
    
    Because of this we now much explicitly include kmem_cache.h in the
    zfs_context.h.  However, consumers such as Lustre which need access
    to the KM_FLAGS but not the kmem_cache_* functions can now safely
    just include kmem.h.
    
    Signed-off-by: Brian Behlendorf <behlendorf1@llnl.gov>
    behlendorf committed Dec 16, 2014
    Configuration menu
    Copy the full SHA
    ac9baa3 View commit details
    Browse the repository at this point in the history
  6. Revert "Pre-allocate vdev I/O buffers"

    Commit 86dd0fd added preallocated I/O buffers.  This is no longer
    required after the recent kmem changes designed to make our memory
    allocation interfaces behave more like those found on Illumos.  A
    deadlock in this situation is no longer possible.
    
    However, these allocations still have the potential to be expensive.
    So a potential future optimization might be to perform then KM_NOSLEEP
    so that they either succeed of fail quicky.  Either case is acceptable
    here because we can safely abort the aggregation.
    
    Signed-off-by: Brian Behlendorf <behlendorf1@llnl.gov>
    behlendorf committed Dec 16, 2014
    Configuration menu
    Copy the full SHA
    9cbbe03 View commit details
    Browse the repository at this point in the history
  7. Revert SA spill block cache

    The SA spill_cache was originally introduced to avoid the need to
    perform large kmem or vmem allocations.  Instead a small dedicated
    cache of preallocated SA buffers was kept.
    
    This solution was viable while the maximum block size was limited
    to 128K.  But with the planned increase of the maximum block size
    to 16M callers need to migrate to the zio_buf_alloc().  However,
    they should be aware this interface is expected to change again
    once the zio buffers are fully backed by scatter-gather lists.
    
    Alternately, if the callers know these buffers will never be large
    or be infrequently accessed they may kmem_alloc() or vmem_alloc()
    the needed temporary space.
    
    This change has the additional benegit of bringing the code back
    inline with the upstream Illumos source.
    
    Signed-off-by: Brian Behlendorf <behlendorf1@llnl.gov>
    behlendorf committed Dec 16, 2014
    Configuration menu
    Copy the full SHA
    73e438c View commit details
    Browse the repository at this point in the history