Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1729226

Re: [PATCH v2 34/40] tracing: Add 'last error' error facility for hist triggers

From Tom Zanussi <tom.zanussi@linux.intel.com>
Newsgroups linux.kernel
Subject Re: [PATCH v2 34/40] tracing: Add 'last error' error facility for hist triggers
Date 2017-09-08 21:50 +0200
Message-ID <unxrP-36G-1@gated-at.bofh.it> (permalink)
References <umu2Z-5m-5@gated-at.bofh.it> <umucF-oz-9@gated-at.bofh.it> <unx8u-2TU-7@gated-at.bofh.it>
Organization linux.* mail to news gateway

Show all headers | View raw


On Fri, 2017-09-08 at 15:25 -0400, Steven Rostedt wrote:
> On Tue,  5 Sep 2017 16:57:46 -0500
> Tom Zanussi <tom.zanussi@linux.intel.com> 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

Back to linux.kernel | Previous | Next — Previous in thread | Find similar | Unroll thread


Thread

[PATCH v2 34/40] tracing: Add 'last error' error facility for hist triggers Tom Zanussi <tom.zanussi@linux.intel.com> - 2017-09-06 00:10 +0200
  Re: [PATCH v2 34/40] tracing: Add 'last error' error facility for  hist triggers Steven Rostedt <rostedt@goodmis.org> - 2017-09-08 21:30 +0200
    Re: [PATCH v2 34/40] tracing: Add 'last error' error facility for  hist triggers Tom Zanussi <tom.zanussi@linux.intel.com> - 2017-09-08 21:50 +0200

csiph-web