• We’re currently investigating an issue related to the forum theme and styling that is impacting page layout and visual formatting. The problem has been identified, and we are actively working on a resolution. There is no impact to user data or functionality, this is strictly a front-end display issue. We’ll post an update once the fix has been deployed. Thanks for your patience while we get this sorted.

best way to configure an SSD for swap space in Linux?

cantab

Junior Member
I have an i7-950 system with 12 gig RAM running Matlab under Linux. 12 gig is not enough, so my code is using swap space. I'd like to swap to a solid state drive.

My question is, what is the best way to configure the SSD, and the Linux kernel and system, to minimize the overhead of paging RAM in and out?

Thanks!
 
I don't know if any specific tips or tricks since I don't have an SSD but a quick look at the latest linux git source tree shows that swapfile.c calls the appropriate blkdev_issue_discard function to TRIM the space on swapon.

However, if you've really got 1 process wanting a ton more memory than you physically have I wouldn't be surprised if you still ended up getting the OOM killer after it. How much memory are you looking to need?
 
I've seen people say before not to swap to an SSD, but why not?

I need 24 gig of memory, which would cost $2500 as DDR3 RAM. Swapping to a magnetic disk, my Matlab process terminates fine, and does not thrash, but is slow.

Is there a particular Linux file system that is best for swap disks? Or is there some way of using the SSD for swap that directly involves SSD pages rather than pretending the SSD is a file system?
 
I've seen people say before not to swap to an SSD, but why not?

I need 24 gig of memory, which would cost $2500 as DDR3 RAM. Swapping to a magnetic disk, my Matlab process terminates fine, and does not thrash, but is slow.

Is there a particular Linux file system that is best for swap disks? Or is there some way of using the SSD for swap that directly involves SSD pages rather than pretending the SSD is a file system?

Ah ok, if it works ok with a normal disk then it should still complete with an SSD, only faster.

Linux supports paging to full block devices and swap files so a filesystem is optional. You either just create a swap partition and use 'mkswap' to initialize it and 'swapon' to actually use it. Or create a filesystem, then create an empty file with something like 'dd' then 'mkswap' and 'swapon' that file.
 
If he's running out of main memory, I doubt a ram drive is much use.

The only possible reason to not swap to SSDs is that sequential writes have a chance of blocking (i.e preventing reads simultaneously). If your workload writes GB sized files and expects the system to be responsive at that time, that may be a problem. With RANDOM writes, any decent SSD should handle that fine.
 
Last edited:
Back
Top