linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* swap on eMMC and other flash
@ 2012-03-30 17:44 Arnd Bergmann
  2012-03-30 18:50 ` Arnd Bergmann
       [not found] ` <CAEwNFnA2GeOayw2sJ_KXv4qOdC50_Nt2KoK796YmQF+YV1GiEA@mail.gmail.com>
  0 siblings, 2 replies; 41+ messages in thread
From: Arnd Bergmann @ 2012-03-30 17:44 UTC (permalink / raw)
  To: linaro-kernel
  Cc: android-kernel, linux-mm, Luca Porzio (lporzio),
	Alex Lemberg, linux-kernel, Saugata Das, Venkatraman S,
	Yejin Moon, Hyojin Jeong, linux-mmc

We've had a discussion in the Linaro storage team (Saugata, Venkat and me,
with Luca joining in on the discussion) about swapping to flash based media
such as eMMC. This is a summary of what we found and what we think should
be done. If people agree that this is a good idea, we can start working
on it.

The basic problem is that Linux without swap is sort of crippled and some
things either don't work at all (hibernate) or not as efficient as they
should (e.g. tmpfs). At the same time, the swap code seems to be rather
inappropriate for the algorithms used in most flash media today, causing
system performance to suffer drastically, and wearing out the flash hardware
much faster than necessary. In order to change that, we would be
implementing the following changes:

1) Try to swap out multiple pages at once, in a single write request. My
reading of the current code is that we always send pages one by one to
the swap device, while most flash devices have an optimum write size of
32 or 64 kb and some require an alignment of more than a page. Ideally
we would try to write an aligned 64 kb block all the time. Writing aligned
64 kb chunks often gives us ten times the throughput of linear 4kb writes,
and going beyond 64 kb usually does not give any better performance.

2) Make variable sized swap clusters. Right now, the swap space is
organized in clusters of 256 pages (1MB), which is less than the typical
erase block size of 4 or 8 MB. We should try to make the swap cluster
aligned to erase blocks and have the size match to avoid garbage collection
in the drive. The cluster size would typically be set by mkswap as a new
option and interpreted at swapon time.

3) As Luca points out, some eMMC media would benefit significantly from
having discard requests issued for every page that gets freed from
the swap cache, rather than at the time just before we reuse a swap
cluster. This would probably have to become a configurable option
as well, to avoid the overhead of sending the discard requests on
media that don't benefit from this.

Does this all sound appropriate for the Linux memory management people?

Also, does this sound useful to the Android developers? Would you
start using swap if we make it perform well and not destroy the drives?

Finally, does this plan match up with the capabilities of the
various eMMC devices? I know more about SD and USB devices and
I'm quite convinced that it would help there, but eMMC can be
more like an SSD in some ways, and the current code should be fine
for real SSDs.

	Arnd

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

end of thread, other threads:[~2012-07-16 13:29 UTC | newest]

Thread overview: 41+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2012-03-30 17:44 swap on eMMC and other flash Arnd Bergmann
2012-03-30 18:50 ` Arnd Bergmann
2012-03-30 22:08   ` Zach Pfeffer
2012-03-31  9:24     ` Arnd Bergmann
2012-04-03 18:17       ` Zach Pfeffer
2012-03-31 20:29   ` Hugh Dickins
2012-04-02 11:45     ` Arnd Bergmann
2012-04-02 14:41       ` Hugh Dickins
2012-04-02 14:55         ` Arnd Bergmann
2012-04-05  0:17           ` 정효진
2012-04-09 12:50             ` Arnd Bergmann
2012-04-08 13:50           ` Alex Lemberg
2012-04-09  2:14             ` Minchan Kim
2012-04-09  7:37               ` 정효진
2012-04-09  8:11                 ` Minchan Kim
2012-04-09 13:00                   ` Arnd Bergmann
2012-04-10  1:10                     ` Minchan Kim
2012-04-10  8:40                       ` Arnd Bergmann
2012-04-12  8:32                         ` Luca Porzio (lporzio)
2012-04-09 12:54                 ` Arnd Bergmann
2012-04-02 12:52     ` Luca Porzio (lporzio)
2012-04-02 14:58       ` Hugh Dickins
2012-04-02 16:51         ` Rik van Riel
2012-04-04 12:21   ` Adrian Hunter
2012-04-04 12:47     ` Arnd Bergmann
2012-04-11 10:28       ` Adrian Hunter
2012-07-16 13:29         ` Pavel Machek
     [not found] ` <CAEwNFnA2GeOayw2sJ_KXv4qOdC50_Nt2KoK796YmQF+YV1GiEA@mail.gmail.com>
2012-04-06 16:16   ` Arnd Bergmann
2012-04-09  2:06     ` Minchan Kim
2012-04-09 12:35       ` Arnd Bergmann
2012-04-10  0:57         ` Minchan Kim
2012-04-10  8:32           ` Arnd Bergmann
2012-04-11  9:54             ` Minchan Kim
2012-04-11 15:57               ` Arnd Bergmann
2012-04-12  2:36                 ` Minchan Kim
2012-04-16 18:22                 ` Stephan Uphoff
2012-04-16 18:59                   ` Arnd Bergmann
2012-04-16 21:12                     ` Stephan Uphoff
2012-04-17  2:18                       ` Minchan Kim
2012-04-17  2:05                     ` Minchan Kim
2012-04-27  7:34                   ` Luca Porzio (lporzio)

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).