From: Jason Baron <jbaron@akamai.com>
To: Rasmus Villemoes <linux@rasmusvillemoes.dk>,
Andrew Morton <akpm@linux-foundation.org>
Cc: "linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>,
gregkh@linuxfoundation.org
Subject: Re: [PATCH] lib/dynamic_debug.c: use kstrdup_const
Date: Thu, 10 Sep 2015 10:23:54 -0400 [thread overview]
Message-ID: <55F1927A.2040408@akamai.com> (raw)
In-Reply-To: <1441834842-13950-1-git-send-email-linux@rasmusvillemoes.dk>
Looks fine to me.
Acked-by: Jason Baron <jbaron@akamai.com>
Andrew, want to pick this up?
Thanks,
-Jason
On 09/09/2015 05:40 PM, Rasmus Villemoes wrote:
> Using kstrdup_const, thus reusing .rodata when possible, saves around
> 2 kB of runtime memory on my laptop/.config combination.
>
> Signed-off-by: Rasmus Villemoes <linux@rasmusvillemoes.dk>
> ---
> lib/dynamic_debug.c | 8 ++++----
> 1 file changed, 4 insertions(+), 4 deletions(-)
>
> diff --git a/lib/dynamic_debug.c b/lib/dynamic_debug.c
> index e491e02eff54..e3952e9c8ec0 100644
> --- a/lib/dynamic_debug.c
> +++ b/lib/dynamic_debug.c
> @@ -42,7 +42,7 @@ extern struct _ddebug __stop___verbose[];
>
> struct ddebug_table {
> struct list_head link;
> - char *mod_name;
> + const char *mod_name;
> unsigned int num_ddebugs;
> struct _ddebug *ddebugs;
> };
> @@ -841,12 +841,12 @@ int ddebug_add_module(struct _ddebug *tab, unsigned int n,
> const char *name)
> {
> struct ddebug_table *dt;
> - char *new_name;
> + const char *new_name;
>
> dt = kzalloc(sizeof(*dt), GFP_KERNEL);
> if (dt == NULL)
> return -ENOMEM;
> - new_name = kstrdup(name, GFP_KERNEL);
> + new_name = kstrdup_const(name, GFP_KERNEL);
> if (new_name == NULL) {
> kfree(dt);
> return -ENOMEM;
> @@ -907,7 +907,7 @@ int ddebug_dyndbg_module_param_cb(char *param, char *val, const char *module)
> static void ddebug_table_free(struct ddebug_table *dt)
> {
> list_del_init(&dt->link);
> - kfree(dt->mod_name);
> + kfree_const(dt->mod_name);
> kfree(dt);
> }
>
>
prev parent reply other threads:[~2015-09-10 14:23 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-09-09 21:40 Rasmus Villemoes
2015-09-10 14:23 ` Jason Baron [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=55F1927A.2040408@akamai.com \
--to=jbaron@akamai.com \
--cc=akpm@linux-foundation.org \
--cc=gregkh@linuxfoundation.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux@rasmusvillemoes.dk \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
Powered by JetHome