cvs commit: src/sys/compat/ndis kern_ndis.c ntoskrnl_var.h
wpaul at FreeBSD.org
Sat Feb 26 00:22:16 GMT 2005
wpaul 2005-02-26 00:22:16 UTC
FreeBSD src repository
sys/compat/ndis kern_ndis.c ntoskrnl_var.h
MDLs are supposed to be variable size (they include an array of pages
that describe a buffer of variable size). The problem is, allocating
MDLs off the heap is slow, and it can happen that drivers will allocate
lots and lots of lots of MDLs as they run.
As a compromise, we now do the following: we pre-allocate a zone for
MDLs big enough to describe any buffer with 16 or less pages. If
IoAllocateMdl() needs a MDL for a buffer with 16 or less pages, we'll
allocate it from the zone. Otherwise, we allocate it from the heap.
MDLs allocate from the zone have a flag set in their mdl_flags field.
When the MDL is released, IoMdlFree() will uma_zfree() the MDL if
it has the MDL_ZONE_ALLOCED flag set, otherwise it will release it
to the heap.
The assumption is that 16 pages is a "big number" and we will rarely
need MDLs larger than that.
- Moved the ndis_buffer zone to subr_ntoskrnl.c from kern_ndis.c
and named it mdl_zone.
- Modified IoAllocateMdl() and IoFreeMdl() to use uma_zalloc() and
uma_zfree() if necessary.
- Made ndis_mtop() use IoAllocateMdl() instead of calling uma_zalloc()
Inspired by: discussion with Giridhar Pemmasani
Revision Changes Path
1.68 +2 -15 src/sys/compat/ndis/kern_ndis.c
1.29 +4 -0 src/sys/compat/ndis/ntoskrnl_var.h
1.56 +41 -3 src/sys/compat/ndis/subr_ntoskrnl.c
More information about the cvs-src