From: Raghavendra K T <raghavendra.kt@linux.vnet.ibm.com>
To: Andrew Morton <akpm@linux-foundation.org>,
Fengguang Wu <fengguang.wu@intel.com>,
David Cohen <david.a.cohen@linux.intel.com>,
Al Viro <viro@zeniv.linux.org.uk>,
Damien Ramonda <damien.ramonda@intel.com>,
Jan Kara <jack@suse.cz>,
rientjes@google.com, Linus <torvalds@linux-foundation.org>,
nacc@linux.vnet.ibm.com
Cc: linux-mm@kvack.org, linux-kernel@vger.kernel.org,
Raghavendra K T <raghavendra.kt@linux.vnet.ibm.com>
Subject: [PATCH] mm readahead: Fix sys_readahead breakage by reverting 2MB limit (bug 79111)
Date: Thu, 3 Jul 2014 18:32:27 +0530 [thread overview]
Message-ID: <1404392547-11648-1-git-send-email-raghavendra.kt@linux.vnet.ibm.com> (raw)
commit 6d2be915 (mm/readahead.c: fix readahead failure for memoryless NUMA nodes
and limit readahead pages) imposed 2MB limits to readahed that yielded good
performance since it avoided unnecessay page caching.
However it broke sys_readahead semantics: 'readahead() blocks until the specified
data has been read'
This patch still retains the fix for memoryless nodes which used to return zero
and limits its readahead to 2MB to avoid unnecessary page cache thrashing but
reverts to old sanitized readahead for cpu with memory nodes.
link: https://bugzilla.kernel.org/show_bug.cgi?id=79111
Signed-off-by: Raghavendra K T <raghavendra.kt@linux.vnet.ibm.com>
---
mm/readahead.c | 18 ++++++++++++++++++
1 file changed, 18 insertions(+)
diff --git a/mm/readahead.c b/mm/readahead.c
index 0ca36a7..4514cf6 100644
--- a/mm/readahead.c
+++ b/mm/readahead.c
@@ -239,6 +239,24 @@ int force_page_cache_readahead(struct address_space *mapping, struct file *filp,
*/
unsigned long max_sane_readahead(unsigned long nr)
{
+ unsigned long local_free_page;
+ int nid;
+
+ nid = numa_node_id();
+ if (node_present_pages(nid)) {
+ /*
+ * We sanitize readahead size depending on free memory in
+ * the local node.
+ */
+ local_free_page = node_page_state(nid, NR_INACTIVE_FILE)
+ + node_page_state(nid, NR_FREE_PAGES);
+ return min(nr, local_free_page / 2);
+ }
+ /*
+ * Readahead onto remote memory is better than no readahead when local
+ * numa node does not have memory. We limit the readahead to 2MB to
+ * avoid trashing page cache.
+ */
return min(nr, MAX_READAHEAD);
}
--
1.7.11.7
--
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>
next reply other threads:[~2014-07-03 13:05 UTC|newest]
Thread overview: 14+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-07-03 13:02 Raghavendra K T [this message]
2014-07-03 15:41 ` [PATCH] mm readahead: Fix sys_readahead breakage by reverting 2MB limit (bug 79111) Linus Torvalds
2014-07-03 18:11 ` Raghavendra K T
2014-07-03 18:22 ` Linus Torvalds
2014-07-03 18:29 ` Linus Torvalds
2014-07-03 18:38 ` Raghavendra K T
2014-07-03 18:50 ` Raghavendra K T
2014-07-03 18:53 ` Linus Torvalds
2014-07-03 18:56 ` Raghavendra K T
2014-07-03 19:05 ` Dave Jones
2014-07-03 19:43 ` John Stoffel
2014-07-03 21:58 ` Linus Torvalds
2014-10-03 20:57 ` Rafael Aquini
2014-07-03 18:35 ` Raghavendra K T
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1404392547-11648-1-git-send-email-raghavendra.kt@linux.vnet.ibm.com \
--to=raghavendra.kt@linux.vnet.ibm.com \
--cc=akpm@linux-foundation.org \
--cc=damien.ramonda@intel.com \
--cc=david.a.cohen@linux.intel.com \
--cc=fengguang.wu@intel.com \
--cc=jack@suse.cz \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mm@kvack.org \
--cc=nacc@linux.vnet.ibm.com \
--cc=rientjes@google.com \
--cc=torvalds@linux-foundation.org \
--cc=viro@zeniv.linux.org.uk \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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).