Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752766AbcD0Sos (ORCPT ); Wed, 27 Apr 2016 14:44:48 -0400 Received: from mail.kernel.org ([198.145.29.136]:43149 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751411AbcD0Sor (ORCPT ); Wed, 27 Apr 2016 14:44:47 -0400 Date: Thu, 28 Apr 2016 03:44:42 +0900 From: Masami Hiramatsu To: Arnaldo Carvalho de Melo Cc: linux-kernel@vger.kernel.org, Namhyung Kim , Peter Zijlstra , Ingo Molnar , Hemant Kumar , Ananth N Mavinakayanahalli Subject: Re: [PATCH perf/core v4 01/19] perf probe: Use strbuf for making strings Message-Id: <20160428034442.09cf7cb8b71fefff7ac5f5e2@kernel.org> In-Reply-To: <20160426145934.GE11033@kernel.org> References: <20160426090200.11891.43944.stgit@devbox> <20160426090211.11891.43979.stgit@devbox> <20160426133657.GA31483@kernel.org> <20160426234047.2748d56f82f29f3577c48479@kernel.org> <20160426145934.GE11033@kernel.org> X-Mailer: Sylpheed 3.4.3 (GTK+ 2.24.28; x86_64-redhat-linux-gnu) Mime-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1544 Lines: 43 On Tue, 26 Apr 2016 11:59:34 -0300 Arnaldo Carvalho de Melo wrote: > Em Tue, Apr 26, 2016 at 11:40:47PM +0900, Masami Hiramatsu escreveu: > > On Tue, 26 Apr 2016 10:36:57 -0300 > > Arnaldo Carvalho de Melo wrote: > > > > > Em Tue, Apr 26, 2016 at 06:02:11PM +0900, Masami Hiramatsu escreveu: > > > > From: Masami Hiramatsu > > > > > > > > Replace many fixed-length char array with strbuf to > > > > stringify perf_probe_event and probe_trace_event etc. > > > > > > Sure you want to do that? From time to time I try to reduce the strbuf > > > usage, not grow it :-\ > > > > Aah, I got what you want. > > > > > > > > That is one of the last users of xrealloc(), via that ALLOC_GROW() > > > thing. > > > > Hmm I'm not sure what you considering, memory usage? or code reducing? > > I also would like to remove e_snprintf() use in perf probe by replacing > > with strbuf functions. I'd like to find better way. > > What I don't like is that xrealloc ends up calling die() :-\ It should > instead propagate back the error. > > In lots of cases I managed to use what is in glibc, asprintf(), that > will allocate space and format in one go. > > But strbuf has this addf() one that indeed is handy. So I think I'll > take this patch as it is not for the simpler cases where asprintf() can > be used. OK, I'll try to remove die() and xrealloc() from the strbuf, since it seems most of users of strbuf() is perf-probe. Thanks, -- Masami Hiramatsu