コード例 #1
0
ファイル: lookasid.c プロジェクト: chunhualiu/OpenNT
LOGICAL
ExpScanGeneralLookasideList (
    IN PLIST_ENTRY ListHead,
    IN PKSPIN_LOCK SpinLock
    )

/*++

Routine Description:

    This function scans the specified list of general lookaside descriptors
    and adjusts the maximum depth as necessary.

Arguments:

    ListHead - Supplies the address of the listhead for a list of lookaside
        descriptors.

    SpinLock - Supplies the address of the spinlock to be used to synchronize
        access to the list of lookaside descriptors.

Return Value:

    A value of TRUE is returned if the maximum depth of any lookaside list
    is changed. Otherwise, a value of FALSE is returned.

--*/

{

    ULONG Allocates;
    LOGICAL Changes;
    PLIST_ENTRY Entry;
    PPAGED_LOOKASIDE_LIST Lookaside;
    ULONG Misses;
    KIRQL OldIrql;

    //
    // Raise IRQL and acquire the specified spinlock.
    //

    Changes = FALSE;
    ExAcquireSpinLock(SpinLock, &OldIrql);

    //
    // Scan the specified list of lookaside descriptors and adjust the
    // maximum depth as necessary.
    //
    // N.B. All lookaside list descriptor are treated as if they were
    //      paged descriptor even though they may be nonpaged descriptors.
    //      This is possible since both structures are identical except
    //      for the locking fields which are the last structure fields.

    Entry = ListHead->Flink;
    while (Entry != ListHead) {
        Lookaside = CONTAINING_RECORD(Entry,
                                      PAGED_LOOKASIDE_LIST,
                                      L.ListEntry);

        //
        // Compute the total number of allocations and misses per second for
        // this scan period.
        //

        Allocates = Lookaside->L.TotalAllocates - Lookaside->L.LastTotalAllocates;
        Lookaside->L.LastTotalAllocates = Lookaside->L.TotalAllocates;
        Misses = Lookaside->L.AllocateMisses - Lookaside->L.LastAllocateMisses;
        Lookaside->L.LastAllocateMisses = Lookaside->L.AllocateMisses;

        //
        // Compute target depth of lookaside list.
        //

        Changes |= ExpComputeLookasideDepth(Allocates,
                                            Misses,
                                            Lookaside->L.MaximumDepth,
                                            &Lookaside->L.Depth);

        Entry = Entry->Flink;
    }

    //
    // Release spinlock, lower IRQL, and return function value.
    //

    ExReleaseSpinLock(SpinLock, OldIrql);
    return Changes;
}
コード例 #2
0
ファイル: lookasid.c プロジェクト: chunhualiu/OpenNT
LOGICAL
ExpScanPoolLookasideList (
    IN PLIST_ENTRY ListHead
    )

/*++

Routine Description:

    This function scans the specified pool lookaside descriptors and adjusts
    the maximum depth as necessary.

Arguments:

    ListHead - Supplies a pointer to the list of pool lookaside structures.

Return Value:

    A value of TRUE is returned if the maximum depth of any lookaside list
    is changed. Otherwise, a value of FALSE is returned.

--*/

{

    ULONG Allocates;
    LOGICAL Changes;
    PNPAGED_LOOKASIDE_LIST Lookaside;
    PLIST_ENTRY NextEntry;
    ULONG Misses;

    //
    // Scan the specified list of lookaside descriptors and adjust the
    // maximum depth as necessary.
    //

    Changes = FALSE;
    NextEntry = ListHead->Flink;
    while (NextEntry != ListHead) {
        Lookaside = CONTAINING_RECORD(NextEntry,
                                      NPAGED_LOOKASIDE_LIST,
                                      L.ListEntry);

        //
        // Compute the total number of allocations and misses per second for
        // this scan period.
        //

        Allocates = Lookaside->L.TotalAllocates - Lookaside->L.LastTotalAllocates;
        Lookaside->L.LastTotalAllocates = Lookaside->L.TotalAllocates;
        Misses = Allocates - (Lookaside->L.AllocateHits - Lookaside->L.LastAllocateHits);
        Lookaside->L.LastAllocateHits = Lookaside->L.AllocateHits;

        //
        // Compute target depth of lookaside list.
        //

        Changes |= ExpComputeLookasideDepth(Allocates,
                                            Misses,
                                            Lookaside->L.MaximumDepth,
                                            &Lookaside->L.Depth);

        NextEntry = NextEntry->Flink;
    }

    return Changes;
}
コード例 #3
0
ファイル: lookasid.c プロジェクト: BillTheBest/WinNT4
LOGICAL
ExpScanPoolLookasideList (
    IN PSMALL_POOL_LOOKASIDE Lookaside
)

/*++

Routine Description:

    This function scans the specified pool lookaside descriptors and adjusts
    the maximum depth as necessary.

Arguments:

    Lookaside - Supplies a pointer to the first small pool lookaside list
        descritor.

Return Value:

    A value of TRUE is returned if the maximum depth of any lookaside list
    is changed. Otherwise, a value of FALSE is returned.

--*/

{

    ULONG Allocates;
    LOGICAL Changes;
    ULONG Index;
    ULONG Misses;

    //
    // Scan the specified list of lookaside descriptors and adjust the
    // maximum depth as necessary.
    //

    Changes = FALSE;
    for (Index = 0; Index < POOL_SMALL_LISTS; Index += 1) {

        //
        // Compute the total number of allocations and misses per second for
        // this scan period.
        //

        Allocates = Lookaside->TotalAllocates - Lookaside->LastTotalAllocates;
        Lookaside->LastTotalAllocates = Lookaside->TotalAllocates;
        Misses = Allocates - (Lookaside->AllocateHits - Lookaside->LastAllocateHits);
        Lookaside->LastAllocateHits = Lookaside->AllocateHits;

        //
        // Compute target depth of lookaside list.
        //

        Changes |= ExpComputeLookasideDepth(Allocates,
                                            Misses,
                                            Lookaside->MaximumDepth,
                                            &Lookaside->Depth);

        Lookaside += 1;
    }

    return Changes;
}