summaryrefslogtreecommitdiffstats
path: root/MdeModulePkg
diff options
context:
space:
mode:
authorTaylor Beebe <t@taylorbeebe.com>2023-08-10 10:22:44 -0700
committermergify[bot] <37929162+mergify[bot]@users.noreply.github.com>2023-09-18 21:21:32 +0000
commit408e4631359d3e67633b36f6adf9a13a7cc573d3 (patch)
treedd5929ad56c5204c8861c70ca4f48038c39f2b11 /MdeModulePkg
parentdb38c7de64d4dda2bf3cc6e5d764b027b00afa59 (diff)
downloadedk2-408e4631359d3e67633b36f6adf9a13a7cc573d3.tar.gz
edk2-408e4631359d3e67633b36f6adf9a13a7cc573d3.tar.bz2
edk2-408e4631359d3e67633b36f6adf9a13a7cc573d3.zip
MdeModulePkg: Memory Bin Range Update Accounts for Guard Page
When finding a free page range for allocation, if the found range starts below the tracked memory bin address range, the lowest memory bin address is updated which will not include the guard page if present. When CoreConvertPagesWithGuard() is called on the range being allocated, the memory range is adjusted to include guard pages which can push it out of the memory bin address range and cause the memory type statistics to be unaltered. This patch updates the lowest memory bin address range to account for the guard page if NeedGuard is TRUE so the memory type statistics are updated correctly. Cc: Jian J Wang <jian.j.wang@intel.com> Cc: Liming Gao <gaoliming@byosoft.com.cn> Cc: Dandan Bi <dandan.bi@intel.com> Signed-off-by: Taylor Beebe <t@taylorbeebe.com> Reviewed-by: Liming Gao <gaoliming@byosoft.com.cn>
Diffstat (limited to 'MdeModulePkg')
-rw-r--r--MdeModulePkg/Core/Dxe/Mem/Page.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/MdeModulePkg/Core/Dxe/Mem/Page.c b/MdeModulePkg/Core/Dxe/Mem/Page.c
index 41af50b3d5..6497af5733 100644
--- a/MdeModulePkg/Core/Dxe/Mem/Page.c
+++ b/MdeModulePkg/Core/Dxe/Mem/Page.c
@@ -1210,7 +1210,7 @@ FindFreePages (
);
if (Start != 0) {
if (Start < mDefaultBaseAddress) {
- mDefaultBaseAddress = Start;
+ mDefaultBaseAddress = NeedGuard ? Start - EFI_PAGE_SIZE : Start;
}
return Start;