summaryrefslogtreecommitdiffstats
path: root/CryptoPkg
diff options
context:
space:
mode:
authorRay Ni <niruiyu@users.noreply.github.com>2020-04-10 10:51:26 +0800
committermergify[bot] <37929162+mergify[bot]@users.noreply.github.com>2020-04-13 03:13:36 +0000
commit3fdc47c65bba3fbbec96b5c8c8b7615dfefa9d42 (patch)
tree52e561e6b27a240859f9131ffe00acf77ba8ccb8 /CryptoPkg
parent21276ce09370bd3a6d4eeaab00ea8216c75c9c3e (diff)
downloadedk2-3fdc47c65bba3fbbec96b5c8c8b7615dfefa9d42.tar.gz
edk2-3fdc47c65bba3fbbec96b5c8c8b7615dfefa9d42.tar.bz2
edk2-3fdc47c65bba3fbbec96b5c8c8b7615dfefa9d42.zip
UefiCpuPkg/PiSmmCpuDxeSmm: Improve the performance of GetFreeToken()
Today's GetFreeToken() runs at the algorithm complexity of O(n) where n is the size of the token list. The change introduces a new global variable FirstFreeToken and it always points to the first free token. So the algorithm complexity of GetFreeToken() decreases from O(n) to O(1). The improvement matters when some SMI code uses StartupThisAP() service for each of the AP such that the algorithm complexity becomes O(n) * O(m) where m is the AP count. As next steps, 1. PROCEDURE_TOKEN.Used field can be optimized out because all tokens before FirstFreeToken should have "Used" set while all after FirstFreeToken should have "Used" cleared. 2. ResetTokens() can be optimized to only reset tokens before FirstFreeToken. v2: add missing line in InitializeDataForMmMp. v3: update copyright year to 2020. Signed-off-by: Ray Ni <ray.ni@intel.com> Reviewed-by: Eric Dong <eric.dong@intel.com> Reviewed-by: Star Zeng <star.zeng@intel.com>
Diffstat (limited to 'CryptoPkg')
0 files changed, 0 insertions, 0 deletions