From: Greg KH <gregkh@linuxfoundation.org>
To: linux-kernel@vger.kernel.org, stable@vger.kernel.org
Cc: torvalds@linux-foundation.org, akpm@linux-foundation.org,
alan@lxorguk.ukuu.org.uk, Shaohua Li <shaohua.li@intel.com>,
Wu Fengguang <fengguang.wu@intel.com>,
Herbert Poetzl <herbert@13thfloor.at>,
Eric Dumazet <eric.dumazet@gmail.com>,
Christoph Hellwig <hch@infradead.org>,
Jens Axboe <axboe@kernel.dk>, Vivek Goyal <vgoyal@redhat.com>
Subject: [patch 01/55] readahead: fix pipeline break caused by block plug
Date: Fri, 10 Feb 2012 14:33:05 -0800 [thread overview]
Message-ID: <20120210223440.415587615@clark.kroah.org> (raw)
In-Reply-To: <20120210223500.GA24178@kroah.com>
3.0-stable review patch. If anyone has any objections, please let me know.
------------------
From: Shaohua Li <shaohua.li@intel.com>
commit 3deaa7190a8da38453c4fabd9dec7f66d17fff67 upstream.
Herbert Poetzl reported a performance regression since 2.6.39. The test
is a simple dd read, but with big block size. The reason is:
T1: ra (A, A+128k), (A+128k, A+256k)
T2: lock_page for page A, submit the 256k
T3: hit page A+128K, ra (A+256k, A+384). the range isn't submitted
because of plug and there isn't any lock_page till we hit page A+256k
because all pages from A to A+256k is in memory
T4: hit page A+256k, ra (A+384, A+ 512). Because of plug, the range isn't
submitted again.
T5: lock_page A+256k, so (A+256k, A+512k) will be submitted. The task is
waitting for (A+256k, A+512k) finish.
There is no request to disk in T3 and T4, so readahead pipeline breaks.
We really don't need block plug for generic_file_aio_read() for buffered
I/O. The readahead already has plug and has fine grained control when I/O
should be submitted. Deleting plug for buffered I/O fixes the regression.
One side effect is plug makes the request size 256k, the size is 128k
without it. This is because default ra size is 128k and not a reason we
need plug here.
Vivek said:
: We submit some readahead IO to device request queue but because of nested
: plug, queue never gets unplugged. When read logic reaches a page which is
: not in page cache, it waits for page to be read from the disk
: (lock_page_killable()) and that time we flush the plug list.
:
: So effectively read ahead logic is kind of broken in parts because of
: nested plugging. Removing top level plug (generic_file_aio_read()) for
: buffered reads, will allow unplugging queue earlier for readahead.
Signed-off-by: Shaohua Li <shaohua.li@intel.com>
Signed-off-by: Wu Fengguang <fengguang.wu@intel.com>
Reported-by: Herbert Poetzl <herbert@13thfloor.at>
Tested-by: Eric Dumazet <eric.dumazet@gmail.com>
Cc: Christoph Hellwig <hch@infradead.org>
Cc: Jens Axboe <axboe@kernel.dk>
Cc: Vivek Goyal <vgoyal@redhat.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
---
mm/filemap.c | 8 ++++----
1 file changed, 4 insertions(+), 4 deletions(-)
--- a/mm/filemap.c
+++ b/mm/filemap.c
@@ -1379,15 +1379,12 @@ generic_file_aio_read(struct kiocb *iocb
unsigned long seg = 0;
size_t count;
loff_t *ppos = &iocb->ki_pos;
- struct blk_plug plug;
count = 0;
retval = generic_segment_checks(iov, &nr_segs, &count, VERIFY_WRITE);
if (retval)
return retval;
- blk_start_plug(&plug);
-
/* coalesce the iovecs and go direct-to-BIO for O_DIRECT */
if (filp->f_flags & O_DIRECT) {
loff_t size;
@@ -1403,8 +1400,12 @@ generic_file_aio_read(struct kiocb *iocb
retval = filemap_write_and_wait_range(mapping, pos,
pos + iov_length(iov, nr_segs) - 1);
if (!retval) {
+ struct blk_plug plug;
+
+ blk_start_plug(&plug);
retval = mapping->a_ops->direct_IO(READ, iocb,
iov, pos, nr_segs);
+ blk_finish_plug(&plug);
}
if (retval > 0) {
*ppos = pos + retval;
@@ -1460,7 +1461,6 @@ generic_file_aio_read(struct kiocb *iocb
break;
}
out:
- blk_finish_plug(&plug);
return retval;
}
EXPORT_SYMBOL(generic_file_aio_read);
next prev parent reply other threads:[~2012-02-10 22:44 UTC|newest]
Thread overview: 56+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-02-10 22:35 [patch 00/55] 3.0.21-stable review Greg KH
2012-02-10 22:33 ` Greg KH [this message]
2012-02-10 22:33 ` [patch 02/55] ALSA: HDA: Fix duplicated output to more than one codec Greg KH
2012-02-10 22:33 ` [patch 03/55] ASoC: wm_hubs: Enable line out VMID buffer for single ended line outputs Greg KH
2012-02-10 22:33 ` [patch 04/55] ASoC: wm_hubs: fix wrong bits for LINEOUT2 N/P mixer Greg KH
2012-02-10 22:33 ` [patch 05/55] ARM: 7306/1: vfp: flush thread hwstate before restoring context from sigframe Greg KH
2012-02-10 22:33 ` [patch 06/55] ARM: 7307/1: vfp: fix ptrace regset modification race Greg KH
2012-02-10 22:33 ` [patch 07/55] ARM: 7308/1: vfp: flush thread hwstate before copying ptrace registers Greg KH
2012-02-10 22:33 ` [patch 08/55] ARM: OMAP2+: GPMC: fix device size setup Greg KH
2012-02-10 22:33 ` [patch 09/55] drivers/tty/vt/vt_ioctl.c: fix KDFONTOP 32bit compatibility layer Greg KH
2012-02-10 22:33 ` [patch 10/55] proc: mem_release() should check mm != NULL Greg KH
2012-02-10 22:33 ` [patch 11/55] proc: unify mem_read() and mem_write() Greg KH
2012-02-10 22:33 ` [patch 12/55] proc: make sure mem_open() doesnt pin the targets memory Greg KH
2012-02-10 22:33 ` [patch 13/55] firewire: ohci: add reset packet quirk for SB Audigy Greg KH
2012-02-10 22:33 ` [patch 14/55] firewire: ohci: disable MSI on Ricoh controllers Greg KH
2012-02-10 22:33 ` [patch 15/55] IB/mlx4: pass SMP vendor-specific attribute MADs to firmware Greg KH
2012-02-10 22:33 ` [patch 16/55] kprobes: fix a memory leak in function pre_handler_kretprobe() Greg KH
2012-02-10 22:33 ` [patch 17/55] at_hdmac: bugfix for enabling channel irq Greg KH
2012-02-10 22:33 ` [patch 18/55] mm/filemap_xip.c: fix race condition in xip_file_fault() Greg KH
2012-02-10 22:33 ` [patch 19/55] mm: compaction: check pfn_valid when entering a new MAX_ORDER_NR_PAGES block during isolation for migration Greg KH
2012-02-10 22:33 ` [patch 20/55] drm/radeon: Set DESKTOP_HEIGHT register to the framebuffer (not mode) height Greg KH
2012-02-10 22:33 ` [patch 21/55] drm/nouveau/gem: fix fence_sync race / oops Greg KH
2012-02-10 22:33 ` [patch 22/55] drm/radeon/kms: disable output polling when suspended Greg KH
2012-02-10 22:33 ` [patch 23/55] sched/rt: Fix task stack corruption under __ARCH_WANT_INTERRUPTS_ON_CTXSW Greg KH
2012-02-10 22:33 ` [patch 24/55] ASoC: Ensure we generate a driver name Greg KH
2012-02-10 22:33 ` [patch 25/55] udf: Mark LVID buffer as uptodate before marking it dirty Greg KH
2012-02-10 22:33 ` [patch 26/55] drm/i915: HDMI hot remove notification to audio driver Greg KH
2012-02-10 22:33 ` [patch 27/55] drm/i915: DisplayPort " Greg KH
2012-02-10 22:33 ` [patch 28/55] drm/i915: check ACTHD of all rings Greg KH
2012-02-10 22:33 ` [patch 29/55] drm/i915: Fix TV Out refresh rate Greg KH
2012-02-10 22:33 ` [patch 30/55] drm/i915: handle 3rd pipe Greg KH
2012-02-10 22:33 ` [patch 31/55] eCryptfs: Infinite loop due to overflow in ecryptfs_write() Greg KH
2012-02-10 22:33 ` [patch 32/55] cifs: Fix oops in session setup code for null user mounts Greg KH
2012-02-10 22:33 ` [patch 33/55] atmel_lcdfb: fix usage of CONTRAST_CTR in suspend/resume Greg KH
2012-02-10 22:33 ` [patch 34/55] lockdep, bug: Exclude TAINT_FIRMWARE_WORKAROUND from disabling lockdep Greg KH
2012-02-10 22:33 ` [patch 35/55] hwmon: (w83627ehf) Fix number of fans for NCT6776F Greg KH
2012-02-10 22:33 ` [patch 36/55] ASoC: wm_hubs: Fix routing of input PGAs to line output mixer Greg KH
2012-02-10 22:33 ` [patch 37/55] ASoC: wm_hubs: Correct line input to line output 2 paths Greg KH
2012-02-10 22:33 ` [patch 38/55] ASoC: wm8962: Fix word length configuration Greg KH
2012-02-10 22:33 ` [patch 39/55] pcmcia: fix socket refcount decrementing on each resume Greg KH
2012-02-10 22:33 ` [patch 40/55] mm: compaction: check for overlapping nodes during isolation for migration Greg KH
2012-02-10 22:33 ` [patch 41/55] mm: fix UP THP spin_is_locked BUGs Greg KH
2012-02-10 22:33 ` [patch 42/55] target: Use correct preempted registration sense code Greg KH
2012-02-10 22:33 ` [patch 43/55] target: Allow PERSISTENT RESERVE IN for non-reservation holder Greg KH
2012-02-10 22:33 ` [patch 44/55] target: Correct sense key for INVALID FIELD IN {PARAMETER LIST,CDB} Greg KH
2012-02-10 22:33 ` [patch 45/55] Staging: asus_oled: fix image processing Greg KH
2012-02-10 22:33 ` [patch 46/55] Staging: asus_oled: fix NULL-ptr crash on unloading Greg KH
2012-02-10 22:33 ` [patch 47/55] staging: r8712u: Add new Sitecom UsB ID Greg KH
2012-02-10 22:33 ` [patch 48/55] usb: gadget: zero: fix bug in loopback autoresume handling Greg KH
2012-02-10 22:33 ` [patch 49/55] usb: Skip PCI USB quirk handling for Netlogic XLP Greg KH
2012-02-10 22:33 ` [patch 50/55] USB: usbserial: add new PID number (0xa951) to the ftdi driver Greg KH
2012-02-10 22:33 ` [patch 51/55] USB: add new zte 3g-dongles pid to option.c Greg KH
2012-02-10 22:33 ` [patch 52/55] mmc: cb710 core: Add missing spin_lock_init for irq_lock of struct cb710_chip Greg KH
2012-02-10 22:33 ` [patch 53/55] [CPUFREQ] powernow-k8: Avoid Pstate MSR accesses on systems supporting CPB Greg KH
2012-02-10 22:33 ` [patch 54/55] [CPUFREQ] powernow-k8: Fix indexing issue Greg KH
2012-02-10 22:33 ` [patch 55/55] [PATCH] net: fix NULL dereferences in check_peer_redir() Greg KH
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=20120210223440.415587615@clark.kroah.org \
--to=gregkh@linuxfoundation.org \
--cc=akpm@linux-foundation.org \
--cc=alan@lxorguk.ukuu.org.uk \
--cc=axboe@kernel.dk \
--cc=eric.dumazet@gmail.com \
--cc=fengguang.wu@intel.com \
--cc=hch@infradead.org \
--cc=herbert@13thfloor.at \
--cc=linux-kernel@vger.kernel.org \
--cc=shaohua.li@intel.com \
--cc=stable@vger.kernel.org \
--cc=torvalds@linux-foundation.org \
--cc=vgoyal@redhat.com \
/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