Skip to content

mm: Swap checksum

Cesar Eduardo Barros linux-mm linux-pm lkml 3 versions – New

Get series with b4
b4 am [email protected]

Versions newest first · linked by author and title

  1. v2 Latest posting 2/23 patches 0 repliesNew
  2. v2 posting 1/20 of 3 patches 0 repliesSuperseded
  3. v13 patches 21 repliesSuperseded

Patches in v2 posting 2/2 No applies recorded yet

#Subject and filesSizeRepliesApplied
1/3mm/swapfile.c: better messages for swap_info_getmm/swapfile.c+4 -40 replies
1/3mm/swapfile.c: better messages for swap_info_getmm/swapfile.c+4 -40 replies
2/3kernel/power/block_io.c: do not use end_swap_bio_readinclude/linux/swap.h kernel/power/block_io.c mm/page_io.c+22 -30 replies
2/3kernel/power/block_io.c: do not use end_swap_bio_readinclude/linux/swap.h kernel/power/block_io.c mm/page_io.c+22 -30 replies
3/3mm: Swap checksuminclude/linux/swap.h mm/Kconfig mm/Makefile +3 more+405 -110 replies
3/3mm: Swap checksuminclude/linux/swap.h mm/Kconfig mm/Makefile +3 more+405 -110 replies

Reviews trailers per patch

No Reviewed-by, Acked-by or Tested-by trailers for v2 yet.

Read the v2 thread

Cover letter [PATCH v2 0/3] mm: Swap checksum

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.

This protects against silent corruption of the swap caused by hardware problems, the same way the btrfs checksum protects against silent corruption of the filesystem. It is useful even with CONFIG_BLK_DEV_INTEGRITY because it also protects against reads of stale data.

The checksum is done in the swap layer (instead of in a separate block device or in the block layer) to allow the checksums to be tracked together with the rest of swap state (also allowing later for things like Avi Kivity's suggestions of keeping the checksum in the pte when possible and converting zeroed pages to a pte_none), to better allow for different things to be done by the software suspend code (which writes to the same place but has different needs), to simplify configuration (no need to edit the fstab), and because it felt the most natural layer to do it.

Note that this code does not currently checksum the software suspend image. That will need to be done later.

Lightly tested on a x86 VM.

Changes since -v1:
Rebase to 2.6.35-rc1 (code moved from swap.c to block_io.c) Use bio_data_dir() instead of acessing bi_rw directly Use __read_mostly for swapcsum_workqueue
Include highmem.h instead of pagemap.h

Cesar Eduardo Barros (3):
mm/swapfile.c: better messages for swap_info_get kernel/power/block_io.c: do not use end_swap_bio_read
mm: Swap checksum

 include/linux/swap.h    |   31 ++++++-
 kernel/power/block_io.c |   22 +++++-
 mm/Kconfig              |   22 +++++
 mm/Makefile             |    1 +
 mm/page_io.c            |   92 +++++++++++++++++--
 mm/swapcsum.c           |   94 ++++++++++++++++++++
 mm/swapfile.c           |  187 +++++++++++++++++++++++++++++++++++++--
 7 files changed, 431 insertions(+), 18 deletions(-)
 create mode 100644 mm/swapcsum.c
Signature · 9 lines
Cesar Eduardo Barros
[email protected]
[email protected]

--
To unsubscribe, send a message with 'unsubscribe linux-mm' in
the body to [email protected].  For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"[email protected]"> [email protected] </a>