atomic_set_xxx(&x, 0)

Attilio Rao attilio at freebsd.org
Tue Dec 7 18:02:39 UTC 2010


2010/12/7 Andriy Gapon <avg at freebsd.org>:
>
> $ glimpse atomic_set_ | fgrep -w 0
> /usr/src/sys/dev/arcmsr/arcmsr.c:       atomic_set_int(&acb->srboutstandingcount, 0);
> /usr/src/sys/dev/arcmsr/arcmsr.c:       atomic_set_int(&acb->srboutstandingcount, 0);
> /usr/src/sys/dev/jme/if_jme.c:  atomic_set_int(&sc->jme_morework, 0);
> /usr/src/sys/dev/jme/if_jme.c:  atomic_set_int(&sc->jme_morework, 0);
> /usr/src/sys/dev/ale/if_ale.c:  atomic_set_int(&sc->ale_morework, 0);
> /usr/src/sys/mips/rmi/dev/xlr/rge.c:
> atomic_set_int(&(priv->frin_to_be_sent[i]), 0);
> /usr/src/sys/dev/drm/drm_irq.c:
> atomic_set_rel_32(&dev->vblank[i].count, 0);
> /usr/src/sys/dev/cxgb/ulp/tom/cxgb_tom.c:       atomic_set_int(&t->tids_in_use, 0);
>
> I wonder if these are all bugs and atomic_store_xxx() was actually intended?

Besides, we assume store on the int boundary is implicitly atomic on
all architectures on FreeBSD then, unless a memory barriers is needed,
there is no need to use atomic_* in "store" cases.

Attilio


-- 
Peace can only be achieved by understanding - A. Einstein


More information about the freebsd-hackers mailing list