E
There are two ways to apply and use swap on your device, using a swap file or using a swap partition. This guide provides instructions for both of them.
Disable Compcache
First step is to confirm the status or presence of the compressed cache, thus ensuring that it is disabled.
While CyanogenMod does not enable Compcache support on all devices, and by default if available it comes disabled, you can check the status by accessing:
Settings » CyanogenMod settings » Performance settings » Compcache
If it doesn't show, your device doesn't support Compcache. If it show, disable it to use swap instead.
Using swap (file or partition)
Swap can give more available memory than Compcache, but you need at least a class 6 SD card to prevent slow access times. You should also be aware that SD write wear is increased, so, the card will last less than usual would last.
Using a swap file
This is the easiest way, you can have an app creating and managing the swap file for you:
Here's three recommended apps for this:
Swapper 2
Swapper
DroidSwap
Using a swap partition
You can manually create a swap partition, but for that to happen, you need to backup your SD card contents; format, and partition it.
The swap partition does bring better compatibility, when compared with swap files, but only concerning the connection of your phone as an USB mass storage device.
SD card partitioning
The method of reference if the use of MiniTool Partition Wizard Home Edition, compatible with Windows 2000/XP/Vista & Windows 7.
Download and install MiniTool Partition Wizard;
Remove the SD card from your device, insert into USB SD Card reader.
Windows should report a new drive and you should see the drive contents.
Delete old partitions on SD card:
Notes:
Operations are QUEUED, not instantly applied. So nothing is deleted and changed UNTIL you click "APPLY" and then confirm by clicking "OK".
Confirm that you are selecting and flagging to delete the correct drive. Your SD card should be the smallest one present on your computer.
Select it, with a right mouse click, select "Delete":
Create FAT or FAT32 partition:
Right mouse click over the SD card unallocated space, and click "create":
From "Create As", select: PRIMARY
From "File System", select:
For SD card bellow 2GB: FAT
For SD card above 2GB: FAT32
Under "Size and Location", at the right side, mouse left click and hold, then slide to the left to adjust the space for this partition.
create ext2 or ext3 or swap partition:
Right mouse click over the SD card unallocated space, and click "create":
From "Create As", select: PRIMARY
From "File System", select:
For App2SD: ext2
For swap: Linux Swap
Apply changes
Now that all has been created, you just need to apply and confirm the changes:
On the top left, there's a button labeled "Apply", press it:
A confirmation popup should be presented, press "Yes":
All done, your SD card can now return to your phone. If your current ROM is capable of using swap, it will detect and use it.
Notes
Please read everything carefully before proceeding. As mentioned by t0mm13b in the comments to your question, this subject as been covered, and the CyanogenMod team informs that this features are disabled by default due to potential issues:
Swap and Compressed Cache (Compcache) are optional memory management systems. By default, these schemes are disabled due to potential issues with some configurations.
Credits to:
CyanogenMod Wiki - Swap and Compcache
XDA Developers Forum - SD card partitioning