[PATCH] mm: readahead: do not cap readahead() and MADV_WILLNEED

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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@xxxxxxxxxxx>
---
 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@xxxxxxxxx.  For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"dont@xxxxxxxxx";> email@xxxxxxxxx </a>



[Index of Archives]     [Linux ARM Kernel]     [Linux ARM]     [Linux Omap]     [Fedora ARM]     [IETF Annouce]     [Bugtraq]     [Linux]     [Linux OMAP]     [Linux MIPS]     [ECOS]     [Asterisk Internet PBX]     [Linux API]