Jonathon Jongsma wrote:
> On 2/12/07, Erik Anderson <erikerik at gmail.com> wrote:
>> On 2/12/07, Jonathon Jongsma <jonathon.jongsma at gmail.com> wrote:
>>> Note that this flash-drive-as-swap is supposedly one of the new
>>> features of Windows Vista.  This is from the FAQ [1]:
>>> Q: Won't this wear out the drive?
>>> A: Nope. We're aware of the lifecycle issues with flash drives and are
>>> smart about how and when we do our writes to the device. Our research
>>> shows that we will get at least 10+ years out of flash devices that we
>>> support.
>>>
>>> I have no idea how long a device would last with a similar setup under linux...
>>>
>>> [1] http://blogs.msdn.com/tomarcher/archive/2006/06/02/615199.aspx
>> This is really immaterial.  They're assuming that the flash device
>> will be used as flash devices normally are - as portable data transfer
>> media, not as swap.  It really doesn't matter which OS the device is
>> used with...rather, it's *how* the device is used.
> 
> Huh?  did you read the article?  It was *all* about using the flash
> drive as swap.
> 

Actually, from what I read, this isn't about using flash as swap.

<quote>
Q: What happens when you remove the drive?
A: When a surprise remove event occurs and we can't find the drive, we 
fall back to disk. Again, all pages on the device are backed by a page 
on disk. No exceptions. This isn't a separate page file store, but 
rather a cache to speed up access to frequently used data.
</quote>

It's using flash as swap "CACHE".  The article states that the HD is 
very efficient at large sequential reads, and a majority of flash keys 
are good for small random reads.  The technique they are talking about 
is *mirroring* the small random sections of the swap onto the flash 
disk.  In that case, when you add a flash disk, you don't gain anything, 
but you  loose the seek time of the HD for the smaller swap reads, and 
free up the HD for the long sequential reads.  This is _NOT_ using flash 
as swap.

When you talk about using flash as swap, then when you add a 1G flash 
drive to the system, you should have that much more free swap.  The 
article does not cover that.  According to the article, when you add a 
1G flash drive, you don't get 1G of more swap, you get 1G of cache for 
the swap file.  So if you are low on memory, adding a flash disk like 
this won't help at all.

And as far as I know, there isn't an equivalent setup for this in Linux. 
  And from reading the rest of the article, I'm not sure I'd want to do 
this anyway.

<quote>
Q: Isn't user data on a removable device a security risk?
A: This was one of our first concerns and to mitigate this risk, we use 
AES-128 to encrypt everything that we write to the device.
</quote>

AES-128 encrypted swap?  Add to that the complexity of trying to figure 
out what sections of swap are going to be small and random, weather the 
cache on the flash disk is current compared to the HD copy, timeouts 
trying to read flash drives during a "surprise remove", and trying to 
limit writes to keep your drive alive for "10+ years", I'm amazed that 
there's any noticeable performance improvement with this.  It's no 
wonder they wanted to require 64bit CPUs.

I'll admit, it's a cool idea and a good setup, but to quote Matt Ayers 
from the article: "adding RAM is still the best way to relieve memory 
pressure."