fuse: Get rid of inode lock in range reclaim path
With free fuse dax mapping reducing, read performance is impacted significantly because reads need to wait for a free fuse dax mapping. Although reads will trigger reclaim work to try to reclaim fuse dax mapping, reclaim code can barely make any progress if most of fuse dax mappings are used by the file we're reading since inode lock is required by reclaim code. However, we don't have to take inode lock for reclaiming if dax mapping has its own reference count, reference counting is to tell reclaim code to skip those in use dax mappings, such that we can avoid the risk of accidentally reclaiming a dax mapping that other readers are using. On the other hand, holding ->i_dmap_sem during reclaim can be used to prevent the follwing reads to get a dax mapping under reclaim. Another reason is that reads/writes only use fuse dax mapping within dax_iomap_rw(), so we can do such a trick, while mmap/faulting is a different story and we have to take ->i_mmap_sem prior to reclaiming a dax mapping in order to avoid the race. This adds reference count for fuse dax mapping and removes the acquisition of inode lock during reclaim. RESULTS: virtiofsd -cache_size=2G vanilla kernel: IOPS=378 patched kernel: IOPS=4508 ********************************* $ cat fio-rand-read.job ; fio-rand-read.job for fiotest [global] name=fio-rand-read filename=fio_file rw=randread bs=4K direct=1 numjobs=1 time_based=1 runtime=120 directory=/mnt/test/ fsync=1 group_reporting=1 [file1] size=5G # use sync/libaio ioengine=sync iodepth=1 Signed-off-by:Liu Bo <bo.liu@linux.alibaba.com> Signed-off-by:
Vivek Goyal <vgoyal@redhat.com>
Loading
Please register or sign in to comment