git: dd960a798daa - main - acpi: Tasks: Remove the now-redundant 'acpi_task_count'
- Go to: [ bottom of page ] [ top of archives ] [ this month ]
Date: Wed, 25 Nov 2026 12:16:45 UTC
The branch main has been updated by olce:
URL: https://cgit.FreeBSD.org/src/commit/?id=dd960a798daa0562142102467daa47e6743b9ddc
commit dd960a798daa0562142102467daa47e6743b9ddc
Author: Olivier Certner <olce@FreeBSD.org>
AuthorDate: 2026-10-08 13:13:31 +0000
Commit: Olivier Certner <olce@FreeBSD.org>
CommitDate: 2026-11-25 12:15:57 +0000
acpi: Tasks: Remove the now-redundant 'acpi_task_count'
That number is used only up to the moment when the ACPI taskqueue's
threads are started to print the number of tasks queued so far. This is
now redundant with 'acpi_boot_tasks_nb'. So use the latter and remove
it, with the benefit that no more useless updates are performed at task
creation and end, which could create contention.
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D61547
---
sys/dev/acpica/Osd/OsdSchedule.c | 12 ++++--------
1 file changed, 4 insertions(+), 8 deletions(-)
diff --git a/sys/dev/acpica/Osd/OsdSchedule.c b/sys/dev/acpica/Osd/OsdSchedule.c
index 11b5e5a4915a..6e8fcebb9a97 100644
--- a/sys/dev/acpica/Osd/OsdSchedule.c
+++ b/sys/dev/acpica/Osd/OsdSchedule.c
@@ -88,8 +88,6 @@ struct acpi_task_ctx {
struct taskqueue *acpi_taskq;
static struct acpi_task_ctx *acpi_tasks;
-/* Unsynchronized as only useful in the mono-CPU startup phase. */
-static int acpi_task_count;
static int acpi_taskq_started;
/*
@@ -117,7 +115,7 @@ SYSINIT(acpi_tasks, SI_SUB_DRIVERS, SI_ORDER_FIRST, acpi_task_init, NULL);
static void
acpi_taskq_init(void *arg)
{
- int i;
+ int boot_tasks_nb, i;
acpi_taskq = taskqueue_create_fast("acpi_task", M_WAITOK,
&taskqueue_thread_enqueue, &acpi_taskq);
@@ -127,10 +125,10 @@ acpi_taskq_init(void *arg)
taskqueue_start_threads(&acpi_taskq, acpi_max_threads, PWAIT, "acpi_task");
- if (acpi_task_count > 0) {
+ boot_tasks_nb = atomic_load_int(&acpi_boot_tasks_nb);
+ if (boot_tasks_nb > 0) {
if (bootverbose)
- printf("AcpiOsExecute: enqueue %d pending tasks\n",
- acpi_task_count);
+ printf("AcpiOsExecute: enqueue %d pending tasks\n", boot_tasks_nb);
for (i = 0; i < acpi_max_tasks; i++)
if (atomic_cmpset_int(&acpi_tasks[i].at_flag, ACPI_TASK_USED,
ACPI_TASK_USED | ACPI_TASK_ENQUEUED))
@@ -153,7 +151,6 @@ acpi_task_execute(void *context, int pending)
at = (struct acpi_task_ctx *)context;
at->at_function(at->at_context);
atomic_clear_int(&at->at_flag, ACPI_TASK_USED | ACPI_TASK_ENQUEUED);
- acpi_task_count--;
}
static ACPI_STATUS
@@ -168,7 +165,6 @@ acpi_task_enqueue(int priority, ACPI_OSD_EXEC_CALLBACK Function, void *Context)
if (atomic_cmpset_int(&acpi_tasks[i].at_flag, ACPI_TASK_FREE,
ACPI_TASK_USED)) {
at = &acpi_tasks[i];
- acpi_task_count++;
break;
}