Date: Thu, 11 Jun 2009 16:49:00 +0000 (UTC) From: Jung-uk Kim <jkim@FreeBSD.org> To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r194011 - head/sys/dev/acpica/Osd Message-ID: <200906111649.n5BGn00K053371@svn.freebsd.org>
next in thread | raw e-mail | index | archive | help
Author: jkim Date: Thu Jun 11 16:48:59 2009 New Revision: 194011 URL: http://svn.freebsd.org/changeset/base/194011 Log: - Remove unnecessary read memory barriers from atomic operations[1]. - Define a macro to make my intention more clearer. Submitted by: jhb [1] Modified: head/sys/dev/acpica/Osd/OsdSchedule.c Modified: head/sys/dev/acpica/Osd/OsdSchedule.c ============================================================================== --- head/sys/dev/acpica/Osd/OsdSchedule.c Thu Jun 11 15:51:14 2009 (r194010) +++ head/sys/dev/acpica/Osd/OsdSchedule.c Thu Jun 11 16:48:59 2009 (r194011) @@ -72,6 +72,7 @@ struct acpi_task_ctx { ACPI_OSD_EXEC_CALLBACK at_function; void *at_context; int at_flag; +#define ACPI_TASK_FREE 0 #define ACPI_TASK_USED 1 #define ACPI_TASK_ENQUEUED 2 }; @@ -111,7 +112,7 @@ acpi_taskq_init(void *arg) printf("AcpiOsExecute: enqueue %d pending tasks\n", acpi_task_count); for (i = 0; i < acpi_max_tasks; i++) - if (atomic_cmpset_acq_int(&acpi_tasks[i].at_flag, ACPI_TASK_USED, + if (atomic_cmpset_int(&acpi_tasks[i].at_flag, ACPI_TASK_USED, ACPI_TASK_USED | ACPI_TASK_ENQUEUED)) taskqueue_enqueue(acpi_taskq, &acpi_tasks[i].at_task); } @@ -142,7 +143,8 @@ acpi_task_enqueue(int priority, ACPI_OSD int i; for (at = NULL, i = 0; i < acpi_max_tasks; i++) - if (atomic_cmpset_acq_int(&acpi_tasks[i].at_flag, 0, ACPI_TASK_USED)) { + if (atomic_cmpset_int(&acpi_tasks[i].at_flag, ACPI_TASK_FREE, + ACPI_TASK_USED)) { at = &acpi_tasks[i]; acpi_task_count++; break;
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200906111649.n5BGn00K053371>