From: Gernot Hillier <gernot.hillier@siemens.com>
To: linux-ext4@vger.kernel.org
Subject: unexpected sync delays in dpkg for small pre-allocated files on ext4
Date: Tue, 24 May 2016 19:07:41 +0200 [thread overview]
Message-ID: <57448A5D.4050805@siemens.com> (raw)
Hi there!
We experience strange delays with kernel 4.1.18 during dpkg package
installation on an ext4 filesystem after switching from Ubuntu 14.04 to
16.04. We can reproduce the issue with kernel 4.6. Installation of the
same package takes 2s with ext3 and 31s with ext4 on the same partition.
Hardware is an Intel-based server with Supermicro X8DTH board and
Seagate ST973451SS disks connected to an LSI SAS2008 controller (PCI
0x1000:0x0072, mpt2sas driver).
We could track this down to the introduction of fallocate() in recent
dpkg versions and derived the following synthetic test case. First
sync_file_range() call takes ~5ms, 2nd call ~15ms.
fd = open("test1.txt", 0xc1);
ret = fallocate(fd, 0, 0, 20);
ret = write(fd, "hallo", 6);
ret = sync_file_range(fd, 0, 0, 2);
ret = close(fd);
fd = open("test2.txt", 0xc1);
ret = fallocate(fd, 0, 0, 20);
ret = write(fd, "hallo", 6);
ret = sync_file_range(fd, 0, 0, 2);
ret = close(fd);
The delay is caused by sb_issue_zeroout() in ext4_ext_zeroout(), called
by ext4_ext_convert_to_initialized().
Ftrace function_graph snippet with important events (recorded with
kernel 4.6):
7) | ext4_ext_map_blocks() {
[...]
7) | /* ext4_ext_handle_unwritten_extents: ... */
7) | /* ext4_ext_convert_to_initialized_enter: ... */
7) | ext4_ext_zeroout() {
7) | ext4_issue_zeroout() {
[... CPU switches to kworker, then to <idle> ...]
[... 14 ms later, we continue...]
3) | /* irq_handler_entry: irq=25 name=mpt2sas0-msix0 */
3) | /* irq_handler_exit: irq=25 ret=handled */
7) | /* softirq_raise: vec=4 [action=BLOCK] */
7) | /* softirq_entry: vec=4 [action=BLOCK] */
7) | /* block_rq_complete: 8,16 W () 114969912 + 8 [0] */
[...]
7) * 14 ms | } /* ext4_issue_zeroout */
ANY of the following changes reduce the sync_file_range() runtime to <<
1 ms:
* do not use fallocate()
* fallocate() for more than extent_max_zeroout_kb, e.g. 40 kB
* echo 0 > /sys/fs/ext4/sdb2/extent_max_zeroout_kb
* use ext3 instead of ext4
* mount ext4 with -o dioread_nolock
To me, the problem looks comparable to
https://bugzilla.kernel.org/show_bug.cgi?id=56821 (even if we don't see
a full hang and there's no RAID involved for us), so a closer look on
the SCSI layer or driver might be the next step?
Any suggestions how to continue analysis are greatly appreciated!
--
Gernot Hillier, Siemens AG
Corporate Technology, Corporate Competence Center Embedded Linux
next reply other threads:[~2016-05-24 17:15 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-05-24 17:07 Gernot Hillier [this message]
2016-05-24 23:13 ` unexpected sync delays in dpkg for small pre-allocated files on ext4 Theodore Ts'o
2016-05-30 8:27 ` Gernot Hillier
2016-05-31 0:21 ` Dave Chinner
2016-06-01 9:44 ` Gernot Hillier
2016-06-01 13:17 ` Gernot Hillier
2016-06-01 14:12 ` Theodore Ts'o
2016-06-02 16:23 ` Gernot Hillier
2016-07-13 13:57 ` Gernot Hillier
2016-05-26 2:20 ` Dave Chinner
2016-05-26 7:02 ` Christoph Hellwig
-- strict thread matches above, loose matches on Subject: below --
2016-05-30 19:04 Jun He
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=57448A5D.4050805@siemens.com \
--to=gernot.hillier@siemens.com \
--cc=linux-ext4@vger.kernel.org \
/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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.