~ [ source navigation ] ~ [ diff markup ] ~ [ identifier search ] ~

TOMOYO Linux Cross Reference
Linux/Documentation/atomic_bitops.txt

Version: ~ [ linux-6.11.5 ] ~ [ linux-6.10.14 ] ~ [ linux-6.9.12 ] ~ [ linux-6.8.12 ] ~ [ linux-6.7.12 ] ~ [ linux-6.6.58 ] ~ [ linux-6.5.13 ] ~ [ linux-6.4.16 ] ~ [ linux-6.3.13 ] ~ [ linux-6.2.16 ] ~ [ linux-6.1.114 ] ~ [ linux-6.0.19 ] ~ [ linux-5.19.17 ] ~ [ linux-5.18.19 ] ~ [ linux-5.17.15 ] ~ [ linux-5.16.20 ] ~ [ linux-5.15.169 ] ~ [ linux-5.14.21 ] ~ [ linux-5.13.19 ] ~ [ linux-5.12.19 ] ~ [ linux-5.11.22 ] ~ [ linux-5.10.228 ] ~ [ linux-5.9.16 ] ~ [ linux-5.8.18 ] ~ [ linux-5.7.19 ] ~ [ linux-5.6.19 ] ~ [ linux-5.5.19 ] ~ [ linux-5.4.284 ] ~ [ linux-5.3.18 ] ~ [ linux-5.2.21 ] ~ [ linux-5.1.21 ] ~ [ linux-5.0.21 ] ~ [ linux-4.20.17 ] ~ [ linux-4.19.322 ] ~ [ linux-4.18.20 ] ~ [ linux-4.17.19 ] ~ [ linux-4.16.18 ] ~ [ linux-4.15.18 ] ~ [ linux-4.14.336 ] ~ [ linux-4.13.16 ] ~ [ linux-4.12.14 ] ~ [ linux-4.11.12 ] ~ [ linux-4.10.17 ] ~ [ linux-4.9.337 ] ~ [ linux-4.4.302 ] ~ [ linux-3.10.108 ] ~ [ linux-2.6.32.71 ] ~ [ linux-2.6.0 ] ~ [ linux-2.4.37.11 ] ~ [ unix-v6-master ] ~ [ ccs-tools-1.8.9 ] ~ [ policy-sample ] ~
Architecture: ~ [ i386 ] ~ [ alpha ] ~ [ m68k ] ~ [ mips ] ~ [ ppc ] ~ [ sparc ] ~ [ sparc64 ] ~

  1 =============
  2 Atomic bitops
  3 =============
  4 
  5 While our bitmap_{}() functions are non-atomic, we have a number of operations
  6 operating on single bits in a bitmap that are atomic.
  7 
  8 
  9 API
 10 ---
 11 
 12 The single bit operations are:
 13 
 14 Non-RMW ops:
 15 
 16   test_bit()
 17 
 18 RMW atomic operations without return value:
 19 
 20   {set,clear,change}_bit()
 21   clear_bit_unlock()
 22 
 23 RMW atomic operations with return value:
 24 
 25   test_and_{set,clear,change}_bit()
 26   test_and_set_bit_lock()
 27 
 28 Barriers:
 29 
 30   smp_mb__{before,after}_atomic()
 31 
 32 
 33 All RMW atomic operations have a '__' prefixed variant which is non-atomic.
 34 
 35 
 36 SEMANTICS
 37 ---------
 38 
 39 Non-atomic ops:
 40 
 41 In particular __clear_bit_unlock() suffers the same issue as atomic_set(),
 42 which is why the generic version maps to clear_bit_unlock(), see atomic_t.txt.
 43 
 44 
 45 RMW ops:
 46 
 47 The test_and_{}_bit() operations return the original value of the bit.
 48 
 49 
 50 ORDERING
 51 --------
 52 
 53 Like with atomic_t, the rule of thumb is:
 54 
 55  - non-RMW operations are unordered;
 56 
 57  - RMW operations that have no return value are unordered;
 58 
 59  - RMW operations that have a return value are fully ordered.
 60 
 61  - RMW operations that are conditional are fully ordered.
 62 
 63 Except for a successful test_and_set_bit_lock() which has ACQUIRE semantics,
 64 clear_bit_unlock() which has RELEASE semantics and test_bit_acquire which has
 65 ACQUIRE semantics.
 66 
 67 Since a platform only has a single means of achieving atomic operations
 68 the same barriers as for atomic_t are used, see atomic_t.txt.
 69 

~ [ source navigation ] ~ [ diff markup ] ~ [ identifier search ] ~

kernel.org | git.kernel.org | LWN.net | Project Home | SVN repository | Mail admin

Linux® is a registered trademark of Linus Torvalds in the United States and other countries.
TOMOYO® is a registered trademark of NTT DATA CORPORATION.

sflogo.php