Advertisement
Guest User

readahead-make-context-readahead-more-conservative.patch

a guest
Sep 2nd, 2013
65
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.82 KB | None | 0 0
  1. This helps performance on moderately dense random reads on SSD.
  2.  
  3. Transaction-Per-Second numbers provided by Taobao:
  4.  
  5. QPS case
  6. -------------------------------------------------------
  7. 7536 disable context readahead totally
  8. w/ patch: 7129 slower size rampup and start RA on the 3rd read
  9. 6717 slower size rampup
  10. w/o patch: 5581 unmodified context readahead
  11.  
  12. Before, readahead will be started whenever reading page N+1 when it
  13. happen to read N recently. After patch, we'll only start readahead
  14. when *three* random reads happen to access pages N, N+1, N+2. The
  15. probability of this happening is extremely low for pure random reads,
  16. unless they are very dense, which actually deserves some readahead.
  17.  
  18. Also start with a smaller readahead window. The impact to interleaved
  19. sequential reads should be small, because for a long run stream, the
  20. the small readahead window rampup phase is negletable.
  21.  
  22. The context readahead actually benefits clustered random reads on HDD
  23. whose seek cost is pretty high. However as SSD is increasingly used
  24. for random read workloads it's better for the context readahead to
  25. concentrate on interleaved sequential reads.
  26.  
  27. Another SSD rand read test from Miao
  28.  
  29. # file size: 2GB
  30. # read IO amount: 625MB
  31. sysbench --test=fileio \
  32. --max-requests=10000 \
  33. --num-threads=1 \
  34. --file-num=1 \
  35. --file-block-size=64K \
  36. --file-test-mode=rndrd \
  37. --file-fsync-freq=0 \
  38. --file-fsync-end=off run
  39.  
  40. shows the performance of btrfs grows up from 69MB/s to 121MB/s,
  41. ext4 from 104MB/s to 121MB/s.
  42.  
  43. Tested-by: Tao Ma <tm@tao.ma>
  44. Tested-by: Miao Xie <miaox@cn.fujitsu.com>
  45. Signed-off-by: Wu Fengguang <fengguang.wu@intel.com>
  46. ---
  47. mm/readahead.c | 8 ++++----
  48. 1 file changed, 4 insertions(+), 4 deletions(-)
  49.  
  50. --- linux-next.orig/mm/readahead.c 2013-08-08 16:21:29.675286154 +0800
  51. +++ linux-next/mm/readahead.c 2013-08-08 16:21:33.851286019 +0800
  52. @@ -371,10 +371,10 @@ static int try_context_readahead(struct
  53. size = count_history_pages(mapping, ra, offset, max);
  54.  
  55. /*
  56. - * no history pages:
  57. + * not enough history pages:
  58. * it could be a random read
  59. */
  60. - if (!size)
  61. + if (size <= req_size)
  62. return 0;
  63.  
  64. /*
  65. @@ -385,8 +385,8 @@ static int try_context_readahead(struct
  66. size *= 2;
  67.  
  68. ra->start = offset;
  69. - ra->size = get_init_ra_size(size + req_size, max);
  70. - ra->async_size = ra->size;
  71. + ra->size = min(size + req_size, max);
  72. + ra->async_size = 1;
  73.  
  74. return 1;
  75. }
  76. --
  77. To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
  78. the body of a message to majordomo@vger.kernel.org
  79. More majordomo info at http://vger.kernel.org/majordomo-info.html
  80. Please read the FAQ at http://www.tux.org/lkml/
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement