The patch titled Subject: mm/dmapool.c: micro-optimisation remove unnecessary branch has been added to the -mm tree. Its filename is mm-dmapoolc-micro-optimisation-remove-unnecessary-branch.patch This patch should soon appear at http://ozlabs.org/~akpm/mmots/broken-out/mm-dmapoolc-micro-optimisation-remove-unnecessary-branch.patch and later at http://ozlabs.org/~akpm/mmotm/broken-out/mm-dmapoolc-micro-optimisation-remove-unnecessary-branch.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: Mateusz Nosek <mateusznosek0@xxxxxxxxx> Subject: mm/dmapool.c: micro-optimisation remove unnecessary branch Previously there was a check if 'size' is aligned to 'align' and if not then it was aligned. This check was expensive as both branch and division are expensive instructions in most architectures. 'ALIGN' function on already aligned value will not change it, and as it is cheaper than branch + division it can be executed all the time and branch can be removed. Link: http://lkml.kernel.org/r/20200320173317.26408-1-mateusznosek0@xxxxxxxxx Signed-off-by: Mateusz Nosek <mateusznosek0@xxxxxxxxx> Signed-off-by: Andrew Morton <akpm@xxxxxxxxxxxxxxxxxxxx> --- mm/dmapool.c | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) --- a/mm/dmapool.c~mm-dmapoolc-micro-optimisation-remove-unnecessary-branch +++ a/mm/dmapool.c @@ -144,9 +144,7 @@ struct dma_pool *dma_pool_create(const c else if (size < 4) size = 4; - if ((size % align) != 0) - size = ALIGN(size, align); - + size = ALIGN(size, align); allocation = max_t(size_t, size, PAGE_SIZE); if (!boundary) _ Patches currently in -mm which might be from mateusznosek0@xxxxxxxxx are mm-micro-optimisation-save-two-branches-on-hot-page-allocation-path.patch mm-page_allocc-micro-optimisation-remove-unnecessary-branch.patch mm-vmscanc-clean-code-by-removing-unnecessary-assignment.patch mm-compactionc-clean-code-by-removing-unnecessary-assignment.patch mm-hugetlbc-clean-code-by-removing-unnecessary-initialization.patch mm-shmemc-clean-code-by-removing-unnecessary-assignment.patch mm-mm_initc-clean-code-use-build_bug_on-when-comparing-compile-time-constant.patch mm-dmapoolc-micro-optimisation-remove-unnecessary-branch.patch