]> git.ipfire.org Git - thirdparty/kernel/stable-queue.git/blob
b6af1fcdd40b884c88e852eb2162c014d7e73c8c
[thirdparty/kernel/stable-queue.git] /
1 From 6d2be915e589b58cb11418cbe1f22ff90732b6ac Mon Sep 17 00:00:00 2001
2 From: Raghavendra K T <raghavendra.kt@linux.vnet.ibm.com>
3 Date: Thu, 3 Apr 2014 14:48:23 -0700
4 Subject: mm/readahead.c: fix readahead failure for memoryless NUMA nodes and limit readahead pages
5
6 From: Raghavendra K T <raghavendra.kt@linux.vnet.ibm.com>
7
8 commit 6d2be915e589b58cb11418cbe1f22ff90732b6ac upstream.
9
10 Currently max_sane_readahead() returns zero on the cpu whose NUMA node
11 has no local memory which leads to readahead failure. Fix this
12 readahead failure by returning minimum of (requested pages, 512). Users
13 running applications on a memory-less cpu which needs readahead such as
14 streaming application see considerable boost in the performance.
15
16 Result:
17
18 fadvise experiment with FADV_WILLNEED on a PPC machine having memoryless
19 CPU with 1GB testfile (12 iterations) yielded around 46.66% improvement.
20
21 fadvise experiment with FADV_WILLNEED on a x240 machine with 1GB
22 testfile 32GB* 4G RAM numa machine (12 iterations) showed no impact on
23 the normal NUMA cases w/ patch.
24
25 Kernel Avg Stddev
26 base 7.4975 3.92%
27 patched 7.4174 3.26%
28
29 [Andrew: making return value PAGE_SIZE independent]
30 Suggested-by: Linus Torvalds <torvalds@linux-foundation.org>
31 Signed-off-by: Raghavendra K T <raghavendra.kt@linux.vnet.ibm.com>
32 Acked-by: Jan Kara <jack@suse.cz>
33 Cc: Wu Fengguang <fengguang.wu@intel.com>
34 Cc: David Rientjes <rientjes@google.com>
35 Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
36 Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
37 Signed-off-by: Mel Gorman <mgorman@suse.de>
38 Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
39
40 ---
41 mm/readahead.c | 4 ++--
42 1 file changed, 2 insertions(+), 2 deletions(-)
43
44 --- a/mm/readahead.c
45 +++ b/mm/readahead.c
46 @@ -233,14 +233,14 @@ int force_page_cache_readahead(struct ad
47 return 0;
48 }
49
50 +#define MAX_READAHEAD ((512*4096)/PAGE_CACHE_SIZE)
51 /*
52 * Given a desired number of PAGE_CACHE_SIZE readahead pages, return a
53 * sensible upper limit.
54 */
55 unsigned long max_sane_readahead(unsigned long nr)
56 {
57 - return min(nr, (node_page_state(numa_node_id(), NR_INACTIVE_FILE)
58 - + node_page_state(numa_node_id(), NR_FREE_PAGES)) / 2);
59 + return min(nr, MAX_READAHEAD);
60 }
61
62 /*