Re: [PATCH 0/3] mm: Swap checksum

From: Cesar Eduardo Barros
Date: Sun May 23 2010 - 14:33:07 EST

Em 23-05-2010 11:03, Minchan Kim escreveu:
On Sat, May 22, 2010 at 03:08:07PM -0300, Cesar Eduardo Barros wrote:
Add support for checksumming the swap pages written to disk, using the
same checksum as btrfs (crc32c). Since the contents of the swap do not
matter after a shutdown, the checksum is kept in memory only.

Note that this code does not checksum the software suspend image.
We have been used swap pages without checksum.

First of all, Could you explain why you need checksum on swap pages?
Do you see any problem which swap pages are broken?

The same reason we need checksums in the filesystem.

If you use btrfs as your root filesystem, you are protected by checksums from damage in the filesystem, but not in the swap partition (which is often in the same disk, and thus as vulnerable as the filesystem). It is better to get a checksum error when swapping in than having a silently corrupted page.

If you add checksums to the swap, the only piece missing (besides the partition table and bootloader, and the first one is solved by GPT, which also has a checksum) is checksumming the software suspend image. But it has a differente read/write path and different requirements (to start with, the checksums must be written to the disk too, while for the swap they can stay in memory only).

Cesar Eduardo Barros
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at
Please read the FAQ at