lkml.org 
[lkml]   [2013]   [Jun]   [12]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: Slow swap-in with SSD
On 06/11/2013 09:34:36 AM, Martin Steigerwald wrote:
> Hi!
>
> Using Linux 3.10-rc5 on an ThinkPad T520 with Intel Sandybridge
> i5-2620M,
> 8 GiB RAM and Intel SSD 320. Currently I have Zcache enabled to test
> the
> effects of it but I observed similar figures on kernels without
> Zcache.
>
> If I let the kernel swap out for example with
>
> stress -m 1 --vm-keep --vm-bytes 5G
>
> or so, then swapping out is pretty fast, I have seen values around
> 100-200 MiB/s
>
> But on issuing a swapoff command to swap stuff in again, the swap in
> is
> abysmally slow, just a few MiB/s (see below).
>
> I wonder why is that so? The SSD is basically idling around on
> swap-in.

Transaction granularity. Swapping out can queue up large batches of
pages because you can queue up more outgoing pages while the others are
still writing. Swapping _in_ you don't know what you need next until
you resume the process, so you fault in 4k, schedule DMA, resume the
process when it completes, fault on the next page, schedule more DMA,
rinse repeat. Programs don't really execute linearly, so you wind up
with round trip latency to and from device each time.

The problem with doing readahead on swapin is that programs jump around
randomly calling a function here and a function there, so you dunno
which other pages it'll need until it requests them. (Speculatively
faulting in pages when the system is starved of memory usually just
makes the memory shortage worse. This code only runs when there's a
shortage of physical pages.)

Having an ssd just exacerbates the problem, because with the device
itself sped up the round trip latency from all the tiny transactions
comes to dominate.

Rob

\
 
 \ /
  Last update: 2013-06-12 23:01    [W:0.116 / U:0.100 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site