perf hists: Move locking to its call-sites