how to understand the atomic_ops.txt

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

 



Hi All

In this document coming with kernel source, it has

"       int atomic_inc_and_test(atomic_t *v);
        int atomic_dec_and_test(atomic_t *v);

These two routines increment and decrement by 1, respectively, the
given atomic counter.  They return a boolean indicating whether the
resulting counter value was zero or not.

It requires explicit memory barrier semantics around the operation as
above."

Do this mean the code who call such functions should take care about the
barrier? or such functions take care for us already?

In kref_put(), http://lxr.linux.no/source/lib/kref.c?v=2.6.18#L50,
barrier is not used and many place where call the kref_put does not use
barrier as well. If so, can kref be safe to use in _any_ place?

Thanks.


Ming


-- 
http://blackmagic02881.wordpress.com/
 


--
Kernelnewbies: Help each other learn about the Linux kernel.
Archive:       http://mail.nl.linux.org/kernelnewbies/
FAQ:           http://kernelnewbies.org/faq/


[Index of Archives]     [Newbies FAQ]     [Linux Kernel Mentors]     [Linux Kernel Development]     [IETF Annouce]     [Git]     [Networking]     [Security]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux RAID]     [Linux SCSI]     [Linux ACPI]
  Powered by Linux