Re: [hugang@soulinfo.com: [PATH]software suspend for ppc.]

From: hugang
Date: Thu Jan 06 2005 - 20:50:19 EST


On Thu, Jan 06, 2005 at 11:31:32PM +0100, Pavel Machek wrote:
> Hi!
>
> > adding a option to freeze/thaw_processes, first freeze all user
> > processess, from now only kernel processess running, Now we can shrink
> > more memory than current version, after that freeze all processes.
> > that's mean if your swap space enough, swsusp will not fail.
>
> Thanks for the port... ...what is the test case this fixes?
>
> Patch is pretty pretty simple, that's good...

# free
....
Mem: 256368 198148
...
Swap: 524280 140108

# ./eatmem 256

now do swsusp, the current swsusp will fail, with the patch it works.


--
Hu Gang .-.
/v\
// \\
Linux User /( )\ [204016]
GPG Key ID ^^-^^ http://soulinfo.com/~hugang/hugang.asc
#include <stdio.h>

static int
do_malloc(int size)
{
char *p;
int i;

for (i = 0; i < size; i++) {
p = malloc(1024 * 1024);
if (p == NULL) return -1;
memset(p, 1, 1024 * 1024);
printf("%2d\r", i);
fflush(stdout);
}
return (0);
}

int
main(int argc, char *argv[])
{
int size = 200;

if (argc == 2) {
size = atoi(argv[1]);
}

do_malloc(size);

pause();
}