From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1755169AbbA2TWB (ORCPT ); Thu, 29 Jan 2015 14:22:01 -0500 Received: from mail.kernel.org ([198.145.29.136]:57590 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750998AbbA2TWA (ORCPT ); Thu, 29 Jan 2015 14:22:00 -0500 Date: Thu, 29 Jan 2015 16:22:05 -0300 From: Arnaldo Carvalho de Melo To: Namhyung Kim Cc: Ingo Molnar , Peter Zijlstra , Jiri Olsa , LKML , David Ahern , Adrian Hunter , Andi Kleen , Stephane Eranian , Frederic Weisbecker Subject: Re: [PATCH 40/42] perf callchain: Save eh/debug frame offset for dwarf unwind Message-ID: <20150129192205.GW7220@kernel.org> References: <1422518843-25818-1-git-send-email-namhyung@kernel.org> <1422518843-25818-41-git-send-email-namhyung@kernel.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <1422518843-25818-41-git-send-email-namhyung@kernel.org> X-Url: http://acmel.wordpress.com User-Agent: Mutt/1.5.23 (2014-03-12) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Em Thu, Jan 29, 2015 at 05:07:21PM +0900, Namhyung Kim escreveu: > When libunwind tries to resolve callchains it needs to know the offset > of .eh_frame_hdr or .debug_frame to access the dso. Since it calls > dso__data_fd(), it'll try to grab dso->lock everytime for same > information. So save it to dso_data struct and reuse it. > > Note that there's a window between dso__data_fd() and actual use of > the fd. The fd could be closed by other threads to deal with the open > file limit in dso cache code. But I think it's ok since in that case > elf_section_offset() will return 0 so it'll be tried in next acess. Thanks, applied after rewriting the changelog to read as: --- perf callchain: Cache eh/debug frame offset for dwarf unwind When libunwind tries to resolve callchains it needs to know the offset of .eh_frame_hdr or .debug_frame to access the dso. Since it will always return the same result for a given DSO, just cache the result as an optimization. --- - Arnaldo