mirror of
https://github.com/intel/compute-runtime.git
synced 2025-09-15 13:01:45 +08:00
Improve mmap logic in createAllocWithAlignment
Unmap trailing extra memory right away. Related-To: NEO-6417 Signed-off-by: Filip Hazubski <filip.hazubski@intel.com>
This commit is contained in:

committed by
Compute-Runtime-Automation

parent
a7455b5767
commit
170fd00d24
@ -964,7 +964,7 @@ HWTEST2_F(DrmMemoryManagerLocalMemoryTest, givenAlignmentAndSizeWhenMmapReturnsU
|
||||
auto allocation = memoryManager->createAllocWithAlignment(allocationData, MemoryConstants::pageSize, MemoryConstants::pageSize64k, MemoryConstants::pageSize64k, 0u);
|
||||
|
||||
EXPECT_EQ(alignUp(reinterpret_cast<void *>(0x12345678), MemoryConstants::pageSize64k), allocation->getMmapPtr());
|
||||
EXPECT_EQ(0u, munmapCalledCount);
|
||||
EXPECT_EQ(1u, munmapCalledCount);
|
||||
memoryManager->freeGraphicsMemory(allocation);
|
||||
EXPECT_EQ(3u, munmapCalledCount);
|
||||
munmapCalledCount = 0u;
|
||||
@ -999,10 +999,10 @@ HWTEST2_F(DrmMemoryManagerLocalMemoryTest, givenAlignmentAndSizeWhenMmapReturnsA
|
||||
};
|
||||
|
||||
munmapCalledCount = 0u;
|
||||
auto allocation = memoryManager->createAllocWithAlignment(allocationData, MemoryConstants::pageSize, 1u, MemoryConstants::pageSize64k, 0u);
|
||||
auto allocation = memoryManager->createAllocWithAlignment(allocationData, MemoryConstants::pageSize, 4u, MemoryConstants::pageSize64k, 0u);
|
||||
|
||||
EXPECT_EQ(reinterpret_cast<void *>(0x12345678), allocation->getMmapPtr());
|
||||
EXPECT_EQ(0u, munmapCalledCount);
|
||||
EXPECT_EQ(1u, munmapCalledCount);
|
||||
memoryManager->freeGraphicsMemory(allocation);
|
||||
EXPECT_EQ(2u, munmapCalledCount);
|
||||
munmapCalledCount = 0u;
|
||||
|
Reference in New Issue
Block a user