On Mon, Feb 1, 2010 at 4:08 AM, Artur Grabowski <a...@blahonga.org> wrote: > caller holds lock on kernel_map. getpage pool is empty, caller wakes > up the getpage thread, goes to sleep (still holding the kernel_map > lock), getpage thread wakes up, deadlocks on the kernel_map lock. It's > not an easily detectable recursion either, so we don't panic when it > happens, we just hang. > > amd64 can avoid it thanks to the direct map (no kernel_map involed when > calling getpage). > > We could try some magic with allocating from a pool with NOWAIT and > then fall back to kmem_map when that fails, but the logic would become > hairy. Maybe a pool allocator with those semantics?
We could keep a couple entries always available. Then the logic goes like this: if (alloc(NOWAIT)) use freelist; else while (freelist < minsize) alloc(NOWAIT).