From: "Ni, Ray" <ray.ni@intel.com>
To: "Tan, Dun" <dun.tan@intel.com>,
"devel@edk2.groups.io" <devel@edk2.groups.io>
Cc: "Kinney, Michael D" <michael.d.kinney@intel.com>,
"Gao, Liming" <gaoliming@byosoft.com.cn>,
"Liu, Zhiguang" <zhiguang.liu@intel.com>
Subject: Re: [PATCH] MdePkg: Code optimization to SMM InternalAllocateAlignedPages
Date: Thu, 18 May 2023 06:58:39 +0000 [thread overview]
Message-ID: <MN6PR11MB824400C9011D178537AE1AAC8C7F9@MN6PR11MB8244.namprd11.prod.outlook.com> (raw)
In-Reply-To: <20230518063715.1703-1-dun.tan@intel.com>
Dun,
I can understand what you are trying to describe in the commit message.
I have some suggestions/questions that might help you refine the commit message a bit better.
Code changes look good to me.
Thanks,
Ray
> -----Original Message-----
> From: Tan, Dun <dun.tan@intel.com>
> Sent: Thursday, May 18, 2023 2:37 PM
> To: devel@edk2.groups.io
> Cc: Ni, Ray <ray.ni@intel.com>; Kinney, Michael D
> <michael.d.kinney@intel.com>; Gao, Liming <gaoliming@byosoft.com.cn>; Liu,
> Zhiguang <zhiguang.liu@intel.com>
> Subject: [PATCH] MdePkg: Code optimization to SMM
> InternalAllocateAlignedPages
>
> This commit is code optimization to InternalAllocateAlignedPages of
> SmmMemoryAllocationLib which can reduce free memory fragments. Also
> it can reduce one pre-allocation page.
>
> Let's take a simple example:
> The expected pages size is 8KB, Alignment value is 8KB.
>
> In original InternalAllocateAlignedPages(), the first step is to
> allocate 4 pages and then find the first 8KB-aligned address in the
> allocated 4 pages. If the limit address is already 8KB aligned, then
1. What's "limit address"?
> the allocated 4 pages contains two 8KB-aligned 8KB ranges. The lower
> 2 pages will be selected and removed from free pages. Then the higher
> 2 pages will be free. Since the whole memory allocation is from high
> address to lower address, then the higher 2 pages cann't be merged
> other free pages, causing the free memory fragments.
>
> However, when only allocate 3(2+2-1) pages, we can avoid the free
> memory fragments in specific case. Also 3 pages must contain a
> 8kb-aligned 8kb range, which meets the requirement. If the limit
> of allocated 3 pages is 8KB-aligned, then the last 8K range will
2. What's "last 8k"?
next prev parent reply other threads:[~2023-05-18 6:58 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-05-18 6:37 [PATCH] MdePkg: Code optimization to SMM InternalAllocateAlignedPages duntan
2023-05-18 6:58 ` Ni, Ray [this message]
2023-05-18 7:28 ` duntan
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-list from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=MN6PR11MB824400C9011D178537AE1AAC8C7F9@MN6PR11MB8244.namprd11.prod.outlook.com \
--to=devel@edk2.groups.io \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox