Status: Complete

Our atomics functions currently has 4 different implementations:
1) GCC builtins:
2) Windows Interlocked operations:
3) Solaris atomics:
4) MY_ATOMIC_MODE_RWLOCKS - implementation using mutexes.

4) is used as a backup if neither 1, 2 or 3 can be used.

This worklog is about removing 4) and relying on that either 1, 2 and 3 can be
used for all supported platforms. By removing MY_ATOMIC_MODE_RWLOCKS we can
simplify our atomics API, remove code that we don't test, and prevent that

1,2,3 has performance benefits compared to 4. For example, for Windows
primitives reports a factor 50-100x performance benefit with high contention.

The possible downside is that any platform where 1, 2 or 3 doesn't work, won't
be able to compile MySQL.

Pushbuild testing using mysql-trunk-itch-full has shown one potential problem: 
32 bit RHEL 5 (e.g. loki19 and vitro97). In this case, the problem seems to 
be that GCC 4.1.2 is unable to detect that the processors support native 
atomics. This can be solved by upgrading GCC to 4.4 (which is in the RHEL 5 
repo) or using -march to specify platform explictly.
According to the list of supported platforms and compilers for 5.7 RHEL 5 will
be built using GCC 4.4, which removes this potential problem.

For relevant non-supported platforms, testing has shown that 1) works fine
both on ARM 32/64 bit and PowerPC 64 bit (both using GCC 4.7 or newer).
PowerPC 32 bit won't work, but this is not a supported platform and in
marginal use anyway.

User Documentation

NF-1: On platforms where native atomics are supported, this worklog will not 
      introduce any changes. On platforms where we don't have native atomics
      support, the server will no longer compile.
I-1: The MY_ATOMIC_MODE_RWLOCKS CMake parameter will be removed.

I-2: The WITH_ATOMIC_LOCKS CMake parameter will be removed. With RWLOCKS gone,
     only the "smp" value (native atomics) parameter value remained, making
     WITH_ATOMIC_LOCKS pointless. 
- Remove all my_atomic_rwlock_* macros (definition and usage)
- Remove my_atomic_rwlock_t (defintion and usage)
- Remove include/atomic/rwlock.h
- Simplify include/lf.h - remove lock/nolock macro wrappers 
- Remove storage/perfschema/pfs_atomic.cc
- Remove mysql_prlock_wrlock_if_atomic_mode_* macros in mdl.cc