MB-11772: Add `release_free_memory` ioctl and `mcctl` program to access them

Add two new binary protocol commands:

  * PROTOCOL_BINARY_CMD_IOCTL_GET - Retrieve a property from the server
  * PROTOCOL_BINARY_CMD_IOCTL_SET - Modify a property on the server.

Using these, implement a `set release_free_memory` command which will
request the memory allocator to return to the OS any free memory
inside the process.

To access this new functionality, add a `mcctl` command to set/get CTL
properties. Example usage (and currently only supported
functionality):

    ./mcctl -h localhost:12000 set release_free_memory

Change-Id: I35c40ff9c41c0f00802ff9db9202865ec146f46c
Reviewed-on: http://review.couchbase.org/39608
Reviewed-by: Trond Norbye <trond.norbye@gmail.com>
Tested-by: Trond Norbye <trond.norbye@gmail.com>
Add jemalloc support for cbstats memory/allocator

Allow the 'memory/allocator' statistic groups to output useful
information when jemalloc is the selected allocator.

Example output (for `cbstats allocator`):

    ___ Begin jemalloc statistics ___
    Version: 3.6.0-0-g46c0af68bd248b04df75e4f92d5fb804c3d75340
    Assertions disabled
    Run-time option settings:
      opt.abort: false
      opt.lg_chunk: 22
      opt.dss: "secondary"
      opt.narenas: 32
      opt.lg_dirty_mult: 3
      opt.stats_print: false
      opt.junk: false
      opt.quarantine: 0
      opt.redzone: false
      opt.zero: false
      opt.tcache: true
      opt.lg_tcache_max: 15
    CPUs: 8
    Arenas: 32
    Pointer size: 8
    Quantum size: 16
    Page size: 4096
    Min active:dirty page ratio per arena: 8:1
    Maximum thread-cached size class: 32768
    Chunk size: 4194304 (2^22)
    Allocated: 399542368, active: 405270528, mapped: 457179136
    Current active ceiling: 742391808
    chunks: nchunks   highchunks    curchunks
                109          109          109
    huge: nmalloc      ndalloc    allocated
                0            0            0

    Merged arenas stats:
    assigned threads: 14
    dss allocation precedence: N/A
    dirty pages: 98943:333 active:dirty, 1555 sweeps, 1601 madvises, 51586 purged
                allocated      nmalloc      ndalloc    nrequests
    small:      154081376       267133        35769      1616464
    large:      245460992        37051         5227        80776
    total:      399542368       304184        40996      1697240
    active:     405270528
    mapped:     452984832
    bins:     bin  size regs pgs    allocated      nmalloc      ndalloc    nrequests       nfills     nflushes      newruns       reruns      curruns
                0     8  501   1         4848         1525          919        80208           84           43           16            0           12
                1    16  252   1        23104         2021          577       135568           41           45           13            0           13
                2    32  126   1      1170112        37342          776       295700          439           41          301            5          297
                3    48   84   1        35040         1325          595        48957          183           47           17            1           15
                4    64   63   1       210752         4026          733       114187          170           75           60           12           58
                5    80   50   1      8051600       101751         1106       116700         2584           94         2031            9         2020
                6    96   84   2       247776        19352        16771       273741          516          275          228           29           36
                7   112   72   2       563360         6496         1466       213426          200           89           90            8           83
                8   128   63   2        49152         1091          707        12010           79           97           19            5           11
                9   160   51   2       477120         3837          855        28882          114           79           77            7           64
               10   192   63   3       136704         1444          732        15552           76           89           29           10           15
               11   224   72   4       767872         4305          877        21426          116           94           67            8           49
               12   256   63   4       662528         4048         1460        19599          222          112           71           13           50
               13   320   63   5       611520         2828          917         8689          104           81           49           10           33
               14   384   63   6       519936         2328          974         9027           76           81           42           11           26
               15   448   63   7      1088192         3294          865         6928           96           83           52            6           43
               16   512   63   8       896000         2675          925        17913           77           79           40            5           31
               17   640   51   8      1668480         3219          612         8215           92           53           62            6           53
               18   768   47   9      2200320         3520          655         9114          110           58           75            6           63
               19   896   45  10      2272256         3057          521        20491           98           49           65            5           58
               20  1024   63  16      2651136         3902         1313         7490           98           62           63           13           43
               21  1280   51  16      7720960         6380          348        16044          180           33          124            0          123
               22  1536   42  16      7856640         5430          315        15269          219           30          132            1          124
               23  1792   38  17      9375744         5263           31        15589          140            3          139            0          139
               24  2048   65  33     11214848         5762          286        15100          112           28           90            4           86
               25  2560   52  33     26073600        10244           59        30202          197            4          197            0          197
               26  3072   43  33     31211520        10470          310        30206          331           24          246            0          238
               27  3584   39  35     36320256        10198           64        30231          262            4          261            0          261
    large:   size pages      nmalloc      ndalloc    nrequests      curruns
             4096     1        10127           15        20128        10112
             8192     2        20630           14        41580        20616
            12288     3           66           48        12832           18
            16384     4           24            2           24           22
            20480     5            6            0            6            6
            24576     6           10            8           18            2
            28672     7         1024            0         1024         1024
            32768     8           21            2           21           19
    [3]
            49152    12           16           16           16            0
    [2]
            61440    15            2            0            2            2
            65536    16            2            2            2            0
    [8]
           102400    25            1            0            1            1
    [7]
           135168    33         5120         5120         5120            0
    [478]
          2097152   512            2            0            2            2
    [506]
    --- End jemalloc statistics ---

Change-Id: Ia06dbcc8c511006e376edd56d8330c22f7af0636
Reviewed-on: http://review.couchbase.org/39661
Reviewed-by: Trond Norbye <trond.norbye@gmail.com>
Tested-by: Trond Norbye <trond.norbye@gmail.com>
Merge remote-tracking branch 'membase/3.0'

* membase/3.0:
  Add jemalloc support for cbstats memory/allocator
  MB-11772: Add `release_free_memory` ioctl and `mcctl` program to access them

Change-Id: I98b4e3d693c3df1f872ba43e3eda2e52c3a5e8b6
Merge remote-tracking branch 'membase/3.0.1'

* membase/3.0.1:
  Add jemalloc support for cbstats memory/allocator
  MB-11772: Add `release_free_memory` ioctl and `mcctl` program to access them

Change-Id: I4d841660945c8a7afb2cdfa09f5931d07153421b