• A
    powerpc: Improve 64bit copy_tofrom_user · 789c299c
    Anton Blanchard 提交于
    Here is a patch from Paul Mackerras that improves the ppc64 copy_tofrom_user.
    The loop now does 32 bytes at a time and as well as pairing loads and stores.
    
    A quick test case that reads 8kB over and over shows the improvement:
    
    POWER6: 53% faster
    POWER7: 51% faster
    
    #define _XOPEN_SOURCE 500
    #include <stdlib.h>
    #include <stdio.h>
    #include <unistd.h>
    #include <fcntl.h>
    #include <sys/types.h>
    #include <sys/stat.h>
    
    #define BUFSIZE (8 * 1024)
    #define ITERATIONS 10000000
    
    int main()
    {
    	char tmpfile[] = "/tmp/copy_to_user_testXXXXXX";
    	int fd;
    	char *buf[BUFSIZE];
    	unsigned long i;
    
    	fd = mkstemp(tmpfile);
    	if (fd < 0) {
    		perror("open");
    		exit(1);
    	}
    
    	if (write(fd, buf, BUFSIZE) != BUFSIZE) {
    		perror("open");
    		exit(1);
    	}
    
    	for (i = 0; i < 10000000; i++) {
    		if (pread(fd, buf, BUFSIZE, 0) != BUFSIZE) {
    			perror("pread");
    			exit(1);
    		}
    	}
    
    	unlink(tmpfile);
    
    	return 0;
    }
    Signed-off-by: NAnton Blanchard <anton@samba.org>
    Signed-off-by: NBenjamin Herrenschmidt <benh@kernel.crashing.org>
    789c299c
copyuser_64.S 10.2 KB