Re: Pool allocation question

Tech-Archive recommends: Fix windows errors by optimizing your registry



> When ExAllocatePoolWithTag allocates less than a page, it stores size of the
block and
>the tag somewhere.
> Does it prepend a header to the block?

Yes. 2 32bit words IIRC, second of them is tag. First of them is 4 bytes, which
are the logarithm of the allocation size, logarithm of the allocation size of
the previous block, and kind of pool - paged/nonpaged.

> The documentation says that allocations >= page size are aligned on page
size.

Yes. In this case, ExAllocatePoolWithTag is a wrapper around
MiAllocatePoolPages.

> If so, where is the header in this case?

No header is needed in this case. For nonpaged base pool (the one in contiguous
512M region), the things are kept in the PFN descriptor. For nonpaged extension
pool and paged pool, the things are kept IIRC in some special bitmap which
holds the allocation info for the pool address ranges. Probably the bits in PTE
itself are used too.

--
Maxim Shatskih, Windows DDK MVP
StorageCraft Corporation
maxim@xxxxxxxxxxxxxxxx
http://www.storagecraft.com


.



Relevant Pages

  • Re: Pool allocation question
    ... look into the pool header? ... anywhere near the internal header. ... An allocation of < PAGE_SIZE will not be ...
    (microsoft.public.development.device.drivers)
  • Re: Pool allocation question
    ... Thanks Max. So you say that in case of page sized allocation, trying to find the tag and size is not practical? ... never start on page aligned address because of the header? ... and kind of pool - paged/nonpaged. ...
    (microsoft.public.development.device.drivers)
  • Re: [patch 3/9] mempool - Make mempools NUMA aware
    ... I still think some sort of reserve pool ... under both memory pressure and network load. ... Any "real" reserve system will suffer from that problem. ... for trivially reclaimable allocation while not in active use. ...
    (Linux-Kernel)
  • Re: [PATCH] PCI Update for 2.6.3-rc1
    ... minimum allocation length may be as big as a page, ... consolidate your requests for consistent memory as much as possible. ... +Many drivers need lots of small dma-coherent memory regions for DMA ... +The pool createroutines initialize a pool of dma-coherent buffers ...
    (Linux-Kernel)
  • Re: D8: first impression and uneasy feeling... (long)
    ... Address-ordered allocation may help ... Consider a situation where small young objects are all put into the ... pool is running tight on space, a GC of this pool will occur. ... cache miss can cost 350+ lost cycles. ...
    (borland.public.delphi.non-technical)