Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1210618

[PATCH] mm/readahead.c: fix regression caused by small readahead limit

From Roman Gushchin <klamm@yandex-team.ru>
Newsgroups linux.kernel
Subject [PATCH] mm/readahead.c: fix regression caused by small readahead limit
Date 2015-08-20 18:30 +0200
Message-ID <pZASZ-1Mh-9@gated-at.bofh.it> (permalink)
Organization linux.* mail to news gateway

Show all headers | View raw


Effectively reverts: 6d2be915e589b58cb11418cbe1f22ff90732b6ac
("mm/readahead.c: fix readahead failure for memoryless NUMA nodes and
limit readahead pages").

This commit causes significant i/o performance regression on large
RAID disks. Limiting maximal readahead size by 2Mb is not suitable for
this case, alghough previous logic (based on free memory size
on current NUMA node) is much better.

To avoid regression in case of memoryless NUMA we can still use
MAX_READAHEAD constant, if current node has no (or less) free memory.

before:

$ dd if=/dev/md2 of=/dev/null bs=100M count=100
100+0 records in
100+0 records out
10485760000 bytes (10 GB) copied, 12.6441 s, 829 MB/s

$ dd if=/dev/md2 of=/dev/null bs=100M count=100 iflag=direct
100+0 records in
100+0 records out
10485760000 bytes (10 GB) copied, 9.49377 s, 1.1 GB/s

after:

$ dd if=/dev/md2 of=/dev/null bs=100M count=100
100+0 records in
100+0 records out
10485760000 bytes (10 GB) copied, 9.18119 s, 1.1 GB/s

$ dd if=/dev/md2 of=/dev/null bs=100M count=100 iflag=direct
100+0 records in
100+0 records out
10485760000 bytes (10 GB) copied, 9.34751 s, 1.1 GB/s

(It's 8 disks RAID 5 with 1024k chunk.)

Signed-off-by: Roman Gushchin <klamm@yandex-team.ru>
Cc: Linus Torvalds <torvalds@linux-foundation.org>
Cc: Raghavendra K T <raghavendra.kt@linux.vnet.ibm.com>
Cc: Jan Kara <jack@suse.cz>
Cc: Wu Fengguang <fengguang.wu@intel.com>
Cc: David Rientjes <rientjes@google.com>
Cc: Andrew Morton <akpm@linux-foundation.org>
---
 mm/readahead.c | 7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)

diff --git a/mm/readahead.c b/mm/readahead.c
index 60cd846..93a00b3 100644
--- a/mm/readahead.c
+++ b/mm/readahead.c
@@ -239,7 +239,12 @@ int force_page_cache_readahead(struct address_space *mapping, struct file *filp,
  */
 unsigned long max_sane_readahead(unsigned long nr)
 {
-	return min(nr, MAX_READAHEAD);
+	unsigned long max_sane;
+
+	max_sane = max(MAX_READAHEAD,
+		       (node_page_state(numa_node_id(), NR_INACTIVE_FILE) +
+			node_page_state(numa_node_id(), NR_FREE_PAGES)) / 2);
+	return min(nr, max_sane);
 }
 
 /*
-- 
2.4.3

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Back to linux.kernel | Previous | NextNext in thread | Find similar | Unroll thread


Thread

[PATCH] mm/readahead.c: fix regression caused by small readahead limit Roman Gushchin <klamm@yandex-team.ru> - 2015-08-20 18:30 +0200
  Re: [PATCH] mm/readahead.c: fix regression caused by small readahead limit Linus Torvalds <torvalds@linux-foundation.org> - 2015-08-20 21:30 +0200
    [PATCH] mm: use only per-device readahead limit Roman Gushchin <klamm@yandex-team.ru> - 2015-08-21 19:30 +0200
      Re: [PATCH] mm: use only per-device readahead limit Linus Torvalds <torvalds@linux-foundation.org> - 2015-08-21 20:20 +0200
        Re: [PATCH] mm: use only per-device readahead limit Roman Gushchin <klamm@yandex-team.ru> - 2015-08-21 22:30 +0200
          Re: [PATCH] mm: use only per-device readahead limit Linus Torvalds <torvalds@linux-foundation.org> - 2015-08-21 22:50 +0200
            [PATCH v2] mm: use only per-device readahead limit Roman Gushchin <klamm@yandex-team.ru> - 2015-08-24 14:00 +0200
              Re: [PATCH v2] mm: use only per-device readahead limit Konstantin Khlebnikov <khlebnikov@yandex-team.ru> - 2015-08-24 14:50 +0200

csiph-web