linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] mm : update ra->ra_pages if it's NOT equal to bdi->ra_pages
@ 2020-08-14  1:30 Zhaoyang Huang
  2020-08-14  1:43 ` Matthew Wilcox
  0 siblings, 1 reply; 11+ messages in thread
From: Zhaoyang Huang @ 2020-08-14  1:30 UTC (permalink / raw)
  To: Roman Gushchin, Andrew Morton, Zhaoyang Huang, linux-mm,
	linux-kernel

file->f_ra->ra_pages will remain the initialized value since it opend, which may
be NOT equal to bdi->ra_pages as the latter one is updated somehow(etc,
echo xxx > /sys/block/dm/queue/read_ahead_kb).So sync ra->ra_pages to the
updated value when sync read.

Signed-off-by: Zhaoyang Huang <zhaoyang.huang@unisoc.com>
---
 mm/filemap.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/mm/filemap.c b/mm/filemap.c
index d78f577..5c2d7cc 100644
--- a/mm/filemap.c
+++ b/mm/filemap.c
@@ -2470,6 +2470,8 @@ static struct file *do_sync_mmap_readahead(struct vm_fault *vmf)
 	struct file *fpin = NULL;
 	pgoff_t offset = vmf->pgoff;
 
+	if (ra->ra_pages != inode_to_bdi(mapping->host)->ra_pages)
+		ra->ra_pages = inode_to_bdi(mapping->host)->ra_pages;
 	/* If we don't want any read-ahead, don't bother */
 	if (vmf->vma->vm_flags & VM_RAND_READ)
 		return fpin;
-- 
1.9.1



^ permalink raw reply related	[flat|nested] 11+ messages in thread

end of thread, other threads:[~2020-08-14 22:17 UTC | newest]

Thread overview: 11+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2020-08-14  1:30 [PATCH] mm : update ra->ra_pages if it's NOT equal to bdi->ra_pages Zhaoyang Huang
2020-08-14  1:43 ` Matthew Wilcox
2020-08-14  2:07   ` Matthew Wilcox
2020-08-14  2:20     ` Zhaoyang Huang
2020-08-14  2:26       ` Zhaoyang Huang
2020-08-14  2:31         ` Matthew Wilcox
2020-08-14  2:33       ` Andrew Morton
2020-08-14  2:45         ` Zhaoyang Huang
2020-08-14  3:19           ` Matthew Wilcox
2020-08-14 22:17             ` Minchan Kim
2020-08-14 17:46         ` Matthew Wilcox

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).