Module Name: src
Committed By: riastradh
Date: Thu Jan 8 23:39:57 UTC 2015
Modified Files:
src/sys/kern: subr_pcq.c
Log Message:
Use membar_datadep_consumer where code inspection reveals it necessary.
To generate a diff of this commit:
cvs rdiff -u -r1.8 -r1.9 src/sys/kern/subr_pcq.c
Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.
Modified files:
Index: src/sys/kern/subr_pcq.c
diff -u src/sys/kern/subr_pcq.c:1.8 src/sys/kern/subr_pcq.c:1.9
--- src/sys/kern/subr_pcq.c:1.8 Mon Jun 9 12:44:06 2014
+++ src/sys/kern/subr_pcq.c Thu Jan 8 23:39:57 2015
@@ -1,4 +1,4 @@
-/* $NetBSD: subr_pcq.c,v 1.8 2014/06/09 12:44:06 rmind Exp $ */
+/* $NetBSD: subr_pcq.c,v 1.9 2015/01/08 23:39:57 riastradh Exp $ */
/*-
* Copyright (c) 2009 The NetBSD Foundation, Inc.
@@ -34,7 +34,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: subr_pcq.c,v 1.8 2014/06/09 12:44:06 rmind Exp $");
+__KERNEL_RCSID(0, "$NetBSD: subr_pcq.c,v 1.9 2015/01/08 23:39:57 riastradh Exp $");
#include <sys/param.h>
#include <sys/types.h>
@@ -141,7 +141,8 @@ pcq_peek(pcq_t *pcq)
pcq_split(v, &p, &c);
/* See comment on race below in pcq_get(). */
- return (p == c) ? NULL : pcq->pcq_items[c];
+ return (p == c) ? NULL :
+ (membar_datadep_consumer(), pcq->pcq_items[c]);
}
/*
@@ -162,6 +163,8 @@ pcq_get(pcq_t *pcq)
/* Queue is empty: nothing to return. */
return NULL;
}
+ /* Make sure we read pcq->pcq_pc before pcq->pcq_items[c]. */
+ membar_datadep_consumer();
item = pcq->pcq_items[c];
if (item == NULL) {
/*