[PATCH v3 02/12] perf, mmap: Factor out try_get_event()/put_event()