Skip to content

swsusp: improve freeing of memory

Rafael J. Wysocki linux-pm 1 version In review

Get series with b4
b4 am [email protected]

Versions newest first

  1. v1 Latest2 patches 14 repliesIn review

Patches in v1 No applies recorded yet

#Subject and filesSizeRepliesApplied
1/2swsusp: introduce the swap map structureinclude/linux/suspend.h kernel/power/power.h kernel/power/snapshot.c +1 more+464 -1950 replies
2/2swsusp: improve freeing of memoryinclude/linux/suspend.h kernel/power/disk.c kernel/power/power.h +2 more+105 -344 replies

Reviews trailers per patch

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

Read the v1 thread

Cover letter [RFC/RFT][PATCH 0/2] swsusp: improve freeing of memory

Hi,

The following two patches are designed to make swsusp free only as much memory as needed for suspend and not as much as possible. This speeds up the suspend and resume significantly and causes the system to be much more responsive after resume.

The essential changes are in the second patch. However, to make it work properly on x86-64 it is necessary to get rid of the suspend image size limit imposed by the size of the swsusp_info structure. Of course this can be done in many different ways, but I think it is reasonable to do this in a way which will allow us to further separate the image-handling and swap-handling functionalities of swsusp in the future. Thus I propose to introduce a separate data structure for handling the swap and to remove the swap-related fields from the PBEs, which is done in the first patch.

The proposed approach yields some additional benefits, like the following:
1) the amount memory needed to store the list of PBEs (aka pagedir) is reduced by 1/4,
2) the amount of swap needed to store the image metadata is reduced by 1/2,
3) there's more memory available during suspend (the data structure used for keepeng track of the data pages written to the swap need not be loaded into memory during suspend),
4) the size of swsusp_info structure is reduced so it can be merged with the swsusp_header structure in the future,
5) the swap-handling part need not use any global variables related to the snapshot data structure,
6) the use of __nosavedata variables is reduced significantly.

The patches are on top of 2.6.14-mm1 with the three additional patches of mine that went to Andrew after 2.6.14-mm1. For your convenience the whole series of patches is available at:

http://www.sisk.pl/kernel/patches/2.6.14-mm1/

as:

swsusp-reduce-code-duplication.patch
swsusp-improve-relocation.patch
swsusp-rework-swsusp_suspend.patch
swsusp-introduce-swap-map.patch
swsusp-improve-freeing-memory.patch

and should be applied in that order.

The patches have been being tested on my box (Asus L5D, x86-64 "mode") for quite some time, but I haven't tested all of the error paths and the image encryption.

I would appreciate it very much if you could review the patches and send me any comments and/or suggestions. Also I would be grateful if you could test them, although please note they are not indended for the production use (yet).

Greetings,
Rafael