linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
From: Arnd Bergmann <arnd@arndb.de>
To: linaro-kernel@lists.linaro.org, linux-mm@kvack.org
Cc: "Luca Porzio (lporzio)" <lporzio@micron.com>,
	Alex Lemberg <alex.lemberg@sandisk.com>,
	linux-kernel@vger.kernel.org,
	Saugata Das <saugata.das@linaro.org>,
	Venkatraman S <venkat@linaro.org>,
	Yejin Moon <yejin.moon@samsung.com>,
	Hyojin Jeong <syr.jeong@samsung.com>,
	"linux-mmc@vger.kernel.org" <linux-mmc@vger.kernel.org>,
	kernel-team@android.com
Subject: Re: swap on eMMC and other flash
Date: Fri, 30 Mar 2012 18:50:22 +0000	[thread overview]
Message-ID: <201203301850.22784.arnd@arndb.de> (raw)
In-Reply-To: <201203301744.16762.arnd@arndb.de>

(sorry for the duplicated email, this corrects the address of the android
kernel team, please reply here)

On Friday 30 March 2012, Arnd Bergmann wrote:

 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
 

--
To unsubscribe, send a message with 'unsubscribe linux-mm' in
the body to majordomo@kvack.org.  For more info on Linux MM,
see: http://www.linux-mm.org/ .
Fight unfair telecom internet charges in Canada: sign http://stopthemeter.ca/
Don't email: <a href=mailto:"dont@kvack.org"> email@kvack.org </a>

  reply	other threads:[~2012-03-30 18:50 UTC|newest]

Thread overview: 42+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-03-30 17:44 swap on eMMC and other flash Arnd Bergmann
2012-03-30 18:50 ` Arnd Bergmann [this message]
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
2012-04-06  7:15 ` Minchan Kim
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)

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=201203301850.22784.arnd@arndb.de \
    --to=arnd@arndb.de \
    --cc=alex.lemberg@sandisk.com \
    --cc=kernel-team@android.com \
    --cc=linaro-kernel@lists.linaro.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mm@kvack.org \
    --cc=linux-mmc@vger.kernel.org \
    --cc=lporzio@micron.com \
    --cc=saugata.das@linaro.org \
    --cc=syr.jeong@samsung.com \
    --cc=venkat@linaro.org \
    --cc=yejin.moon@samsung.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;
as well as URLs for NNTP newsgroup(s).