System processes recognition.
Bruce Evans
bde at zeta.org.au
Fri Mar 18 01:41:06 PST 2005
On Thu, 17 Mar 2005, David Xu wrote:
> Bruce Evans wrote:
>>
>> P_SYSTEM for init is bogus since it breaks at least procfs for init.
>> procfs may need to be disabled for init for security reasons, but it
>> shouldn't be disabled unconditionally. I mainly noticed /proc/1/map
>> not existing.
>>
>> There should be flags like P_KTHREAD as needed to make the properties
>> of init independent.
>
> Removing P_SYSTEM for init will cause it to be swapped out under heavy
> memory pressure, we unlikely want to swap out init, otherwise it results
> zoombies
> can not be recycled immediately, does anyone know that init is already be
> locked into memory, e.g, by PHOLD ?
As I said, there should be flags like PKTHREAD to control this
independently. Perhaps 2 flags to control swapouts and pageouts.
Only the stack pages are swapped out and the stack is a small part
of the process, so for init it is more important to prevent pageouts.
I think PHOLD() only affects swapouts. The comment about it in proc.h
doesn't say what it does -- the comment says that PHOLD() holds the U-area
in memory, but now there isn't even a U-area.
There is an explicit test for init in the pageout daemon. I think this
prevents init being paged out, so with my removal of P_SYSTEM for init,
init has the strange property of being swappable but not being pageable.
The test for init has the same hard-coded assumption on init's pid that
I fixed in kern_sig.c in my previous patch in this thread, and there is
a worse hard-coded assumptions on pids in the same expression:
%%%
Index: vm_pageout.c
===================================================================
RCS file: /home/ncvs/src/sys/vm/vm_pageout.c,v
retrieving revision 1.268
diff -u -2 -r1.268 vm_pageout.c
--- vm_pageout.c 7 Jan 2005 02:29:27 -0000 1.268
+++ vm_pageout.c 18 Mar 2005 09:15:09 -0000
@@ -1193,6 +1237,7 @@
/*
* If this is a system or protected process, skip it.
+ * XXX: unfixed: all style bugs, some pid magic (48).
*/
- if ((p->p_flag & P_SYSTEM) || (p->p_pid == 1) ||
+ if ((p->p_flag & P_SYSTEM) || (p == initproc) ||
(p->p_flag & P_PROTECTED) ||
((p->p_pid < 48) && (swap_pager_avail != 0))) {
%%%
Bruce
More information about the freebsd-arch
mailing list