• Robin Murphy's avatar
    dma-debug: Batch dma_debug_entry allocation · ad78dee0
    Robin Murphy authored
    DMA debug entries are one of those things which aren't that useful
    individually - we will always want some larger quantity of them - and
    which we don't really need to manage the exact number of - we only care
    about having 'enough'. In that regard, the current behaviour of creating
    them one-by-one leads to a lot of unwarranted function call overhead and
    memory wasted on alignment padding.
    
    Now that we don't have to worry about freeing anything via
    dma_debug_resize_entries(), we can optimise the allocation behaviour by
    grabbing whole pages at once, which will save considerably on the
    aforementioned overheads, and probably offer a little more cache/TLB
    locality benefit for traversing the lists under normal operation. This
    should also give even less reason for an architecture-level override of
    the preallocation size, so make the definition unconditional - if there
    is still any desire to change the compile-time value for some platforms
    it would be better off as a Kconfig option anyway.
    
    Since freeing a whole page of entries at once becomes enough of a
    challenge that it's not really worth complicating dma_debug_init(), we
    may as well tweak the preallocation behaviour such that as long as we
    manage to allocate *some* pages, we can leave debugging enabled on a
    best-effort basis rather than otherwise wasting them.
    Signed-off-by: default avatarRobin Murphy <robin.murphy@arm.com>
    Tested-by: default avatarQian Cai <cai@lca.pw>
    Signed-off-by: default avatarChristoph Hellwig <hch@lst.de>
    ad78dee0
debug.c 45.7 KB