• Constantine Shulyupin's avatar
    fuse: add max_pages to init_out · 5da784cc
    Constantine Shulyupin authored
    Replace FUSE_MAX_PAGES_PER_REQ with the configurable parameter max_pages to
    improve performance.
    Old RFC with detailed description of the problem and many fixes by Mitsuo
    Hayasaka (mitsuo.hayasaka.hu@hitachi.com):
     - https://lkml.org/lkml/2012/7/5/136
    We've encountered performance degradation and fixed it on a big and complex
    virtual environment.
    Environment to reproduce degradation and improvement:
    1. Add lag to user mode FUSE
    Add nanosleep(&(struct timespec){ 0, 1000 }, NULL); to xmp_write_buf in
    2. patch UM fuse with configurable max_pages parameter. The patch will be
    provided latter.
    3. run test script and perform test on tmpfs
           cd /tmp
           mkdir -p fusemnt
           passthrough_fh -o max_pages=$1 /tmp/fusemnt
           grep fuse /proc/self/mounts
           dd conv=fdatasync oflag=dsync if=/dev/zero of=fusemnt/tmp/tmp \
    		count=1K bs=1M 2>&1 | grep -v records
           rm fusemnt/tmp/tmp
           killall passthrough_fh
    Test results:
    passthrough_fh /tmp/fusemnt fuse.passthrough_fh \
    	rw,nosuid,nodev,relatime,user_id=0,group_id=0 0 0
    1073741824 bytes (1.1 GB) copied, 1.73867 s, 618 MB/s
    passthrough_fh /tmp/fusemnt fuse.passthrough_fh \
    	rw,nosuid,nodev,relatime,user_id=0,group_id=0,max_pages=256 0 0
    1073741824 bytes (1.1 GB) copied, 1.15643 s, 928 MB/s
    Obviously with bigger lag the difference between 'before' and 'after'
    will be more significant.
    Mitsuo Hayasaka, in 2012 (https://lkml.org/lkml/2012/7/5/136
    observed improvement from 400-550 to 520-740.
    Signed-off-by: default avatarConstantine Shulyupin <const@MakeLinux.com>
    Signed-off-by: default avatarMiklos Szeredi <mszeredi@redhat.com>
fuse_i.h 25.2 KB