MDEV-6906 - Relaxed memory order for counters

Let some atomic counters use relaxed memory order.
MDEV-7004 - Merge scalability fixes from 10.0-power

Preallocate locks on THD mem_root to avoid expensive malloc.
MDEV-7004 - Merge scalability fixes from 10.0-power

Preallocate locks on THD mem_root to avoid expensive malloc.
MDEV-7004 - Merge scalability fixes from 10.0-power

Remove call to deprecated set_thread_state. It is noop anyway, but generates
function call independently of performance schema state. According to perf
this saves ~0.2% of execution time.
MDEV-7004 - Merge scalability fixes from 10.0-power

All callers of open_cached_file() use 2 characters prefix. Allocating memory for
such short string is an overkill. Store it on IO_CACHE structure instead.

All callers of open_cached_file() use mysql_tmpdir as dir. No need to allocate
memory for it since it is constant and available till server shutdown.

This reduces number of allocations from 31 to 27 per OLTP RO transaction.
Cherry pick dynamic array changes from commit:

commit 85fd3d901311688e18ffce92ffc78129e5625791
Author: Monty <monty@mariadb.org>
Date:   Fri Aug 29 14:07:43 2014 +0300

    my_alloc.c
    - Changed 0x%lx -> %p
    array.c:
    - Static (preallocated) buffer can now be anywhere
    my_sys.h
    - Define MY_INIT_BUFFER_USED
    sql_delete.cc & sql_lex.cc
    - Use memroot when allocating classes (avoids call to current_thd)
    sql_explain.h:
    - Use preallocated buffers
    sql_explain.cc:
    - Use preallocated buffers and memroot
    sql_select.cc:
    - Use multi_alloc_root() instead of many alloc_root()
    - Update calls to Explain
- Changed default values of query_prealloc_size and query_alloc_block_size
so that a simple query with one join would not have to call my_malloc.
- Allow lower limites for query_prealloc_size for testing.
- Fixed wrong initialization of trans_alloc_block_size
MDEV-7004 - Merge scalability fixes from 10.0-power

Preallocate dynamic array on THD mem_root to avoid expensive malloc.
MDEV-7004 - Merge scalability fixes from 10.0-power

Preallocate dynamic array and bitmap on mem_root to avoid expensive malloc.
This reduces number of allocations from 39 to 31 per OLTP RO transaction.
my_alloc.c
- Changed 0x%lx -> %p
array.c:
- Static (preallocated) buffer can now be anywhere
my_sys.h
- Define MY_INIT_BUFFER_USED
sql_delete.cc & sql_lex.cc
- Use memroot when allocating classes (avoids call to current_thd)
sql_explain.h:
- Use preallocated buffers
sql_explain.cc:
- Use preallocated buffers and memroot
sql_select.cc:
- Use multi_alloc_root() instead of many alloc_root()
- Update calls to Explain