Re: [PATCH 0/2] nsrepair2: Improve sorting performance and add tests
From: Nick Huang
Date: Sat Feb 14 2026 - 20:26:48 EST
Rafael J. Wysocki <rafael@xxxxxxxxxx> 於 2026年2月13日週五 下午9:40寫道:
>
> On Sun, Feb 1, 2026 at 2:03 PM Nick Huang <sef1548@xxxxxxxxx> wrote:
> >
> > This patch series improves the ACPI nsrepair2 sorting implementation
> > and adds comprehensive KUnit tests.
> >
> > Patch 1 replaces the O(n²) bubble sort algorithm in acpi_ns_sort_list()
> > with the kernel's sort_r() function, which uses heapsort to achieve
> > O(n log n) time complexity. This improves performance when sorting
> > large ACPI package lists (e.g., _PSS, _TSS) while reducing code
> > complexity by leveraging the existing kernel sort API.
> >
> > Patch 2 adds KUnit tests to verify the repair functions in nsrepair2.c,
> > covering:
> > - ACPI operand object creation (integer, string, buffer, package)
> > - Namespace node creation and NAMESEG comparison
> > - Package structures for _PSS, _CST, _ALR, _PRT methods
> > - _HID string format verification
> > - _FDE buffer expansion
> > - Sorting logic with ascending/descending order
> >
> >
> >
> > Nick Huang (2):
> > ACPI: nsrepair2: Replace O(n²) bubble sort with O(n log n) sort_r()
> > ACPI: acpica: Add KUnit tests for nsrepair2 repair functions
> >
> > drivers/acpi/acpica/nsrepair2.c | 87 ++-
> > drivers/acpi/acpica/nsrepair2_test.c | 854 +++++++++++++++++++++++++++
> > 2 files changed, 916 insertions(+), 25 deletions(-)
> > create mode 100644 drivers/acpi/acpica/nsrepair2_test.c
> >
> > --
>
> The ACPICA code in the kernel comes from the upstream ACPICA project
> (hosted on GitHub) as described in
> Documentation/driver-api/acpi/linuxized-acpica.rst.
>
> Changes to that code need to be made upstream from where they are
> picked up automatically after every upstream ACPICA release (or you
> can speed that up if need be by sending a Linux patch based on an
> upstream ACPICA commit).
>
> As for the test part, I'm not sure how useful it would be given the above.
>
> Thanks!
Hi Rafael J. Wysocki
Thank you for the reply. I will submit the changes via a Pull Request
to the upstream ACPICA GitHub repository as suggested.
--
Regards,
Nick Huang