All of lore.kernel.org
 help / color / mirror / Atom feed
* Abysmal I/O scheduling with dm-crypt
@ 2011-08-30  7:14 martin f krafft
  2011-09-05 15:37 ` Jan Kara
  2011-09-19 18:39 ` Valdis.Kletnieks
  0 siblings, 2 replies; 4+ messages in thread
From: martin f krafft @ 2011-08-30  7:14 UTC (permalink / raw)
  To: linux kernel mailing list

[-- Attachment #1: Type: text/plain, Size: 2048 bytes --]

Dear list,

for years I have been plagued by the following problem, and it is
almost out of last resort that I am turning to you. I have searched
the web over the months. There is talk of dirty_ratios, of caches,
and of write throttling, but I have not been able to find a way to
fix the problem.

I am using encrypted filesystems (dm-crypt) and the 3.0.0 kernel.
Underneath might be a RAID1 or a fast SSD. On top is usually LVM
with a few LVs holding the system.

Whenever an I/O-intensive task starts, such as:

  - tar -c or -x
  - dd
  - rsync
  - notmuch
  - …

the system becomes unusable for several seconds at a time, at least
once or twice per minute. What seems to happen is that Vim or the
Shell or Firefox or whatever else completely blocks, waiting for
I/O, but Linux is not satisfying those I/O requests because it's
busy servicing the aforementioned I/O-intensive task. As a result,
Vim or the Shell or Firefox or whatever do not update, forcing me to
wait for them to get an I/O service slot.

People not running dm-crypt seem unable to reproduce this problem,
making me think that it must be due to dm-crypt, and I wouldn't find
it hard to imagine, because dm-crypt basically shields the
I/O-scheduler of the kernel, doesn't it? Worse, it probably doesn't
make any effort of scheduling I/O itself. Note: I know very little
about the internals, so please correct me if I am wrong.

I am wondering if this is the case, and if so, what could be done
about it.

Do you have any ideas and/or concrete suggestions?

PS: http://bugs.debian.org/635768 was the latest incarnation of my
    attempts to solve this problem (I accidentally wrote notmuch
    when I mean to write awesome in that report…).

-- 
martin | http://madduck.net/ | http://two.sentenc.es/
 
"gilmour's guitar sounds good
 whether you've got a bottle of cider in your hand
 or a keyboard and a mouse."
                                                -- prof. bruce maxwell
 
spamtraps: madduck.bogus@madduck.net

[-- Attachment #2: Digital signature (see http://martin-krafft.net/gpg/sig-policy/999bbcc4/current) --]
[-- Type: application/pgp-signature, Size: 1124 bytes --]

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: Abysmal I/O scheduling with dm-crypt
  2011-08-30  7:14 Abysmal I/O scheduling with dm-crypt martin f krafft
@ 2011-09-05 15:37 ` Jan Kara
  2011-09-08  2:51   ` Dan Merillat
  2011-09-19 18:39 ` Valdis.Kletnieks
  1 sibling, 1 reply; 4+ messages in thread
From: Jan Kara @ 2011-09-05 15:37 UTC (permalink / raw)
  To: martin f krafft; +Cc: linux kernel mailing list

  Hello,

On Tue 30-08-11 09:14:07, martin f krafft wrote:
> for years I have been plagued by the following problem, and it is
> almost out of last resort that I am turning to you. I have searched
> the web over the months. There is talk of dirty_ratios, of caches,
> and of write throttling, but I have not been able to find a way to
> fix the problem.
> 
> I am using encrypted filesystems (dm-crypt) and the 3.0.0 kernel.
> Underneath might be a RAID1 or a fast SSD. On top is usually LVM
> with a few LVs holding the system.
> 
> Whenever an I/O-intensive task starts, such as:
> 
>   - tar -c or -x
>   - dd
>   - rsync
>   - notmuch
>   - …
> 
> the system becomes unusable for several seconds at a time, at least
> once or twice per minute. What seems to happen is that Vim or the
> Shell or Firefox or whatever else completely blocks, waiting for
> I/O, but Linux is not satisfying those I/O requests because it's
> busy servicing the aforementioned I/O-intensive task. As a result,
> Vim or the Shell or Firefox or whatever do not update, forcing me to
> wait for them to get an I/O service slot.
>
> People not running dm-crypt seem unable to reproduce this problem,
> making me think that it must be due to dm-crypt, and I wouldn't find
> it hard to imagine, because dm-crypt basically shields the
> I/O-scheduler of the kernel, doesn't it? Worse, it probably doesn't
> make any effort of scheduling I/O itself. Note: I know very little
> about the internals, so please correct me if I am wrong.
> 
> I am wondering if this is the case, and if so, what could be done
> about it.
  So as a start can you provide blktrace of all the relevant devices (i.e.
underlying SATA drive and dm-crypt device)? I.e. on my machine with
dm-crypt I'd run
  blktrace -d /dev/sda -d /dev/mapper/cr_sda3

  Also periodically getting list of blocked processes like
while true; do ps axl | grep " D"; echo "------"; usleep 100000; done
  might sched some light.

								Honza
-- 
Jan Kara <jack@suse.cz>
SUSE Labs, CR

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: Abysmal I/O scheduling with dm-crypt
  2011-09-05 15:37 ` Jan Kara
@ 2011-09-08  2:51   ` Dan Merillat
  0 siblings, 0 replies; 4+ messages in thread
From: Dan Merillat @ 2011-09-08  2:51 UTC (permalink / raw)
  To: Jan Kara; +Cc: martin f krafft, linux kernel mailing list

> On Tue 30-08-11 09:14:07, martin f krafft wrote:
>> People not running dm-crypt seem unable to reproduce this problem,
>> making me think that it must be due to dm-crypt, and I wouldn't find
>> it hard to imagine, because dm-crypt basically shields the
>> I/O-scheduler of the kernel, doesn't it? Worse, it probably doesn't
>> make any effort of scheduling I/O itself. Note: I know very little
>> about the internals, so please correct me if I am wrong.

No, it's not specific to dm-crypt, these kinds of annoying IO hangs happen
on bare drives, MD arrays or DM-* setups.

There's a number of causes - including firefox history updates and the
abuse of create/sync/rename due to metadata hitting disk before data.

There's not going to be any movement on that front, I'm afraid, see
"Don't fear the fsync" (reproduced at
http://www.linuxfoundation.org/news-media/blogs/browse/2009/03/don%E2%80%99t-fear-fsync
 , the original site couldn't be reached while I'm writing this).

You can either throw more hardware at it, or use libeatmydata to
disable fsync across the board.  Maybe, eventually, a filesystem will
be written that can manage an atomic replace without fsync().  Don't
hold your breath.

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: Abysmal I/O scheduling with dm-crypt
  2011-08-30  7:14 Abysmal I/O scheduling with dm-crypt martin f krafft
  2011-09-05 15:37 ` Jan Kara
@ 2011-09-19 18:39 ` Valdis.Kletnieks
  1 sibling, 0 replies; 4+ messages in thread
From: Valdis.Kletnieks @ 2011-09-19 18:39 UTC (permalink / raw)
  To: martin f krafft; +Cc: linux kernel mailing list

[-- Attachment #1: Type: text/plain, Size: 986 bytes --]

On Tue, 30 Aug 2011 09:14:07 +0200, martin f krafft said:
> I am using encrypted filesystems (dm-crypt) and the 3.0.0 kernel.
> Underneath might be a RAID1 or a fast SSD. On top is usually LVM
> with a few LVs holding the system.
> 
> Whenever an I/O-intensive task starts, such as:

> the system becomes unusable for several seconds at a time, at least
> once or twice per minute.

Sorry for the late reply - I've seen similar on my laptop.  However, I haven't
dug further into it, because the use case that causes the most pain is backing
up the laptop to a LUKS partition on an external USB drive - and I usually
start that and go to bed so it's not-a-problem.   Also, it only wedges up
those processes that actually try to do disk I/O - which means that all
the terminal windows that are running SSH to various servers don't
usually take a hit and things don't get "unusable" in the sense of "totally
weged and locked up".

But I can at least confirm you're not hallucinating. :)



[-- Attachment #2: Type: application/pgp-signature, Size: 227 bytes --]

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2011-09-19 18:40 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2011-08-30  7:14 Abysmal I/O scheduling with dm-crypt martin f krafft
2011-09-05 15:37 ` Jan Kara
2011-09-08  2:51   ` Dan Merillat
2011-09-19 18:39 ` Valdis.Kletnieks

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.