LU-13669 llite: make readahead aware of hints
Calling madvise(MADV_SEQUENTIAL) and madvise(MADV_RANDOM) sets the
VM_SEQ_READ and VM_RAND_READ hints in vma->vm_flags. These should
be used to guide the Lustre readahead for better performance.
Disable the kernel readahead for mmap() pages and use the llite
readahead instead. There was also a bug in ll_fault0() that would
set both VM_SEQ_READ and VM_RAND_READ at the same time, which was
confusing the detection of the VM_SEQ_READ case, since VM_RAND_READ
was being checked first.
This changes the readahead for mmap from submitting mostly 4KB RPCs
to a large number of 1MB RPCs for the application profiled:
llite.*.read_ahead_stats before patched
------------------------ ------ -------
hits 2408 135924 samples [pages]
misses 34160 2384 samples [pages]
osc.*.rpc_stats read before read patched
--------------- ------------- --------------
pages per rpc rpcs % cum% rpcs % cum%
1: 6542 95 95 351 55 55
2: 224 3 99 76 12 67
4: 32 0 99 28 4 72
8: 2 0 99 9 1 73
16: 25 0 99 32 5 78
32: 0 0 99 8 1 80
64: 0 0 99 5 0 80
128: 0 0 99 15 2 83
256: 2 0 99 102 16 99
512: 0 0 99 0 0 99
1024: 1 0 100 3 0 100
Readahead hit rate improved from 6% to 98%, and 4KB RPCs dropped from
95% to 55% and 1MB+ RPCs increased from 0% to 16% (79% of all pages).
Add debug to ll_file_mmap(), ll_fault() and ll_fault_io_init() to
allow tracing VMA state functions for future IO optimizations.
Fixes:
62ef9c949753 ("add 2.6.27 kernel support")
Signed-off-by: Wang Shilong <wshilong@ddn.com>
Change-Id: I4bbb028db05b21ae01dafe6a7bea398e9b74d8a4
Reviewed-on: https://review.whamcloud.com/41228
Tested-by: jenkins <devops@whamcloud.com>
Tested-by: Maloo <maloo@whamcloud.com>
Reviewed-by: Wang Shilong <wshilong@whamcloud.com>
Reviewed-by: Oleg Drokin <green@whamcloud.com>