tech-kern archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
reducing the use of M_NOWAIT / KM_NOSLEEP memory allocations
hi folks,
I'd like to convert more of the M_NOWAIT / KM_NOSLEEP memory allocations to
M_WAITOK / KM_SLEEP. Use of the nowait variety should be avoided wherever
possible because it causes operations to fail randomly just because the
system happens to be low on memory at the time.
We currently use the nowait variety for most allocations done in device attach
methods, which I believe is due to the notion that we don't want to hang
if we run out of memory at boot time before the pagedaemon thread has been
created. However, if this situation does arise, failing to attach the
rest of the devices is very likely to result in an unusable system anyway,
so this doesn't seem all that useful. Furthermore, these days many devices
can be attached later after the system is fully up, so using nowait allocations
is undesirable in this context.
What I'm planning to do instead of using nowait allocations in device attach
is to have uvm_wait() just panic if it is called before the pagedaemon thread
has been created. This will avoid any hang due to running out of memory
during system startup.
Then we can gradually change all of the memory allocations in device
attach methods to be wait/sleep instead and remove all the checks for
allocation failures from these calls. Wait/sleep allocations will
wait forever and thus they never return failure.
Does anyone have any comments on this plan?
-Chuck
Home |
Main Index |
Thread Index |
Old Index