Slow SSD + dm-crypt with Luks encryption in Ubuntu 12.10
Solution 1:
Your Samsung 840 Pro supports hardware AES encryption. If your laptop BIOS supports the ATA security feature mode set master and user passwords, you're in luck.
By setting the ATA master password in the BIOS, and then doing a secure erase of the drive, the drive firmware should generate new random AES keys. After the secure erase make sure that you've set good ATA master and user passwords. As far as I have been able to establish (see my post here http://vxlabs.com/2012/12/22/ssds-with-usable-built-in-hardware-based-full-disk-encryption/ ) the Samsung also encrypts its AES keys with your ATA password.
This will give you full speed AES encryption, no software required.
Solution 2:
There is a misconfiguration in Ubuntu that results in the aesni_intel module not being loaded early enough to handle crypto for boot-unlocked devices. I was able to fix this on my machines by doing:
sudo vim /etc/initramfs-tools/modules
Below the last line, add
# enable h/w accelerated encryption
cryptd
aes_x86_64
aesni_intel
Then run
sudo update-initramfs -u -k all
reboot, and enjoy. After this, on a similar SSD, I was seeing 500MB/s read and write with negligible CPU usage.
Full details on this bug are at https://bugs.launchpad.net/ubuntu/+source/cryptsetup/+bug/908387/comments/7