[lustre-devel] [PATCH 04/24] lustre: llite: fully disable readahead in kernel I/O path
James Simmons
jsimmons at infradead.org
Mon Sep 5 18:55:17 PDT 2022
From: Qian Yingjin <qian at ddn.com>
In the new kernel (rhel9 or ubuntu 2204), the readahead path may
be out of the control of Lustre CLIO engine:
generic_file_read_iter()
->filemap_read()
->filemap_get_pages()
->page_cache_sync_readahead()
->page_cache_sync_ra()
void page_cache_sync_ra()
{
if (!ractl->ra->ra_pages || blk_cgroup_congested()) {
if (!ractl->file)
return;
req_count = 1;
do_forced_ra = true;
}
/* be dumb */
if (do_forced_ra) {
force_page_cache_ra(ractl, req_count);
return;
}
...
}
>From the kernel readahead code, even if read-ahead is disabled
(via @ra_pages == 0), it still issues this request as read-ahead
as we will need it to satisfy the requested range. The forced
read-ahead will do the right thing and limit the read to just
the requested range, which we will set to 1 page for this case.
Thus it can not totally avoid the read-ahead in the kernel I/O
path only by setting @ra_pages with 0.
To fully disable the read-ahead in the Linux kernel I/O path, we
still need to set @io_pages to 0, it will set I/O range to 0 in
@force_page_cache_ra():
void force_page_cache_ra()
{
...
max_pages = = max_t(unsigned long, bdi->io_pages,
ra->ra_pages);
nr_to_read = min_t(unsigned long, nr_to_read, max_pages);
while (nr_to_read) {
...
}
...
}
After set bdi->io_pages with 0, it can pass the sanity/101j.
WC-bug-id: https://jira.whamcloud.com/browse/LU-16019
Lustre-commit: f0cf7fd3cccb2313f ("LU-16019 llite: fully disable readahead in kernel I/O path")
Signed-off-by: Qian Yingjin <qian at ddn.com>
Reviewed-on: https://review.whamcloud.com/47993
Reviewed-by: Andreas Dilger <adilger at whamcloud.com>
Reviewed-by: Li Xi <lixi at ddn.com>
Reviewed-by: Oleg Drokin <green at whamcloud.com>
Signed-off-by: James Simmons <jsimmons at infradead.org>
---
fs/lustre/llite/llite_lib.c | 1 +
1 file changed, 1 insertion(+)
diff --git a/fs/lustre/llite/llite_lib.c b/fs/lustre/llite/llite_lib.c
index 5daced0..5931258 100644
--- a/fs/lustre/llite/llite_lib.c
+++ b/fs/lustre/llite/llite_lib.c
@@ -1261,6 +1261,7 @@ int ll_fill_super(struct super_block *sb)
/* disable kernel readahead */
sb->s_bdi->ra_pages = 0;
+ sb->s_bdi->io_pages = 0;
/* Call ll_debugsfs_register_super() before lustre_process_log()
* so that "llite.*.*" params can be processed correctly.
--
1.8.3.1
More information about the lustre-devel
mailing list