tech-kern archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

Re: kernel memory allocation failures



On Dec 11,  7:30pm, dholland-tech%netbsd.org@localhost (David Holland) wrote:
-- Subject: Re: kernel memory allocation failures

| On Fri, Dec 11, 2015 at 11:00:06AM -0500, Christos Zoulas wrote:
|  > Fixing kmem_alloc() and friends not to fail under certain conditions might
|  > be possible, but it could lead to livelock scenarios where everything is
|  > stuck in the kernel waiting for resources to be freed.
| 
| That's a deadlock, not a livelock. But... if we think it's a realistic
| possibility, why do we allow sleeping allocations at all? And if it's
| not realistic, why are we worrying?

Semantics aside, sleeping allocations is the norm and interrupt
allocations are the exceptional case... The situation we have now
is that sleeping allocations, typically don't fail (so we don't
check for failure), but they can fail (so conservative coders add
*sometimes* asserts after them, and other times check for failure).

I don't think becoming linux and adding:

	__GPF_{WAIT,HIGH,COLD,NOWARN,REPEAT,NOFAIL,NORETRY,...}
	http://www.makelinux.net/books/lkd2/ch11lev1sec4

to the malloc flags will help, but I think that the CANSLEEP/NOSLEEP
semantics are and should be separate from the CANFAIL/NOFAIL semantics.

We have combined NOSLEEP to mean CANFAIL and CANSLEEP to mean NOFAIL and
RETRY, or at least this is what we advertise, but in reality both CANFAIL.

christos


Home | Main Index | Thread Index | Old Index