From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail02.groups.io (mail02.groups.io [66.175.222.108]) by spool.mail.gandi.net (Postfix) with ESMTPS id E5D3974003A for ; Thu, 10 Aug 2023 18:06:45 +0000 (UTC) DKIM-Signature: a=rsa-sha256; bh=pywU3P0FaDqwqH+Mt3kYASZuGEZpXUQxMZcYeOkgp4g=; c=relaxed/simple; d=groups.io; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References:MIME-Version:Precedence:List-Subscribe:List-Help:Sender:List-Id:Mailing-List:Delivered-To:Reply-To:List-Unsubscribe-Post:List-Unsubscribe:Content-Transfer-Encoding; s=20140610; t=1691690804; v=1; b=DGnSr65B/emnC1MvL6IfgfQnOMH23OHOYNCPbP3re3e+GBRsZEaNhHH+hjHxJ5aLDwgv9h9l XUoCdZRL1Y+PwqasA8waSNYPCGVm4odO6FfLb5Ky5lbJaQhd9SeuBOQwU5+yOTV/W786EiC3t9P eO126fe1fLYeYMGIu4aqF8aY= X-Received: by 127.0.0.2 with SMTP id 3zuaYY7687511xFKWLkfFk9j; Thu, 10 Aug 2023 11:06:44 -0700 X-Received: from mail-pf1-f170.google.com (mail-pf1-f170.google.com [209.85.210.170]) by mx.groups.io with SMTP id smtpd.web11.24834.1691690803894904815 for ; Thu, 10 Aug 2023 11:06:43 -0700 X-Received: by mail-pf1-f170.google.com with SMTP id d2e1a72fcca58-686efb9ee3cso1090865b3a.3 for ; Thu, 10 Aug 2023 11:06:43 -0700 (PDT) X-Gm-Message-State: bDykOYva8yfMWFdb5aonTxgUx7686176AA= X-Google-Smtp-Source: AGHT+IEl9Tbc6OE8uFz8LZRUhvptkoF5k+j5dAQOc2+Mg9CExGvbcJ3zf6W7dqosVZ9jcrekeZhqWA== X-Received: by 2002:a05:6a20:5512:b0:13a:ccb9:d5ad with SMTP id ko18-20020a056a20551200b0013accb9d5admr3324348pzb.44.1691690803114; Thu, 10 Aug 2023 11:06:43 -0700 (PDT) X-Received: from localhost.localdomain ([50.46.253.1]) by smtp.gmail.com with ESMTPSA id c2-20020aa78802000000b00687087d8bc3sm1873579pfo.141.2023.08.10.11.06.42 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 10 Aug 2023 11:06:42 -0700 (PDT) From: "Taylor Beebe" To: devel@edk2.groups.io Cc: Jian J Wang , Liming Gao , Dandan Bi Subject: [edk2-devel] [PATCH v1 1/1] MdeModulePkg: Memory Bin Range Update Accounts for Guard Page Date: Thu, 10 Aug 2023 11:06:30 -0700 Message-ID: <20230810180630.1879-2-t@taylorbeebe.com> In-Reply-To: <20230810180630.1879-1-t@taylorbeebe.com> References: <20230810180630.1879-1-t@taylorbeebe.com> MIME-Version: 1.0 Precedence: Bulk List-Subscribe: List-Help: Sender: devel@edk2.groups.io List-Id: Mailing-List: list devel@edk2.groups.io; contact devel+owner@edk2.groups.io Reply-To: devel@edk2.groups.io,t@taylorbeebe.com List-Unsubscribe-Post: List-Unsubscribe=One-Click List-Unsubscribe: Content-Transfer-Encoding: 8bit X-GND-Status: LEGIT Authentication-Results: spool.mail.gandi.net; dkim=pass header.d=groups.io header.s=20140610 header.b=DGnSr65B; dmarc=none; spf=pass (spool.mail.gandi.net: domain of bounce@groups.io designates 66.175.222.108 as permitted sender) smtp.mailfrom=bounce@groups.io From: Taylor Beebe 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. Signed-off-by: Taylor Beebe Cc: Jian J Wang Cc: Liming Gao Cc: Dandan Bi --- MdeModulePkg/Core/Dxe/Mem/Page.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/MdeModulePkg/Core/Dxe/Mem/Page.c b/MdeModulePkg/Core/Dxe/Mem/Page.c index 41af50b3d5ab..6497af573353 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; -- 2.41.0.windows.3 -=-=-=-=-=-=-=-=-=-=-=- Groups.io Links: You receive all messages sent to this group. View/Reply Online (#107698): https://edk2.groups.io/g/devel/message/107698 Mute This Topic: https://groups.io/mt/100668862/7686176 Group Owner: devel+owner@edk2.groups.io Unsubscribe: https://edk2.groups.io/g/devel/unsub [rebecca@openfw.io] -=-=-=-=-=-=-=-=-=-=-=-