The patch titled Subject: mm/dmapool.c: improve accuracy of debug statistics has been added to the -mm tree. Its filename is dmapool-improve-accuracy-of-debug-statistics.patch This patch should soon appear at http://ozlabs.org/~akpm/mmots/broken-out/dmapool-improve-accuracy-of-debug-statistics.patch and later at http://ozlabs.org/~akpm/mmotm/broken-out/dmapool-improve-accuracy-of-debug-statistics.patch Before you just go and hit "reply", please: a) Consider who else should be cc'ed b) Prefer to cc a suitable mailing list as well c) Ideally: find the original patch on the mailing list and do a reply-to-all to that, adding suitable additional cc's *** Remember to use Documentation/process/submit-checklist.rst when testing your code *** The -mm tree is included into linux-next and is updated there every 3-4 working days ------------------------------------------------------ From: Tony Battersby <tonyb@xxxxxxxxxxxxxxx> Subject: mm/dmapool.c: improve accuracy of debug statistics The "total number of blocks in pool" debug statistic currently does not take the boundary value into account, so it diverges from the "total number of blocks in use" statistic when a boundary is in effect. Add a calculation for the number of blocks per allocation that takes the boundary into account, and use it to replace the inaccurate calculation. Link: http://lkml.kernel.org/r/bb0ee76c-78ac-b75b-b32d-8c94d881f7d6@xxxxxxxxxxxxxxx Signed-off-by: Tony Battersby <tonyb@xxxxxxxxxxxxxxx> Acked-by: Matthew Wilcox <willy@xxxxxxxxxxxxx> Cc: Andy Shevchenko <andy.shevchenko@xxxxxxxxx> Cc: Christoph Hellwig <hch@xxxxxx> Cc: John Garry <john.garry@xxxxxxxxxx> Cc: Marek Szyprowski <m.szyprowski@xxxxxxxxxxx> Signed-off-by: Andrew Morton <akpm@xxxxxxxxxxxxxxxxxxxx> --- mm/dmapool.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) --- a/mm/dmapool.c~dmapool-improve-accuracy-of-debug-statistics +++ a/mm/dmapool.c @@ -61,6 +61,7 @@ struct dma_pool { /* the pool */ struct device *dev; unsigned int allocation; unsigned int boundary; + unsigned int blks_per_alloc; char name[32]; struct list_head pools; }; @@ -105,8 +106,7 @@ show_pools(struct device *dev, struct de /* per-pool info, no real statistics yet */ temp = scnprintf(next, size, "%-16s %4zu %4zu %4u %2u\n", pool->name, blocks, - (size_t) pages * - (pool->allocation / pool->size), + (size_t) pages * pool->blks_per_alloc, pool->size, pages); size -= temp; next += temp; @@ -182,6 +182,9 @@ struct dma_pool *dma_pool_create(const c retval->size = size; retval->boundary = boundary; retval->allocation = allocation; + retval->blks_per_alloc = + (allocation / boundary) * (boundary / size) + + (allocation % boundary) / size; INIT_LIST_HEAD(&retval->pools); _ Patches currently in -mm which might be from tonyb@xxxxxxxxxxxxxxx are dmapool-fix-boundary-comparison.patch dmapool-remove-checks-for-dev-==-null.patch dmapool-cleanup-dma_pool_destroy.patch dmapool-improve-scalability-of-dma_pool_alloc.patch dmapool-rename-fields-in-dma_page.patch dmapool-improve-scalability-of-dma_pool_free.patch dmapool-cleanup-integer-types.patch dmapool-improve-accuracy-of-debug-statistics.patch dmapool-debug-prevent-endless-loop-in-case-of-corruption.patch