[NTOS:MM] Dump pool consumers at most once per second.

This should avoid some log spam during kmtest:ExPools, which
intentionally depletes pool.
This commit is contained in:
Thomas Faber 2019-01-28 22:12:35 +01:00
parent 58215e5fb7
commit 066ee4db3b
No known key found for this signature in database
GPG key ID: 076E7C3D44720826

View file

@ -47,6 +47,7 @@ KSPIN_LOCK ExpLargePoolTableLock;
ULONG ExpPoolBigEntriesInUse;
ULONG ExpPoolFlags;
ULONG ExPoolFailures;
ULONGLONG MiLastPoolDumpTime;
/* Pool block/header/list access macros */
#define POOL_ENTRY(x) (PPOOL_HEADER)((ULONG_PTR)(x) - sizeof(POOL_HEADER))
@ -1937,11 +1938,14 @@ ExAllocatePoolWithTag(IN POOL_TYPE PoolType,
// Out of memory, display current consumption
// Let's consider that if the caller wanted more
// than a hundred pages, that's a bogus caller
// and we are not out of memory
// and we are not out of memory. Dump at most
// once a second to avoid spamming the log.
//
if (NumberOfBytes < 100 * PAGE_SIZE)
if (NumberOfBytes < 100 * PAGE_SIZE &&
KeQueryInterruptTime() >= MiLastPoolDumpTime + 10000000)
{
MiDumpPoolConsumers(FALSE, 0, 0, 0);
MiLastPoolDumpTime = KeQueryInterruptTime();
}
#endif
@ -2276,11 +2280,14 @@ ExAllocatePoolWithTag(IN POOL_TYPE PoolType,
// Out of memory, display current consumption
// Let's consider that if the caller wanted more
// than a hundred pages, that's a bogus caller
// and we are not out of memory
// and we are not out of memory. Dump at most
// once a second to avoid spamming the log.
//
if (NumberOfBytes < 100 * PAGE_SIZE)
if (NumberOfBytes < 100 * PAGE_SIZE &&
KeQueryInterruptTime() >= MiLastPoolDumpTime + 10000000)
{
MiDumpPoolConsumers(FALSE, 0, 0, 0);
MiLastPoolDumpTime = KeQueryInterruptTime();
}
#endif