VSwap testing

From OpenVZ Virtuozzo Containers Wiki
Jump to: navigation, search

This article describes how to test VSwap functionality

[originally written by xemul@]

We need the following set of atomic tests

  • RAM limit works
  • SWAP limit works
  • OOM killer works
  • Pages sent to swap can be read back again
  • No real swapout starts when there's enough RAM on the node
  • No leaks happen after container stop

To do this the following set of atomic tests is required: 1) RAM limit works

  • Start container with unlimited RAM and SWAP.
  • Note the physpages.held value
  • Set RAM = physpages.held + X
  • Run memeater, that will map and touch RAM pages
  • _Before_ memeater exits check, that physpages.held didn't grow above the .limit

2) SWAP limit works

  • Start container with unlimited RAM and SWAP.
  • Note the physpages.held value
  • Set RAM = physpages.held + X
  • Set SWAP = Y
  • Run memeater, that will map and touch RAM + SWAP pages
  • Check that none of physpages.held and swappages.held grew above the .limit (memeater _may_ be killed during this test)

3) OOM killer works

  • Start two containers with unlimited RAM and SWAP
  • Set RAM and SWAP for both like in previous examples
  • Run memeater in one of them, that consumes infinite amount of RAM.
  • Check, that memeater is killed in the 1st container
  • Check, that no tasks in the 2nd one are killed

(the above three can probably be made of vzt-slm test) 4) Pages sent to swap can be read back again

  • Start container with unlimited RAM and SWAP.
  • Note the physpages.held value
  • Set RAM = physpages.held + X
  • Run memeater, that will map and write to 2xRAM pages
  • Check, that swappages.held is not zero
  • Make memeater read the whole memory again and check that the values written are preserved

5) No real swapout starts when there's enough RAM on the node

  • Take a node with non-zero swap partition
  • Start a container with unlimited RAM and SWAP
  • Note the physpages.held value
  • Check that real swap is not used
  • Set RAM = physpages.held + X
  • Run memeater, that will eat 2xRAM pages
  • Check, that memeater is not dead
  • Before memeater exits check, that swappages.held is not zero
  • Check that real swap is still not used

6) No leaks happen after container stop. This will be done using kmemleak - see PSBM-34183