The default max_readahead_mb is 1/32 of all cached pages,
which doesn't make much sense but isn't usually a problem
since most real nodes have very high RAM or it is tuned to
larger values.
It is reduced further for the per-file limit, which is also
reasonable.
However, on test VMs with smaller RAM sizes, this results
in hilariously tiny max_read_ahead_per_file_mb values, like
20. This is small enough it causes extra misses because
two RPCs cannot be reliably sent. This edge case isn't
important for performance, but it makes small scale testing
of readahead nearly impossible.
To avoid this, we add a minimum readahead requirement of
256 MiB, which is used unless it's > half of RAM. This
should avoid this case on test VMs without changing the
behavior for real clients unless they are extremely small.
Signed-off-by: Patrick Farrell <pfarrell@whamcloud.com>
Change-Id: Ie8aab6b04ad520e4633d634d846e7ef23cc91ced
Reviewed-on: https://review.whamcloud.com/c/fs/lustre-release/+/46475
Tested-by: jenkins <devops@whamcloud.com>
Tested-by: Maloo <maloo@whamcloud.com>
Reviewed-by: Andreas Dilger <adilger@whamcloud.com>
Reviewed-by: Sebastien Buisson <sbuisson@ddn.com>
Reviewed-by: Oleg Drokin <green@whamcloud.com>
/* default read-ahead on a given client mountpoint. */
#define SBI_DEFAULT_READ_AHEAD_MAX MiB_TO_PAGES(1024UL)
+/* on small nodes (ie, testing VMs), we need at least this much to make
+ * readahead easily testable
+ */
+#define SBI_DEFAULT_READ_AHEAD_MIN MiB_TO_PAGES(256UL)
/* default read-ahead for a single file descriptor */
#define SBI_DEFAULT_READ_AHEAD_PER_FILE_MAX MiB_TO_PAGES(256UL)
sbi->ll_ra_info.ra_max_pages =
min(pages / 32, SBI_DEFAULT_READ_AHEAD_MAX);
+ /* on very small nodes (ie, testing VMs), we need a minimum readahead
+ * size to get sane testing behavior, so we try to enforce this
+ * minimum. This only kicks in at small RAM sizes, so generally won't
+ * affect real clients
+ */
+ if (sbi->ll_ra_info.ra_max_pages < SBI_DEFAULT_READ_AHEAD_MIN)
+ sbi->ll_ra_info.ra_max_pages =
+ min(pages / 2, SBI_DEFAULT_READ_AHEAD_MIN);
sbi->ll_ra_info.ra_max_pages_per_file =
min(sbi->ll_ra_info.ra_max_pages / 4,
SBI_DEFAULT_READ_AHEAD_PER_FILE_MAX);