Hi! > Currently during resume swsusp puts the image data in the page frames that > don't conflict with the original locations of the data (ie. the locations the > data will be put in when the saved system state is restored from the image). > These page frames are considered as "safe" and the other page frames are > treadet as "unsafe". > > Of course we cannot force the memory allocator to allocate "safe" pages only, > so if an "unsafe" page is allocated, swsusp treats it as an "eaten page" and > attempts to allocate another page in the hope that it'll be "safe" etc. > swsusp tries to allocate as many "safe" pages as necessary to store the > image data, so it "eats" a considerable number of "unsafe" pages in the > process. Next, it reads the image and puts the data into the allocated "safe" > pages. Finally, the data are copied to their "original" locations. > > This approach, although it works nicely, is quite inefficient from the memory > utilization point of view and it also turns out to be unnecessary. Namely, > for each "unsafe" page frame returned by the memory allocator there's exactly > one page in the image that finally should be placed in this page frame. > Therefore we can put the right data into this page frame as soon as they're > read from the image and we won't have to copy these data later on. This way > we'll only need to allocate as many pages as necessary to store the image > data and we won't have to "eat" the "unsafe" pages. Looks good to me. Clever hack, I'd say. Pavel -- Thanks for all the (sleeping) penguins.