Dillon's comments on FreeBSD/DFly's VM
Dillon wrote:
Well, this is fun. There are over 460 files in the 5.x source tree (360 in DFly) that make calls to
malloc(... M, and so far about 80% of the calls that I’ve reviewed generate inappropriate side effects when/if a failure occurs. CAM is the biggest violator… it even has a few_NOWAIT) panic()conditionals if amalloc(... Mfails. Not Fun!_NOWAIT)
In particular, Dillon said that most of the M_NOWAIT flag was used inappropriately in FreeBSD and DFly. Dillon then wrote this in DFly’s mailing list:
I think I’ve come up with a solution! The reason
M_NOWAITis used is primarily because an interrupt thread may be preempting a normal thread and cannot safely manipulate ‘cache’ pages in the VM page queues. This is because reusing a cache page requires messing around with the VM Object the cache page resides in. SoM_NOWAITcauseskmem_malloc()to only pull pages out of the VM ‘free’ page queue. At the same time it is allowed to actually exhaust the free page queue whereas normal allocations are not allowed to completely exhaust the free page queue.
More discussion seemed to be related to junsu’s bug report. So I am interested in this thread.
在线阅读本文并参与讨论 delphij's Chaos blog.delphij.net/posts/2004/01/dillons-comment/