summaryrefslogtreecommitdiff
path: root/MdeModulePkg/Core/Dxe
diff options
context:
space:
mode:
authorStar Zeng <star.zeng@intel.com>2016-04-22 14:31:10 +0800
committerStar Zeng <star.zeng@intel.com>2016-04-26 17:31:25 +0800
commitdea0d6bf2f19989f0583f8ae163571105645c6ca (patch)
treecac162d914aedd2e7f502daa80e715bf8aeff93c /MdeModulePkg/Core/Dxe
parent6523ae8baa91aea55ebcfb0d4ac056eb1962b723 (diff)
downloadedk2-platforms-dea0d6bf2f19989f0583f8ae163571105645c6ca.tar.xz
MdeModulePkg DxeCore: Check free memory type by CoreUpdateProfile()
It can improve profile performance, especially when PcdMemoryProfileMemoryType configured without EfiBootServicesData. CoreUpdateProfile() can return quickly, but not depend on the further code to find the buffer not recorded and then return. Cc: Jiewen Yao <jiewen.yao@intel.com> Cc: Feng Tian <feng.tian@intel.com> Contributed-under: TianoCore Contribution Agreement 1.0 Signed-off-by: Star Zeng <star.zeng@intel.com> Reviewed-by: Jiewen Yao <jiewen.yao@intel.com>
Diffstat (limited to 'MdeModulePkg/Core/Dxe')
-rw-r--r--MdeModulePkg/Core/Dxe/DxeMain.h2
-rw-r--r--MdeModulePkg/Core/Dxe/Mem/MemoryProfileRecord.c13
-rw-r--r--MdeModulePkg/Core/Dxe/Mem/Page.c2
-rw-r--r--MdeModulePkg/Core/Dxe/Mem/Pool.c2
4 files changed, 7 insertions, 12 deletions
diff --git a/MdeModulePkg/Core/Dxe/DxeMain.h b/MdeModulePkg/Core/Dxe/DxeMain.h
index 82a3a9b4f2..e6b9114d2e 100644
--- a/MdeModulePkg/Core/Dxe/DxeMain.h
+++ b/MdeModulePkg/Core/Dxe/DxeMain.h
@@ -2821,7 +2821,7 @@ BOOLEAN
CoreUpdateProfile (
IN EFI_PHYSICAL_ADDRESS CallerAddress,
IN MEMORY_PROFILE_ACTION Action,
- IN EFI_MEMORY_TYPE MemoryType, // Valid for AllocatePages/AllocatePool
+ IN EFI_MEMORY_TYPE MemoryType,
IN UINTN Size, // Valid for AllocatePages/FreePages/AllocatePool
IN VOID *Buffer
);
diff --git a/MdeModulePkg/Core/Dxe/Mem/MemoryProfileRecord.c b/MdeModulePkg/Core/Dxe/Mem/MemoryProfileRecord.c
index 1588037461..6626e10159 100644
--- a/MdeModulePkg/Core/Dxe/Mem/MemoryProfileRecord.c
+++ b/MdeModulePkg/Core/Dxe/Mem/MemoryProfileRecord.c
@@ -1105,7 +1105,7 @@ BOOLEAN
CoreUpdateProfile (
IN PHYSICAL_ADDRESS CallerAddress,
IN MEMORY_PROFILE_ACTION Action,
- IN EFI_MEMORY_TYPE MemoryType, // Valid for AllocatePages/AllocatePool
+ IN EFI_MEMORY_TYPE MemoryType,
IN UINTN Size, // Valid for AllocatePages/FreePages/AllocatePool
IN VOID *Buffer
)
@@ -1121,15 +1121,10 @@ CoreUpdateProfile (
}
//
- // Free operations have no memory type information, so skip the check.
+ // Only record limited MemoryType.
//
- if ((Action == MemoryProfileActionAllocatePages) || (Action == MemoryProfileActionAllocatePool)) {
- //
- // Only record limited MemoryType.
- //
- if (!CoreNeedRecordProfile (MemoryType)) {
- return FALSE;
- }
+ if (!CoreNeedRecordProfile (MemoryType)) {
+ return FALSE;
}
ContextData = GetMemoryProfileContext ();
diff --git a/MdeModulePkg/Core/Dxe/Mem/Page.c b/MdeModulePkg/Core/Dxe/Mem/Page.c
index dbdc71b59c..898b722a43 100644
--- a/MdeModulePkg/Core/Dxe/Mem/Page.c
+++ b/MdeModulePkg/Core/Dxe/Mem/Page.c
@@ -1444,7 +1444,7 @@ CoreFreePages (
Status = CoreInternalFreePages (Memory, NumberOfPages, &MemoryType);
if (!EFI_ERROR (Status)) {
- CoreUpdateProfile ((EFI_PHYSICAL_ADDRESS) (UINTN) RETURN_ADDRESS (0), MemoryProfileActionFreePages, (EFI_MEMORY_TYPE) 0, EFI_PAGES_TO_SIZE (NumberOfPages), (VOID *) (UINTN) Memory);
+ CoreUpdateProfile ((EFI_PHYSICAL_ADDRESS) (UINTN) RETURN_ADDRESS (0), MemoryProfileActionFreePages, MemoryType, EFI_PAGES_TO_SIZE (NumberOfPages), (VOID *) (UINTN) Memory);
InstallMemoryAttributesTableOnMemoryAllocation (MemoryType);
}
return Status;
diff --git a/MdeModulePkg/Core/Dxe/Mem/Pool.c b/MdeModulePkg/Core/Dxe/Mem/Pool.c
index 5eced88efb..fec20a9e6e 100644
--- a/MdeModulePkg/Core/Dxe/Mem/Pool.c
+++ b/MdeModulePkg/Core/Dxe/Mem/Pool.c
@@ -505,7 +505,7 @@ CoreFreePool (
Status = CoreInternalFreePool (Buffer, &PoolType);
if (!EFI_ERROR (Status)) {
- CoreUpdateProfile ((EFI_PHYSICAL_ADDRESS) (UINTN) RETURN_ADDRESS (0), MemoryProfileActionFreePool, (EFI_MEMORY_TYPE) 0, 0, Buffer);
+ CoreUpdateProfile ((EFI_PHYSICAL_ADDRESS) (UINTN) RETURN_ADDRESS (0), MemoryProfileActionFreePool, PoolType, 0, Buffer);
InstallMemoryAttributesTableOnMemoryAllocation (PoolType);
}
return Status;