[PATCH v3 03/12] perf, mmap: Factor out perf_alloc/free_rb()