git: 067161c31fe8 - main - acpi: Tasks: Ensure sane values for number of tasks and threads
- Go to: [ bottom of page ] [ top of archives ] [ this month ]
Date: Fri, 13 Nov 2026 18:49:51 UTC
The branch main has been updated by olce:
URL: https://cgit.FreeBSD.org/src/commit/?id=067161c31fe8eed8a046ba3f820748cf9d6627c1
commit 067161c31fe8eed8a046ba3f820748cf9d6627c1
Author: Olivier Certner <olce@FreeBSD.org>
AuthorDate: 2026-10-01 13:57:57 +0000
Commit: Olivier Certner <olce@FreeBSD.org>
CommitDate: 2026-11-13 18:32:31 +0000
acpi: Tasks: Ensure sane values for number of tasks and threads
Make sure that these are set to sane values even on silly tunables:
- There must be at least one thread to process the 'acpi_taskq'.
- Use the ACPI_MAX_TASKS default when a negative number of tasks was
specified. This avoids common pilot errors causing a bogus huge memory
allocation for acpi_tasks[].
Reviewed by: obiwac (older version)
Differential Revision: https://reviews.freebsd.org/D60373
---
sys/dev/acpica/Osd/OsdSchedule.c | 10 ++++++++++
1 file changed, 10 insertions(+)
diff --git a/sys/dev/acpica/Osd/OsdSchedule.c b/sys/dev/acpica/Osd/OsdSchedule.c
index 957fe3e69a7c..badb15dd009f 100644
--- a/sys/dev/acpica/Osd/OsdSchedule.c
+++ b/sys/dev/acpica/Osd/OsdSchedule.c
@@ -94,6 +94,11 @@ static int acpi_taskq_started;
static void
acpi_task_init(void *arg)
{
+ if (acpi_max_tasks < 0) {
+ acpi_max_tasks = ACPI_MAX_TASKS;
+ printf("ACPI: Negative number of tasks, defaulting to %d.\n",
+ acpi_max_tasks);
+ }
acpi_tasks = malloc(sizeof(*acpi_tasks) * acpi_max_tasks, M_ACPITASK,
M_WAITOK | M_ZERO);
@@ -111,7 +116,12 @@ acpi_taskq_init(void *arg)
acpi_taskq = taskqueue_create_fast("acpi_task", M_WAITOK,
&taskqueue_thread_enqueue, &acpi_taskq);
+
+ if (acpi_max_threads < 1)
+ acpi_max_threads = 1;
+
taskqueue_start_threads(&acpi_taskq, acpi_max_threads, PWAIT, "acpi_task");
+
if (acpi_task_count > 0) {
if (bootverbose)
printf("AcpiOsExecute: enqueue %d pending tasks\n",