public inbox for devel@edk2.groups.io
 help / color / mirror / Atom feed
From: "IanX Kuo" <ianx.kuo@intel.com>
To: "Ni, Ray" <ray.ni@intel.com>,
	"devel@edk2.groups.io" <devel@edk2.groups.io>
Cc: "Chan, Amy" <amy.chan@intel.com>,
	"Dong, Eric" <eric.dong@intel.com>,
	"Kumar, Rahul1" <rahul1.kumar@intel.com>
Subject: Re: [PATCH v3 3/3] UefiCpuPkg/CpuCacheInfoLib: Add QuickSort function on BaseLib
Date: Mon, 18 Oct 2021 03:57:38 +0000	[thread overview]
Message-ID: <PH0PR11MB51744599722C4038388DAD8A8EBC9@PH0PR11MB5174.namprd11.prod.outlook.com> (raw)
In-Reply-To: <BN0PR11MB569697DDBC19B0B05E411E878CBC9@BN0PR11MB5696.namprd11.prod.outlook.com>

Thanks for the comment.
It will be taken care by V5 patch.

Thanks,
Ian Kuo
-----Original Message-----
From: Ni, Ray <ray.ni@intel.com> 
Sent: Monday, October 18, 2021 11:42 AM
To: Kuo, IanX <ianx.kuo@intel.com>; devel@edk2.groups.io
Cc: Chan, Amy <amy.chan@intel.com>; Dong, Eric <eric.dong@intel.com>; Kumar, Rahul1 <rahul1.kumar@intel.com>
Subject: RE: [PATCH v3 3/3] UefiCpuPkg/CpuCacheInfoLib: Add QuickSort function on BaseLib

Ian,
Thanks for cleaning up the code to remove MdeModulePkg  dependency.

Minor comments below:

   UINTN                     NextIndex;
+  VOID                      *QuickSortBuffer;

1.  Can you use local variable? "CPU_CACHE_INFO    SortBuffer".


-    PerformQuickSort (LocalCacheInfo, LocalCacheInfoCount, sizeof (*LocalCacheInfo), (SORT_COMPARE) CpuCacheInfoCompare);
+    QuickSortBuffer = AllocateZeroPool (sizeof (*LocalCacheInfo));
+    if (QuickSortBuffer == NULL) {
+      return EFI_OUT_OF_RESOURCES;
+    }

2. With #1 change, you can avoid "calling AllocateZeroPool() and checking pointer".

+    QuickSort (LocalCacheInfo, LocalCacheInfoCount, sizeof (*LocalCacheInfo), CpuCacheInfoCompare, QuickSortBuffer);

3. Just pass "&SortBuffer" as the last parameter.


      reply	other threads:[~2021-10-18  3:57 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-10-16 22:34 [PATCH v3 0/3] Add function QuickSort into MdePkg/BaseLib IanX Kuo
2021-10-16 22:34 ` [PATCH v3 1/3] MdeModulePkg/SortLib: Add QuickSort function on BaseLib IanX Kuo
2021-10-18  1:58   ` IanX Kuo
2021-10-18  2:50   ` 回复: [edk2-devel] " gaoliming
2021-10-16 22:34 ` [PATCH v3 2/3] CryptoPkg/CryptLib: " IanX Kuo
2021-10-17  2:23   ` Yao, Jiewen
2021-10-16 22:34 ` [PATCH v3 3/3] UefiCpuPkg/CpuCacheInfoLib: " IanX Kuo
2021-10-18  1:57   ` IanX Kuo
2021-10-18  3:42   ` Ni, Ray
2021-10-18  3:57     ` IanX Kuo [this message]

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=PH0PR11MB51744599722C4038388DAD8A8EBC9@PH0PR11MB5174.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