linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] mm: readahead: do not cap readahead() and MADV_WILLNEED
@ 2016-02-24  1:38 Johannes Weiner
  2016-02-24  2:34 ` Linus Torvalds
  0 siblings, 1 reply; 4+ messages in thread
From: Johannes Weiner @ 2016-02-24  1:38 UTC (permalink / raw)
  To: Andrew Morton, Linus Torvalds; +Cc: linux-mm, linux-kernel, kernel-team

All readahead is currently capped to a maximum of the device readahead
limit, which defaults to 128k. For heuristics-based readahead this
makes perfect sense, too, but unfortunately the limit is also applied
to the explicit readahead() or madvise(MADV_WILLNEED) syscalls, and
128k is an awfully low limit, particularly for bigger machines. It's
not unreasonable for a user on a 100G machine to say, read this 1G
file, and read it now, I'm going to access the whole thing shortly.

Since both readahead() and MADV_WILLNEED take an explicit length
parameter, it seems weird to truncate that request quietly. Just do
what the user asked for and leave the limiting to the heuristics.

Signed-off-by: Johannes Weiner <hannes@cmpxchg.org>
---
 mm/readahead.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/mm/readahead.c b/mm/readahead.c
index 20e58e8..6d182db 100644
--- a/mm/readahead.c
+++ b/mm/readahead.c
@@ -212,7 +212,6 @@ int force_page_cache_readahead(struct address_space *mapping, struct file *filp,
 	if (unlikely(!mapping->a_ops->readpage && !mapping->a_ops->readpages))
 		return -EINVAL;
 
-	nr_to_read = min(nr_to_read, inode_to_bdi(mapping->host)->ra_pages);
 	while (nr_to_read) {
 		int err;
 
@@ -485,6 +484,7 @@ void page_cache_sync_readahead(struct address_space *mapping,
 
 	/* be dumb */
 	if (filp && (filp->f_mode & FMODE_RANDOM)) {
+		req_size = min(req_size, inode_to_bdi(mapping->host)->ra_pages);
 		force_page_cache_readahead(mapping, filp, offset, req_size);
 		return;
 	}
-- 
2.7.1

--
To unsubscribe, send a message with 'unsubscribe linux-mm' in
the body to majordomo@kvack.org.  For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"dont@kvack.org"> email@kvack.org </a>

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

end of thread, other threads:[~2016-02-29 21:03 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2016-02-24  1:38 [PATCH] mm: readahead: do not cap readahead() and MADV_WILLNEED Johannes Weiner
2016-02-24  2:34 ` Linus Torvalds
2016-02-29 19:41   ` Johannes Weiner
2016-02-29 21:03     ` Kirill A. Shutemov

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).