cache: Use atomic operations for refcounting
cache: Use atomic operations for refcounting

This allows us to remove a lock in the fast path Release case.

cf324aa block_cache: optimize swap() call for handles
---------------
 Performance counter stats for './build/latest/bloomfile-test --benchmark_queries=10000000 --bloom_size_bytes=32768 --n_keys=100000 --gtest_filter=*Benchmark' (5 runs):

       2724.621564 task-clock                #    0.978 CPUs utilized            ( +-  1.24% )
               281 context-switches          #    0.103 K/sec                    ( +-  5.51% )
                20 cpu-migrations            #    0.007 K/sec                    ( +- 11.62% )
             1,540 page-faults               #    0.565 K/sec                    ( +-  0.01% )
     8,876,130,915 cycles                    #    3.258 GHz                      ( +-  1.13% )
   <not supported> stalled-cycles-frontend
   <not supported> stalled-cycles-backend
    15,585,203,759 instructions              #    1.76  insns per cycle          ( +-  0.00% )
     2,946,918,378 branches                  # 1081.588 M/sec                    ( +-  0.00% )
        20,625,019 branch-misses             #    0.70% of all branches          ( +-  0.14% )

       2.785319429 seconds time elapsed                                          ( +-  1.21% )

 Performance counter stats for './build/latest/mt-bloomfile-test --benchmark_queries=500000 --bloom_size_bytes=32768 --n_keys=5000000 --block_cache_capacity_mb=1' (5 runs):

      24710.490412 task-clock                #    6.728 CPUs utilized            ( +-  0.12% )
            25,852 context-switches          #    0.001 M/sec                    ( +-  2.59% )
               679 cpu-migrations            #    0.027 K/sec                    ( +- 12.88% )
            11,937 page-faults               #    0.483 K/sec                    ( +-  1.65% )
    78,633,209,705 cycles                    #    3.182 GHz                      ( +-  0.12% )
   <not supported> stalled-cycles-frontend
   <not supported> stalled-cycles-backend
    40,623,083,355 instructions              #    0.52  insns per cycle          ( +-  0.07% )
     3,561,203,700 branches                  #  144.117 M/sec                    ( +-  0.49% )
        36,154,554 branch-misses             #    1.02% of all branches          ( +-  0.15% )

       3.672796882 seconds time elapsed                                          ( +-  1.02% )

a9102cc Use an atomic decrement instead of lock when unreffing block cache handle
---------------

 Performance counter stats for './build/latest/bloomfile-test --benchmark_queries=10000000 --bloom_size_bytes=32768 --n_keys=100000 --gtest_filter=*Benchmark' (5 runs):

       2506.510402 task-clock                #    0.981 CPUs utilized            ( +-  0.38% )
               268 context-switches          #    0.107 K/sec                    ( +-  3.92% )
                15 cpu-migrations            #    0.006 K/sec                    ( +- 20.11% )
             1,535 page-faults               #    0.613 K/sec                    ( +-  0.03% )
     8,231,006,382 cycles                    #    3.284 GHz                      ( +-  0.43% )
   <not supported> stalled-cycles-frontend
   <not supported> stalled-cycles-backend
    15,414,389,321 instructions              #    1.87  insns per cycle          ( +-  0.00% )
     2,886,781,051 branches                  # 1151.713 M/sec                    ( +-  0.00% )
        20,588,777 branch-misses             #    0.71% of all branches          ( +-  0.10% )

       2.554665458 seconds time elapsed                                          ( +-  0.36% )

 Performance counter stats for './build/latest/mt-bloomfile-test --benchmark_queries=500000 --bloom_size_bytes=32768 --n_keys=5000000 --block_cache_capacity_mb=1' (5 runs):

      24730.902802 task-clock                #    7.045 CPUs utilized            ( +-  0.07% )
            23,720 context-switches          #    0.959 K/sec                    ( +-  1.36% )
               234 cpu-migrations            #    0.009 K/sec                    ( +-  7.20% )
            10,874 page-faults               #    0.440 K/sec                    ( +-  1.35% )
    78,736,017,198 cycles                    #    3.184 GHz                      ( +-  0.08% )
   <not supported> stalled-cycles-frontend
   <not supported> stalled-cycles-backend
    40,399,041,979 instructions              #    0.51  insns per cycle          ( +-  0.06% )
     3,486,319,001 branches                  #  140.970 M/sec                    ( +-  0.35% )
        35,155,389 branch-misses             #    1.01% of all branches          ( +-  0.10% )

       3.510586556 seconds time elapsed                                          ( +-  0.33% )

Change-Id: Ic32f68ebf84b258a4a52cdde5ec9dc7bab9245c7
Reviewed-on: http://gerrit.sjc.cloudera.com:8080/5542
Reviewed-by: Jean-Daniel Cryans <4bf4c125525b8623ac45dfd7774cbf531df19085@cloudera.com>
Tested-by: jenkins

cloudera/kudu,andrwng/kudu,andrwng/kudu,InspurUSA/kudu,EvilMcJerkface/kudu,cloudera/kudu,helifu/kudu,andrwng/kudu,EvilMcJerkface/kudu,andrwng/kudu,InspurUSA/kudu,EvilMcJerkface/kudu,InspurUSA/kudu,cloudera/kudu,helifu/kudu,InspurUSA/kudu,helifu/kudu,EvilMcJerkface/kudu,andrwng/kudu,EvilMcJerkface/kudu,cloudera/kudu,cloudera/kudu,InspurUSA/kudu,helifu/kudu,helifu/kudu,InspurUSA/kudu,helifu/kudu,cloudera/kudu,andrwng/kudu,helifu/kudu,andrwng/kudu,InspurUSA/kudu,helifu/kudu,InspurUSA/kudu,helifu/kudu,cloudera/kudu,EvilMcJerkface/kudu,cloudera/kudu,andrwng/kudu,cloudera/kudu,InspurUSA/kudu,EvilMcJerkface/kudu,EvilMcJerkface/kudu,EvilMcJerkface/kudu,andrwng/kudu