[Question] Can we release vma that include code when one processis running?

From: liyu@WAN
Date: Thu Sep 15 2005 - 01:51:18 EST


Hi, All:

I am writing a patch to swap process memory to swap partition or swap file.
We think this make system speed up on PC that more little memory. It have
a bit like with page replacement algorithm depend application hit, but ours idea is
more easier.We found, if we try swap out openoffice.org, this way can save more
than 50M memory, and when switch task to run openoffice.org again, it do not read
all data that did swapped from swap space at most time.

According to result of experimmnt, the anonymous memory of one process are more than code
and data, even, it look some shared library as private code.

As general rule, we can only some swap anonymous memory. this's OK! I also done that.
However my question is if we release vma that include code when one process is running?
Of course, if the refcnt of vma is more than one, it can not be released yet. In fact,
I writing one patch to do this, some it do successfully on some simple process, but
in more time, I will get a SIGSEGV!

I am running IA32 architecture, I used one little python script to try this. and
get SIGSEGV each time. I dump memory that include that code, they are too simple:
...
nop
int $0x80
ret
nop
...

It seem that code in other place jump here to enter kernel. this is in a anonymous
code area.
At first time, I think this SIGSEGV will trigger by anonymous code that is swapped,
but I wrote one specical condition check to filte out this sort of code, IOW, I do
not swap out it. but I still get SIGSEGV.

May be, we can not be release the vma that include code? or, Is there have some errors
in my words for page fault?

sailor


-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/