Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/sys/kern Use membar_datadep_consumer where code inspection r...



details:   https://anonhg.NetBSD.org/src/rev/12655c8949cc
branches:  trunk
changeset: 335483:12655c8949cc
user:      riastradh <riastradh%NetBSD.org@localhost>
date:      Thu Jan 08 23:39:57 2015 +0000

description:
Use membar_datadep_consumer where code inspection reveals it necessary.

diffstat:

 sys/kern/subr_pcq.c |  9 ++++++---
 1 files changed, 6 insertions(+), 3 deletions(-)

diffs (37 lines):

diff -r df0b58195af1 -r 12655c8949cc sys/kern/subr_pcq.c
--- a/sys/kern/subr_pcq.c       Thu Jan 08 23:35:47 2015 +0000
+++ b/sys/kern/subr_pcq.c       Thu Jan 08 23:39:57 2015 +0000
@@ -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_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 @@
                /* 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) {
                /*



Home | Main Index | Thread Index | Old Index