From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1757054AbdIHToa (ORCPT ); Fri, 8 Sep 2017 15:44:30 -0400 Received: from mga07.intel.com ([134.134.136.100]:19433 "EHLO mga07.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1756958AbdIHToY (ORCPT ); Fri, 8 Sep 2017 15:44:24 -0400 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.42,363,1500966000"; d="scan'208";a="309614098" Message-ID: <1504899861.5276.16.camel@tzanussi-mobl.amr.corp.intel.com> Subject: Re: [PATCH v2 34/40] tracing: Add 'last error' error facility for hist triggers From: Tom Zanussi To: Steven Rostedt Cc: tglx@linutronix.de, mhiramat@kernel.org, namhyung@kernel.org, vedang.patel@intel.com, bigeasy@linutronix.de, joel.opensrc@gmail.com, joelaf@google.com, mathieu.desnoyers@efficios.com, baohong.liu@intel.com, linux-kernel@vger.kernel.org, linux-rt-users@vger.kernel.org Date: Fri, 08 Sep 2017 14:44:21 -0500 In-Reply-To: <20170908152514.70d50052@gandalf.local.home> References: <89e851e663a2322cbe1d952d6e7695dacfed8a96.1504642143.git.tom.zanussi@linux.intel.com> <20170908152514.70d50052@gandalf.local.home> Content-Type: text/plain; charset="UTF-8" X-Mailer: Evolution 3.10.4 (3.10.4-4.fc20) Mime-Version: 1.0 Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Fri, 2017-09-08 at 15:25 -0400, Steven Rostedt wrote: > On Tue, 5 Sep 2017 16:57:46 -0500 > Tom Zanussi wrote: > > > +static char *hist_err_str; > > +static char *last_hist_cmd; > > + > > +static int hist_err_alloc(void) > > +{ > > + int ret = 0; > > + > > + last_hist_cmd = kzalloc(MAX_FILTER_STR_VAL, GFP_KERNEL); > > + if (!last_hist_cmd) > > + return -ENOMEM; > > + > > + hist_err_str = kzalloc(MAX_FILTER_STR_VAL, GFP_KERNEL); > > + if (!hist_err_str) { > > + kfree(last_hist_cmd); > > + ret = -ENOMEM; > > + } > > This gets allocated during boot up. Why have it be allocated in the > first place? Just have it be strings: > > static char hist_err_str[MAX_FILTER_STR_VAL]; > static char last_hist_cmd[MAX_FILTER_STR_VAL]; > > You are not saving any space by doing it this way. In fact, you waste > it because now you need to add the pointers to the strings. > Good point. I'll change that along with the other suggestions below. Thanks, Tom