Subject: Re: sleep and retry on ENOMEM (out of swap) instead of killing
To: None <>
From: Ben Harris <>
List: tech-kern
Date: 07/23/2003 12:37:34
In article <> you write:
>Is there any way to implement the kernel to sleep for a moment and retry
>at least one time instead of killing the process when out of swap?

NetBSD/acorn26 does this, largely because I tend to run it on
ludicrously under-powered machines.  My code (in
sys/acorn26/acorn26/except.c::do_fault()) says:

	for (;;) {
		error = uvm_fault(map, va, 0, atype);
		if (error != ENOMEM)
		log(LOG_WARNING, "pid %d.%d: VM shortage, sleeping\n",
		    l->l_proc->p_pid, l->l_lid);
		tsleep(&lbolt, PVM, "abtretry", 0);

NetBSD/i386 has rather different code in trap(), but it should be possible
to do something similar.

Ben Harris                                                   <>
Portmaster, NetBSD/acorn26           <URL:>