• Anton Blanchard's avatar
    powerpc: Speed up clear_page by unrolling it · e35735b9
    Anton Blanchard authored
    Unroll clear_page 8 times. A simple microbenchmark which
    allocates and frees a zeroed page:
    
    for (i = 0; i < iterations; i++) {
    	unsigned long p = __get_free_page(GFP_KERNEL | __GFP_ZERO);
    	free_page(p);
    }
    
    improves 20% on POWER8.
    
    This assumes cacheline sizes won't grow beyond 512 bytes or
    page sizes wont drop below 1kB, which is unlikely, but we could
    add a runtime check during early init if it makes people nervous.
    
    Michael found that some versions of gcc produce quite bad code
    (all multiplies), so we give gcc a hand by using shifts and adds.
    Signed-off-by: default avatarAnton Blanchard <anton@samba.org>
    Signed-off-by: default avatarMichael Ellerman <mpe@ellerman.id.au>
    e35735b9
page_64.h 5.02 KB