Ticket #15804: vm-traces.patch

File vm-traces.patch, 3.5 KB (added by KapiX, 5 years ago)
  • src/system/kernel/vm/VMUserAddressSpace.cpp

    diff --git a/src/system/kernel/vm/VMUserAddressSpace.cpp b/src/system/kernel/vm/VMUserAddressSpace.cpp
    index 9e91b6cdd5..845628c844 100644
    a b  
    2424#include <vm/VMArea.h>
    2525
    2626
    27 //#define TRACE_VM
     27#define TRACE_VM
    2828#ifdef TRACE_VM
    2929#   define TRACE(x) dprintf x
    3030#else
    status_t  
    450450VMUserAddressSpace::_InsertAreaIntoReservedRegion(addr_t start, size_t size,
    451451    VMUserArea* area, uint32 allocationFlags)
    452452{
     453    TRACE(("VMUserAddressSpace::_InsertAreaIntoReservedRegion: address space %p, start "
     454        "0x%lx, size %ld, area %p\n",
     455        this, start, size, area));
     456
    453457    VMUserArea* next;
    454458
    455459    for (VMUserAreaList::Iterator it = fAreas.GetIterator();
    second_chance:  
    770774            return B_BAD_VALUE;
    771775    }
    772776
    773     if (!foundSpot)
     777    if (!foundSpot) {
     778        TRACE(("121\n"));
    774779        return addressSpec == B_EXACT_ADDRESS ? B_BAD_VALUE : B_NO_MEMORY;
     780    }
    775781
    776782    area->SetSize(size);
    777783    if (last)
  • src/system/kernel/vm/vm.cpp

    diff --git a/src/system/kernel/vm/vm.cpp b/src/system/kernel/vm/vm.cpp
    index f182ab53b4..6ef6163564 100644
    a b  
    5959#include "IORequest.h"
    6060
    6161
    62 //#define TRACE_VM
     62#define TRACE_VM
    6363//#define TRACE_FAULTS
    6464#ifdef TRACE_VM
    6565#   define TRACE(x) dprintf x
    static status_t  
    618618cut_area(VMAddressSpace* addressSpace, VMArea* area, addr_t address,
    619619    addr_t lastAddress, VMArea** _secondArea, bool kernel)
    620620{
     621    TRACE(("cut_area: aspace %p, address %" B_PRIuADDR ", lastAddress %" B_PRIuADDR
     622        ", kernel %d\n", addressSpace, address, lastAddress, kernel));
     623
    621624    // Does the cut range intersect with the area at all?
    622625    addr_t areaLast = area->Base() + (area->Size() - 1);
    623626    if (area->Base() > lastAddress || areaLast < address)
    static status_t  
    747750unmap_address_range(VMAddressSpace* addressSpace, addr_t address, addr_t size,
    748751    bool kernel)
    749752{
     753    TRACE(("unmap_address_range: aspace %p, address %" B_PRIuADDR ", size %" B_PRIuADDR
     754        ", kernel %d\n", addressSpace, address, size, kernel));
     755
    750756    size = PAGE_ALIGN(size);
    751757    addr_t lastAddress = address + (size - 1);
    752758
    map_backing_store(VMAddressSpace* addressSpace, VMCache* cache, off_t offset,  
    857863
    858864    if ((flags & CREATE_AREA_DONT_COMMIT_MEMORY) == 0) {
    859865        status = cache->SetMinimalCommitment(size, priority);
     866        TRACE(("err2 CREATE_AREA_DONT_COMMIT_MEMORY: %d\n", status));
    860867        if (status != B_OK)
    861868            goto err2;
    862869    }
    map_backing_store(VMAddressSpace* addressSpace, VMCache* cache, off_t offset,  
    866873        // okay, someone is trying to delete this address space now, so we can't
    867874        // insert the area, so back out
    868875        status = B_BAD_TEAM_ID;
     876        TRACE(("err2 IsBeingDeleted: %d\n", status));
    869877        goto err2;
    870878    }
    871879
    map_backing_store(VMAddressSpace* addressSpace, VMCache* cache, off_t offset,  
    887895        // for space to be freed up, but it would be good to at least notify
    888896        // that we tried and failed to allocate some amount.
    889897    }
     898    TRACE(("err2 InsertArea: %d\n", status));
    890899    if (status != B_OK)
    891900        goto err2;
    892901
    map_backing_store(VMAddressSpace* addressSpace, VMCache* cache, off_t offset,  
    912921    return B_OK;
    913922
    914923err2:
     924    TRACE(("map_backing_store: err2\n"));
    915925    if (mapping == REGION_PRIVATE_MAP) {
    916926        // We created this cache, so we must delete it again. Note, that we
    917927        // need to temporarily unlock the source cache or we'll otherwise
    err2:  
    921931        sourceCache->Lock();
    922932    }
    923933err1:
     934    TRACE(("map_backing_store: err1\n"));
    924935    addressSpace->DeleteArea(area, allocationFlags);
    925936    return status;
    926937}