NTSTATUS
ExInterlockedExtendZone(
IN PZONE_HEADER Zone,
IN PVOID Segment,
IN ULONG SegmentSize,
IN PKSPIN_LOCK Lock
);
ExInterlockedExtendZone extends a zone by adding another segment’s worth of blocks to the zone.
ExInterlockedExtendZone returns one of the following:
Status |
Meaning |
STATUS_UNSUCCESSFUL |
Segment was not aligned on an 8-byte boundary or a SegmentSize block could not be allocated. |
STATUS_SUCCESS |
The zone was successfully extended. |
When a zone has no free blocks, additional temporary memory should be allocated with ExAllocatePool, rather than ExInterlockedExtendZone or ExExtendZone. Such a temporary allocation can be released with ExFreePool when the original zone has free entries again.
ExInterlockedExtendZone allocates memory that remains allocated to its caller until the machine is rebooted. Consequently, ExInterlockedExtendZone should not be called every time a call to ExIsFullZone returns TRUE. Call ExInterlockedExtendZone only for a very heavy I/O demand situation when neither the original zone’s entries are being released nor the temporary memory allocated with ExAllocatePool.
The first ZONE_SEGMENT_HEADER-sized portion of the segment is used by the zone allocator. The remainder of the segment is divided into fixed-size blocks, as specified by BlockSize in the original call to ExInitializeZone, and added to the zone.
Support routines that do interlocked operations are assumed to be incapable of causing a page fault. That is, neither their code nor any of the data they touch can cause a page fault without bringing down the system. They use spin locks to achieve atomicity in SMP machines. The caller must provide resident storage for the Lock, which must be initialized with KeInitializeSpinLock before the initial call to an ExInterlockedXxx.
Callers of ExInterlockedExtendZone must be running at IRQL <= DISPATCH_LEVEL.
ExAllocatePool, ExFreePool, ExExtendZone, ExInitializeZone, ExInterlockedAllocateFromZone, ExInterlockedFreeToZone, ExIsFullZone, ExIsObjectInFirstZoneSegment