]> xenbits.xensource.com Git - pvdrivers/win/xenbus.git/commit
Get rid of the single contiguous memory hole
authorPaul Durrant <pdurrant@amazon.com>
Wed, 12 Jul 2023 10:50:00 +0000 (11:50 +0100)
committerPaul Durrant <pdurrant@amazon.com>
Wed, 12 Jul 2023 15:46:44 +0000 (16:46 +0100)
commit843e69d79419d9da73c7adf03f866912377e159d
treed697b49663e4d4917e8cda43035a5fb0608574c5
parent354e773b4db67232c3625cf26e008140add16452
Get rid of the single contiguous memory hole

A standard grant table with 64 pages only uses half the allocated 2 MiB of
space and, empirically, getting more than 2 MiB of physically contiguous
memory doesn't seem to work very often.
By changing FdoAllocateHole() and FdoFreeHole() to use an MDL we can do
discrete contiguous allocations on-demand, which is all that is actually
required by callers. It's straightforward to adapt __AllocatePages() for
this purpose by having it pass the MM_ALLOCATE_REQUIRE_CONTIGUOUS_CHUNKS
flag to MmAllocatePagesForMdlEx().

NOTE: This means that the generic XENBUS_HOLE becomes XENBUS_PCI_HOLE.
      Also re-work the function naming so FdoAllocateHole() becomes
      FdoHoleAllocate() and other names are similarly restructured. It
      makes the code marginally neater.
      Take the opprtunity to also put zeroing of FrameIndex in the
      XENBUS_GNTTAB Context in the right place in the GnttabAcquire()
      error path, and adjust GnttabRelease() accordingly.

Signed-off-by: Paul Durrant <pdurrant@amazon.com>
src/common/util.h
src/xenbus/fdo.c
src/xenbus/fdo.h
src/xenbus/gnttab.c
src/xenbus/shared_info.c