• David Rientjes's avatar
    dma-pool: dynamically expanding atomic pools · 54adadf9
    David Rientjes authored
    When an atomic pool becomes fully depleted because it is now relied upon
    for all non-blocking allocations through the DMA API, allow background
    expansion of each pool by a kworker.
    
    When an atomic pool has less than the default size of memory left, kick
    off a kworker to dynamically expand the pool in the background.  The pool
    is doubled in size, up to MAX_ORDER-1.  If memory cannot be allocated at
    the requested order, smaller allocation(s) are attempted.
    
    This allows the default size to be kept quite low when one or more of the
    atomic pools is not used.
    
    Allocations for lowmem should also use GFP_KERNEL for the benefits of
    reclaim, so use GFP_KERNEL | GFP_DMA and GFP_KERNEL | GFP_DMA32 for
    lowmem allocations.
    
    This also allows __dma_atomic_pool_init() to return a pointer to the pool
    to make initialization cleaner.
    
    Also switch over some node ids to the more appropriate NUMA_NO_NODE.
    Signed-off-by: default avatarDavid Rientjes <rientjes@google.com>
    Signed-off-by: default avatarChristoph Hellwig <hch@lst.de>
    54adadf9
pool.c 4.99 KB